username@email.com
2025-05-12 ae6e40362a745caef9ead36f81f38313fb8c2c66
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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CY.Model;
using CY.BLL;
using CY.Infrastructure.Common;
using System.Data;
using CY.BLL.Sys;
using System.Text;
 
namespace CY.WebForm.Pages.membermanage
{
    //吴辉
    //新增/修改订单
    public partial class MemberOrderEdit : BasePage
    {
        Sys_DictionaryBLL bll_Sys_DictionaryBLL = null;
        EC_MemberBasicBLL bll_EC_MemberBasicBLL = null;
        EC_PaymentRecordBLL bll_EC_PaymentRecordBLL = null;
        OA_StaffBLL bll_OA_StaffBLL = null;
 
        //初始化
        public MemberOrderEdit()
        {
            bll_Sys_DictionaryBLL = new Sys_DictionaryBLL();
            bll_EC_MemberBasicBLL = new EC_MemberBasicBLL();
            bll_EC_PaymentRecordBLL = new EC_PaymentRecordBLL();
            bll_OA_StaffBLL = new OA_StaffBLL();
        }
 
        //页面加载
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                switch (Request["datatype"].ToString2())
                {
                    case "check":
                        if (Request["companyName"] != null && Request["datatype"].ToString2() == "check")
                            Response.Write(BindCompanyList(Request["companyName"].ToString2().Trim()));
                        break;
                    default:
                        if (!IsPostBack)
                        {
                            InitData();
                        }
                        return;
                }
            }
            catch (Exception ex)
            {
                PAGEHandleException(ex);
                Response.Clear();
                Response.Write("");
            }
            Response.End();
        }
 
        /// <summary>
        /// 绑定会员订单类型
        /// </summary>
        private void BindOrderTypeList()
        {
            IList<Sys_Dictionary> sysDicList = new Sys_DictionaryBLL().GetDataByType("会员订单类型").OrderBy(p => p.MeanValue).ToList<Sys_Dictionary>();
 
            this.selOrderType.DataSource = sysDicList;
            this.selOrderType.DataTextField = "Name";
            this.selOrderType.DataValueField = "Name";
            this.selOrderType.DataBind();
 
            this.selOrderType.Items.Insert(0, new ListItem("全部", ""));
 
        }
 
        //绑定数据
        public void InitData()
        {
            BindOrderTypeList();
 
            //业务经理  
            this.selBusinessManagerId.DataSource = bll_OA_StaffBLL.SelectListByFirmId(CurrentUser.MemberId, true, false);
            this.selBusinessManagerId.DataTextField = "Name";
            this.selBusinessManagerId.DataValueField = "Keyid";
            this.selBusinessManagerId.DataBind();
            this.selBusinessManagerId.Items.Insert(0, new ListItem("请选择", ""));
 
            //客户经理
            this.selAccountManagerId.DataSource = bll_OA_StaffBLL.SelectListByFirmId(CurrentUser.MemberId, false, true);
            this.selAccountManagerId.DataTextField = "Name";
            this.selAccountManagerId.DataValueField = "Keyid";
            this.selAccountManagerId.DataBind();
            this.selAccountManagerId.Items.Insert(0, new ListItem("请选择", ""));
 
            EC_PaymentRecord m_EC_PaymentRecord = bll_EC_PaymentRecordBLL.GetModelByKeyid(Request["Keyid"].ToInt32());
            if (m_EC_PaymentRecord != null)
            {
                this.selOrderType.SelectedValue = m_EC_PaymentRecord.PayType;
                this.selOrderType.Enabled = false;
                this.spanOperator.InnerText = m_EC_PaymentRecord.Operator;
                this.spanRemark.InnerText = m_EC_PaymentRecord.Remark;
                this.selAccountManagerId.Value = m_EC_PaymentRecord.AccountManagerId.ToString2();
                this.selBusinessManagerId.Value = m_EC_PaymentRecord.BusinessManagerId.ToString2();
                this.txtAdInstallments.Text = m_EC_PaymentRecord.AdInstallments;
                this.txtAdInstallments.Enabled = false;
                this.txtAdForum.Text = m_EC_PaymentRecord.AdForum;
                this.txtAdForum.Enabled = false;
                this.txtAdLocation.Text = m_EC_PaymentRecord.AdLocation;
                this.txtAdLocation.Enabled = false;
                this.txtAdSize.Text = m_EC_PaymentRecord.AdSize;
                this.txtAdSize.Enabled = false;
                this.spanAdImg.InnerHtml = m_EC_PaymentRecord.AdImg;
                this.txtCompanyPhone.Text = m_EC_PaymentRecord.CompanyPhone;
                this.txtCompanyPhone.Enabled = false;
                this.txtCompanyName.Text = m_EC_PaymentRecord.MemberName;
                this.txtCompanyName.Enabled = false;
                this.txtReset.Visible = false;
                this.txtHideMemberId.Value = m_EC_PaymentRecord.MemberId.ToString2();
                this.txtContact.Text = m_EC_PaymentRecord.Contact;
                this.txtContact.Enabled = false;
                this.txtEmail.Text = m_EC_PaymentRecord.Email;
                this.txtEmail.Enabled = false;
                this.txtQQ.Text = m_EC_PaymentRecord.QQ;
                this.txtQQ.Enabled = false;
                this.txtSoftwarePermissions.Value = m_EC_PaymentRecord.SoftwarePermissions;
                this.txtSoftwarePermissions.Attributes.Add("readonly", "readonly");
                this.txtPayAllMoney.Value = m_EC_PaymentRecord.PayAllMoney.Value.ToString("0");
                //this.txtPayMoney.Value = m_EC_PaymentRecord.PayMoney.Value.ToString("0");
                this.txtPayStartTime.Value = (m_EC_PaymentRecord.PayStartTime ?? DateTime.Now).ToString("yyyy-MM-dd");
                this.txtPayEndTime.Value = (m_EC_PaymentRecord.PayEndTime ?? DateTime.Now).ToString("yyyy-MM-dd");
 
                switch (m_EC_PaymentRecord.PayType)
                {
                    case "印刷厂商注册费":
                        this.PanelAd.Visible = false;
                        this.PanelSoft.Visible = false;
                        break;
                    case "个人网店押金":
                        this.PanelAd.Visible = false;
                        this.PanelSoft.Visible = false;
                        break;
                    case "杂志广告费":
                        this.PanelAd.Visible = true;
                        this.PanelWebAd.Visible = false;
                        this.PanelBookAd.Visible = true;
                        this.PanelSoft.Visible = false;
                        break;
                    case "网站广告费":
                        this.PanelAd.Visible = true;
                        this.PanelWebAd.Visible = true;
                        this.PanelBookAd.Visible = false;
                        this.PanelSoft.Visible = false;
                        break;
                    case "管理软件费":
                        this.PanelAd.Visible = false;
                        this.PanelSoft.Visible = true;
                        break;
                    default:
                        break;
                }
            }
            else
            {
                this.txtPayStartTime.Value = DateTime.Now.ToString("yyyy-MM-dd");
                this.txtPayEndTime.Value = DateTime.Now.AddYears(1).ToString("yyyy-MM-dd");
                this.selOrderType.Items.Remove(new ListItem("网站广告费", "网站广告费"));
                this.spanRemark.InnerText = bll_EC_PaymentRecordBLL.GetNewOrderId();
                this.spanOperator.InnerText = CurrentUser.ShortName;
            }
        }
 
        //绑定关联会员列表
        protected string BindCompanyList(string companyname)
        {
            List<EC_MemberExtend> m_EC_MemberExtendList = bll_EC_MemberBasicBLL.SelectExtendListByName(companyname) as List<EC_MemberExtend>;
 
            string[] modelArry = new string[m_EC_MemberExtendList.Count];
            int i = 0;
            foreach (var item in m_EC_MemberExtendList)
            {
                string result = "";
                StringBuilder sb_html = new StringBuilder();
 
                sb_html.AppendFormat("CustormKeyId:'{0}',", item.Keyid);
                sb_html.AppendFormat("CustormName:'{0}',", item.Name);
                sb_html.AppendFormat("CustormContact:'{0}',", item.BusinessContacts);
                sb_html.AppendFormat("CustormPhone:'{0}',", item.PhoneNum);
                sb_html.AppendFormat("CustormQQ:'{0}',", item.QQ);
                sb_html.AppendFormat("CustormEamil:'{0}'", item.Email);
                result = "{" + sb_html.ToString() + "}";
                modelArry[i] = result;
                i++;
            }
            return ("[" + string.Join(",", modelArry) + "]");
        }
 
        //提交事件
        protected void btn_Submit_Click(object sender, EventArgs e)
        {
            try
            {
                EC_PaymentRecord m_EC_PaymentRecord = bll_EC_PaymentRecordBLL.GetModelByKeyid(Request["Keyid"].ToInt32());
                if (m_EC_PaymentRecord != null)
                {
                    m_EC_PaymentRecord.BusinessManagerId = this.selBusinessManagerId.Value.ToInt32() ?? 0;
                    m_EC_PaymentRecord.AccountManagerId = this.selAccountManagerId.Value.ToInt32() ?? 0;
                    m_EC_PaymentRecord.PayStartTime = this.txtPayStartTime.Value.ToDateTime2();
                    m_EC_PaymentRecord.PayEndTime = this.txtPayEndTime.Value.ToDateTime2();
                    m_EC_PaymentRecord.PayAllMoney = this.txtPayAllMoney.Value.ToInt32();
                    //m_EC_PaymentRecord.PayMoney = this.txtPayAllMoney.Value.ToInt32();
                    m_EC_PaymentRecord.LastUpdateTime = DateTime.Now;
                    if (bll_EC_PaymentRecordBLL.UpdateModel(m_EC_PaymentRecord))
                        JavaScript.MessageBox("更新成功", this, true, true);
                    else
                        JavaScript.MessageBox("操作失败", this);
                }
                else
                {
                    EC_MemberBasic m_EC_MemberBasic = bll_EC_MemberBasicBLL.GetMemberByMemberId(this.txtHideMemberId.Value.ToGuid2());
 
                    m_EC_PaymentRecord = new EC_PaymentRecord();
                    m_EC_PaymentRecord.BusinessManagerId = this.selBusinessManagerId.Value.ToInt32() ?? 0;
                    m_EC_PaymentRecord.AccountManagerId = this.selAccountManagerId.Value.ToInt32() ?? 0;
                    m_EC_PaymentRecord.PayStartTime = this.txtPayStartTime.Value.ToDateTime2();
                    m_EC_PaymentRecord.PayEndTime = this.txtPayEndTime.Value.ToDateTime2();
                    m_EC_PaymentRecord.LastUpdateTime = DateTime.Now;
                    m_EC_PaymentRecord.AdForum = this.txtAdForum.Text;
                    m_EC_PaymentRecord.AdImg = "";
                    m_EC_PaymentRecord.AdInstallments = this.txtAdInstallments.Text;
                    m_EC_PaymentRecord.AdLocation = this.txtAdLocation.Text;
                    m_EC_PaymentRecord.AdSize = this.txtAdSize.Text;
                    m_EC_PaymentRecord.CompanyPhone = this.txtCompanyPhone.Text;
                    m_EC_PaymentRecord.Contact = this.txtContact.Text;
                    m_EC_PaymentRecord.Email = this.txtEmail.Text;
                    m_EC_PaymentRecord.MemberId = this.txtHideMemberId.Value.ToGuid2();
                    m_EC_PaymentRecord.MemberName = this.txtCompanyName.Text;
                    m_EC_PaymentRecord.Operator = CurrentUser.ShortName;
                    m_EC_PaymentRecord.PayAllMoney = this.txtPayAllMoney.Value.ToInt32()??0;
                    m_EC_PaymentRecord.PayMoney = this.txtPayAllMoney.Value.ToInt32();
                    m_EC_PaymentRecord.PayRole = m_EC_MemberBasic.MemberType;
                    m_EC_PaymentRecord.PayType = this.selOrderType.SelectedValue;
                    m_EC_PaymentRecord.QQ = this.txtQQ.Text;
                    m_EC_PaymentRecord.Remark = bll_EC_PaymentRecordBLL.GetNewOrderId();
                    m_EC_PaymentRecord.SoftwarePermissions = this.txtSoftwarePermissions.Value;
 
                    if (bll_EC_PaymentRecordBLL.InsertModel(m_EC_PaymentRecord))
                    {
                        //int typeid = 0;
                        //if (!string.IsNullOrEmpty(m_EC_PaymentRecord.PayType))
                        //{
                        //    switch (m_EC_PaymentRecord.PayType)
                        //    {
                        //        case "杂志广告费":
                        //            typeid = 90;
                        //            break;
                        //        case "管理软件费":
                        //            typeid = 91;
                        //            break;
                        //        case "印刷厂商注册费":
                        //            typeid = 89;
                        //            break;
                        //        case "个人网店押金":
                        //            typeid = 393;
                        //            break;
                        //        default:
                        //            typeid = 0;
                        //            break;
                        //    }
                        //    if (typeid > 0)
                        //    {
                        //        Pay_PaymentAccountBLL _pay_PaymentAccountBLL = new Pay_PaymentAccountBLL();
                        //        _pay_PaymentAccountBLL.SendPoOrMoToMember(m_EC_MemberBasic.MemberId, typeid, m_EC_PaymentRecord.PayMoney);
                        //    }
                        //}
                        JavaScript.MessageBox("新增成功", this, true, true);
                    }
                    else
                        JavaScript.MessageBox("操作失败", this);
                }
            }
            catch (Exception ex)
            {
                PAGEHandleException(ex);
                return;
            }
        }
 
        //订单类型切换事件
        protected void ChangeType(object sender, EventArgs e)
        {
            var type = this.selOrderType.SelectedValue.ToString2();
            switch (type)
            {
                case "印刷厂商注册费":
                    this.PanelAd.Visible = false;
                    this.PanelSoft.Visible = false;
                    break;
                case "印刷厂商续费":
                    this.PanelAd.Visible = false;
                    this.PanelSoft.Visible = false;
                    break;
                case "个人网店押金":
                    this.PanelAd.Visible = false;
                    this.PanelSoft.Visible = false;
                    break;
                case "杂志广告费":
                    this.PanelAd.Visible = true;
                    this.PanelWebAd.Visible = false;
                    this.PanelBookAd.Visible = true;
                    this.PanelSoft.Visible = false;
                    this.txtAdForum.Attributes.Remove("readonly");
                    this.txtAdInstallments.Attributes.Remove("readonly");
                    this.txtAdLocation.Attributes.Remove("readonly");
                    this.txtAdSize.Attributes.Remove("readonly");
                    break;
                case "网站广告费":
                    this.PanelAd.Visible = true;
                    this.PanelWebAd.Visible = true;
                    this.PanelBookAd.Visible = false;
                    this.PanelSoft.Visible = false;
                    this.txtAdForum.Attributes.Add("readonly", "readonly");
                    this.txtAdLocation.Attributes.Add("readonly", "readonly");
                    this.txtAdSize.Attributes.Add("readonly", "readonly");
                    break;
                case "管理软件费":
                    this.PanelAd.Visible = false;
                    this.PanelSoft.Visible = true;
                    break;
                default:
                    break;
            }
        }
    }
}