username@email.com
2024-12-25 84f9a6812122e59ba862d2e72c743b29c7ed5f48
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CY.BLL;
using CY.Model;
using CY.Infrastructure.Query;
using CY.Infrastructure.Common;
using CY.BLL.Sys;
using CY.BLL.OA;
using CY.BLL.EC;
using System.Transactions;
 
namespace CY.WebForm.Pages.financial
{
    public partial class PlanOrderEdit : BasePage
    {
        CoreCmsPlanOrderBLL _PlanOrderBLL = new CoreCmsPlanOrderBLL();
        CoreCmsPlanOrderItemBLL _coreCmsPlanOrderItemBLL = new CoreCmsPlanOrderItemBLL();
 
        public PlanOrderEdit()
        {
           
        }
 
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                InitialData();
                if (Request["Keyid"].ToInt32() > 0)  // 加载要修改的的数据
                {
                    HideKeyid.Value = Request["Keyid"].ToString2();
                    InitialModifyData();
                }
            }
        }
 
        /// <summary>
        /// 初始化科目类别
        /// </summary>
        public void InitialData()
        {
             
        }
 
        /// <summary>
        /// 初始化要修改的数据
        /// </summary>
        public void InitialModifyData()
        {
            var coreCmsPlanOrder = _PlanOrderBLL.GetModelByKeyid(Request["Keyid"].ToInt32().Value);
            spnsheng.InnerText = coreCmsPlanOrder.sheng;
            spnshi.InnerText = coreCmsPlanOrder.shi;
            spnquxian.InnerText = coreCmsPlanOrder.quxian;
            spnpianqu.Value = coreCmsPlanOrder.pianqu;
            spnshipAddress.Value = coreCmsPlanOrder.shipAddress;
            spnshipName.Value = coreCmsPlanOrder.shipName;
            spnshipMobile.Value = coreCmsPlanOrder.shipMobile;
            spnshouhuoAddress.Value = coreCmsPlanOrder.shouhuoAddress;
            OrderAmount.Value = coreCmsPlanOrder.orderAmount.ToString2();
 
 
 
            this.RepSubjeSetctList.DataSource = _coreCmsPlanOrderItemBLL.GetModelsByOrderid(Request["Keyid"].ToInt32().Value);
 
            this.RepSubjeSetctList.DataBind();
        }
 
        /// <summary>
        /// 添加或修改科目
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btn_Submit_Config(object sender, EventArgs e)
        {
 
          string id =   HideKeyid.Value;
          var orderAmount  =  this.OrderAmount.Value;
            var pianqu = this.spnpianqu.Value.Trim();
            var shipAddress = this.spnshipAddress.Value.Trim();
            var shipName = this.spnshipName.Value.Trim();
            var shipMobile = this.spnshipMobile.Value.Trim();
            var shouhuoAddress = this.spnshouhuoAddress.Value.Trim();
            string[] ids = Request["id"].ToString2().Split(',');
            string[] price = Request["price"].ToString2().Split(',');
            string[] itemNumarray = Request["itemNumarray"].ToString2().Split(',');
            string[] amount = Request["amount"].ToString2().Split(',');
            var sss = false;
            EC_OrderBasicBLL _eC_OrderBasicBLL = new EC_OrderBasicBLL();
            int orderkeyid = 0;
            using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required,
         new TransactionOptions
         {
             IsolationLevel = IsolationLevel.ReadCommitted,
             Timeout = TransactionManager.MaximumTimeout
         }
         ))
            {
                var coreCmsPlanOrder = _PlanOrderBLL.GetModelByKeyid(id.ToInt32().Value);
                orderkeyid = coreCmsPlanOrder.orderkeyid.Value;
                coreCmsPlanOrder.orderAmount = orderAmount.ToDecimal2().Value;
                coreCmsPlanOrder.pianqu = pianqu;
                coreCmsPlanOrder.shipAddress = shipAddress;
                coreCmsPlanOrder.shipName = shipName;
                coreCmsPlanOrder.shipMobile = shipMobile;
                coreCmsPlanOrder.userMobile = shipMobile;
                coreCmsPlanOrder.shouhuoAddress = shouhuoAddress;
                coreCmsPlanOrder.upDataTime = DateTime.Now;
                coreCmsPlanOrder.upDataBy = CurrentUser.ShortName;
                if (!coreCmsPlanOrder.createTime.HasValue)
                {
                    coreCmsPlanOrder.createTime = DateTime.Now;
                    coreCmsPlanOrder.createBy = CurrentUser.ShortName;
 
                }
 
 
                sss = _PlanOrderBLL.UpdateModel(coreCmsPlanOrder);
 
 
                for (int i = 0; i < ids.Length; i++)
                {
                    var cmsPlanOrderItem = _coreCmsPlanOrderItemBLL.GetModelByKeyid(ids[i].ToInt32().Value);
                    cmsPlanOrderItem.nums = itemNumarray[i].ToInt32().Value;
                    cmsPlanOrderItem.amount = amount[i].ToDecimal2().Value;
                    cmsPlanOrderItem.upDataTime = DateTime.Now;
                    cmsPlanOrderItem.upDataBy = CurrentUser.ShortName;
                    if (!cmsPlanOrderItem.createTime.HasValue)
                    {
                        cmsPlanOrderItem.createTime = DateTime.Now;
                        cmsPlanOrderItem.createBy = CurrentUser.ShortName;
 
                    }
                    sss = _PlanOrderBLL.UpdateModelOrderItem(cmsPlanOrderItem);
                }
 
                //更新整个订单的总价格
               
 
              
 
            scope.Complete();
        }
        sss = _eC_OrderBasicBLL.UpdateorderJine(orderkeyid);
          
            if (sss)
            {
                JavaScript.MessageBoxCloseAndRefreshFirsts("更新成功", this);
               
            }
            else
            {
                JavaScript.MessageBox("更新失败", this);
            }
            
        }
    }
}