username@email.com
2025-05-14 99ddfbcecf0fa2881eb3a91028257eef87dab6de
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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CY.BLL.EC;
using CY.Model;
using CY.Infrastructure.Common;
using CY.BLL;
namespace CY.WebForm.Pages.sysInquiry
{
    public partial class SelectBusinessRange : BasePage
    {
        #region 变量
        EC_SellerBusinessLimitsBLL _eC_SellerBusinessLimitsBLL = new EC_SellerBusinessLimitsBLL();
        EC_MemberBasicBLL _EC_MemberBasicBLL = new EC_MemberBasicBLL();
        #endregion
 
        #region 属性
        #endregion
 
        #region 方法
        /// <summary>
        /// 初始化绑定页面
        /// </summary>
        private void BindPage()
        {
            int isShowInquiry = _EC_MemberBasicBLL.GetMemberByMemberId(CurrentUser.MemberId).IsShowInquiry;
            if (isShowInquiry == 1)
            {
                this.cbkIsShowInquiry.Checked = true;
            }
            else
            {
                this.cbkIsShowInquiry.Checked = false;
            }
            IList<SysInquiry_PrintingType> list = _eC_SellerBusinessLimitsBLL.GetBusinessRangeByFirmId(CurrentUser.MemberId);
            this.RepBusinessRangeList.DataSource = list;
            this.RepBusinessRangeList.DataBind();
            IList<EC_SellerBusinessLimits> limitList = _eC_SellerBusinessLimitsBLL.GetBusinessRangeDetaiByFirmId(CurrentUser.MemberId);
            foreach (RepeaterItem item in this.RepBusinessRangeList.Items)
            {
                if (item.ItemType == ListItemType.Item || item.ItemType == ListItemType.AlternatingItem)
                {
                    CheckBox cbkSel = item.FindControl("cbkSel") as CheckBox;
                    CheckBox cbkHBSel = item.FindControl("cbkHBSel") as CheckBox;
                    CheckBox cbkZBSel = item.FindControl("cbkZBSel") as CheckBox;
                    Label lblKeyId = item.FindControl("lblKeyId") as Label;
                    int keyId=lblKeyId.Text.ToInt32().Value;
                    EC_SellerBusinessLimits model = limitList.Single<EC_SellerBusinessLimits>(p => p.BusinessId == keyId) as EC_SellerBusinessLimits;
                    if (model.JoinFlag.HasValue)
                    {
                        if (model.JoinFlag.Value == 1)
                        {
                            cbkHBSel.Checked = true;
                        }
                        else if (model.JoinFlag.Value == -1)
                        {
                            cbkHBSel.Checked = true;
                            cbkHBSel.Visible = false;
                            cbkHBSel.Text = "-1";
                        }
                    }
                    if (model.SpecialFlag.HasValue)
                    {
                        if (model.SpecialFlag.Value == 1)
                        {
                            cbkZBSel.Checked = true;
                        }
                        else if (model.SpecialFlag.Value == -1)
                        {
                            cbkZBSel.Checked = true;
                            cbkZBSel.Visible = false;
                            cbkZBSel.Text = "-1";
                        }
                    }
                    if (cbkHBSel.Checked || cbkZBSel.Checked)
                    {
                        cbkSel.Checked = true;
                    }
                }
            }
        }
        #endregion
 
        #region 事件
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                BindPage();
            }
        }
 
        /// <summary>
        /// 保存事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSave_Click(object sender, EventArgs e)
        {
            bool isSuccess = true;
            IList<EC_SellerBusinessLimits> list = new List<EC_SellerBusinessLimits>();
            EC_SellerBusinessLimits model = null;
            foreach (RepeaterItem item in this.RepBusinessRangeList.Items)
            {
                if (item.ItemType == ListItemType.Item || item.ItemType == ListItemType.AlternatingItem)
                {
                    CheckBox cbkHBSel = item.FindControl("cbkHBSel") as CheckBox;
                    CheckBox cbkZBSel = item.FindControl("cbkZBSel") as CheckBox;
                    Label lblKeyId = item.FindControl("lblKeyId") as Label;
                    int keyId = lblKeyId.Text.ToInt32().Value;
                    model = new EC_SellerBusinessLimits();
                    model.SellerId = CurrentUser.MemberId;
                    model.BusinessId = keyId;
                    if (cbkHBSel.Text == "-1")
                    {
                        model.JoinFlag = -1;
                    }
                    else
                    {
                        if (cbkHBSel.Checked)
                        {
                            model.JoinFlag = 1;
                        }
                        else
                        {
                            model.JoinFlag = 0;
                        }
                    }
                    if (cbkZBSel.Text == "-1")
                    {
                        model.SpecialFlag = -1;
                    }
                    else
                    {
                        if (cbkZBSel.Checked)
                        {
                            model.SpecialFlag = 1;
                        }
                        else
                        {
                            model.SpecialFlag = 0;
                        }
                    }
                    list.Add(model);
                }
            }
            isSuccess = _eC_SellerBusinessLimitsBLL.SaveBusinessRangeDetailByFirmId(list);
            if (isSuccess)
            {
                JavaScript.MessageBox("保存成功", this);
            }
            else
            {
                JavaScript.MessageBox("保存失败", this);
            }
        }
 
        /// <summary>
        /// 保存事件2
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSave2_Click(object sender, EventArgs e)
        {
            int isShowInquiry = 1;
            if (!this.cbkIsShowInquiry.Checked)
            {
                isShowInquiry = 0;
            }
            bool isSuccess = _EC_MemberBasicBLL.UpdateIsShowInquiry(CurrentUser.MemberId, isShowInquiry);
            if (isSuccess)
            {
                JavaScript.MessageBox("保存成功", this);
            }
            else
            {
                JavaScript.MessageBox("保存失败", this);
            }
        }
        #endregion
    }
}