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
 
using Common;
using Model;
using System;
using System.Web;
using System.Web.Profile;
using System.Web.SessionState;
using Dao;
using System.Collections.Generic;
using System.Text;
using System.Configuration;
 
public partial class _GwClient : PageBase<SysUser>, IRequiresSessionState
{
 
    protected List<SysUser> SysUserList;
    protected List<GwProduct> GwProductList;    
 
    string addressClasses = ConfigurationManager.AppSettings["addressClasses"];
 
    protected void Page_Load(object sender, EventArgs e)
    {
        //权限校验
        this.CheckRight("301", FailedOperation.ErrorMsgOnly);
 
        //获取启用的产品分类
        using (UserDao userDao = new UserDao())
        {
 
            int recordCount = 0;
            int int1 = 999999999;
            int int2 = 1;
            this.SysUserList = userDao.LoadInfoList(out recordCount, int1, int2);
 
        }
 
        //获取启用的产品
        using (GwProductDao gwProductDao = new GwProductDao())
        {
            GwProduct bean = new GwProduct();
            bean.Classes = 1;
            bean.IsDefault = -1;
            bean.IsEnable = -1;
            this.GwProductList = gwProductDao.getAllList(bean);
        }
    }
    public int IsEnable
    {
        get
        {
            return this.AppContext.GetInt("IsEnable");
        }
    }
 
 
    //归属业务员
    public string salesmanOptions(int userId)
    {
        StringBuilder stringBuilder = new StringBuilder();
        if (this.SysUserList.Count == 0)
            return "<option value=''>无</option>";
        stringBuilder.AppendFormat("<option value=\"{0}\" >{1}</option>", (object)"", (object)"无");
        foreach (SysUser bean in this.SysUserList)
        {
            //停用的用户不再显示
            if (bean.Status == 0)
            {
                continue;
            }
            //过滤用户类型 1-管理员;2-业务员--全员;3-业务主管;4-业务总监;5-客服人员;6-财务人员;99-其他
            if (bean.UserType == 6 || bean.UserType == 99)
            {
                continue;
            }
 
            if (userId == bean.UserID)
                stringBuilder.AppendFormat("<option value=\"{0}\" selected>{1}</option>", (object)bean.UserID, (object)bean.UserName);
            else
                stringBuilder.AppendFormat("<option value=\"{0}\">{1}</option>", (object)bean.UserID, (object)bean.UserName);
        }
        return stringBuilder.ToString();
    }
 
    //归属客户经理
    public string customerManagerOptions(int userId)
    {
        StringBuilder stringBuilder = new StringBuilder();
        if (this.SysUserList.Count == 0)
            return "<option value=''>无</option>";
        stringBuilder.AppendFormat("<option value=\"{0}\" >{1}</option>", (object)"", (object)"无");
        foreach (SysUser bean in this.SysUserList)
        {
            //停用的用户不再显示
            if (bean.Status == 0)
            {
                continue;
            }
            //过滤用户类型 1-管理员;2-业务员--全员;3-业务主管;4-业务总监;5-客服人员;6-财务人员;99-其他
            if (bean.UserType == 2)
            {
                continue;
            }
 
            if (userId == bean.UserID)
                stringBuilder.AppendFormat("<option value=\"{0}\" selected>{1}</option>", (object)bean.UserID, (object)bean.UserName);
            else
                stringBuilder.AppendFormat("<option value=\"{0}\">{1}</option>", (object)bean.UserID, (object)bean.UserName);
        }
        return stringBuilder.ToString();
    }
 
    //归属客服人员
    public string supportStaffOptions(int userId)
    {
        StringBuilder stringBuilder = new StringBuilder();
        if (this.SysUserList.Count == 0)
            return "<option value=''>无</option>";
        stringBuilder.AppendFormat("<option value=\"{0}\" >{1}</option>", (object)"", (object)"无");
        foreach (SysUser bean in this.SysUserList)
        {
            //停用的用户不再显示
            if (bean.Status == 0)
            {
                continue;
            }
            //过滤用户类型 1-管理员;2-业务员--全员;3-业务主管;4-业务总监;5-客服人员;6-财务人员;99-其他
            if (bean.UserType != 1 && bean.UserType != 5 )
            {
                continue;
            }
 
            if (userId == bean.UserID)
                stringBuilder.AppendFormat("<option value=\"{0}\" selected>{1}</option>", (object)bean.UserID, (object)bean.UserName);
            else
                stringBuilder.AppendFormat("<option value=\"{0}\">{1}</option>", (object)bean.UserID, (object)bean.UserName);
        }
        return stringBuilder.ToString();
    }
 
    //归属财务人员
    public string financialStaffOptions(int userId)
    {
        StringBuilder stringBuilder = new StringBuilder();
        if (this.SysUserList.Count == 0)
            return "<option value=''>无</option>";
        stringBuilder.AppendFormat("<option value=\"{0}\" >{1}</option>", (object)"", (object)"无");
        foreach (SysUser bean in this.SysUserList)
        {
            //停用的用户不再显示
            if (bean.Status == 0)
            {
                continue;
            }
            //过滤用户类型 1-管理员;2-业务员--全员;3-业务主管;4-业务总监;5-客服人员;6-财务人员;99-其他
            if (bean.UserType != 1 && bean.UserType != 6)
            {
                continue;
            }
 
            if (userId == bean.UserID)
                stringBuilder.AppendFormat("<option value=\"{0}\" selected>{1}</option>", (object)bean.UserID, (object)bean.UserName);
            else
                stringBuilder.AppendFormat("<option value=\"{0}\">{1}</option>", (object)bean.UserID, (object)bean.UserName);
        }
        return stringBuilder.ToString();
    }
 
 
    //获取产品信息
    public string GetProductOptions(string productId)
    {
        StringBuilder stringBuilder = new StringBuilder();
        if (this.GwProductList.Count == 0)
            return "<option value=''>无</option>";
        stringBuilder.AppendFormat("<option value=\"{0}\" >{1}</option>", (object)"", (object)"无");
        foreach (GwProduct bean in this.GwProductList)
        {
            //停用的产品分类不再显示
            if (bean.IsEnable == 0)
            {
                continue;
            }
            //过滤产品类别
            if (bean.Classes == 0)
            {
                continue;
            }
 
            if (productId.Equals(bean.Id))
                stringBuilder.AppendFormat("<option value=\"{0}\" selected>{1}</option>", (object)bean.Id, (object)bean.Name);
            else
                stringBuilder.AppendFormat("<option value=\"{0}\">{1}</option>", (object)bean.Id, (object)bean.Name);
        }
        return stringBuilder.ToString();
    }
 
 
    //获取个性产品信息
    public string GetPersonalityProductOptions(string productId)
    {
        StringBuilder stringBuilder = new StringBuilder();
        if (this.GwProductList.Count == 0)
            return "<option value=''>无</option>";
        stringBuilder.AppendFormat("<option value=\"{0}\" >{1}</option>", (object)"", (object)"无");
        foreach (GwProduct bean in this.GwProductList)
        {
            //停用的产品分类不再显示
            if (bean.IsEnable == 0)
            {
                continue;
            }
            //过滤产品类别
            if (bean.Classes == 0)
            {
                continue;
            }
            //过滤推广方式
            if (bean.IsDefault == 1)
            {
                continue;
            }
 
            if (productId.Equals(bean.Id))
                stringBuilder.AppendFormat("<option value=\"{0}\" selected>{1}</option>", (object)bean.Id, (object)bean.Name);
            else
                stringBuilder.AppendFormat("<option value=\"{0}\">{1}</option>", (object)bean.Id, (object)bean.Name);
        }
        return stringBuilder.ToString();
    }
 
    //所有个性产品
    protected string ClientProductAll()
    {
        using (GwProductDao gwProductDao = new GwProductDao())
        {
            GwProduct gwProduct = new GwProduct();
            gwProduct.Classes = 1;  //0-产品分类;1-产品
            gwProduct.IsDefault = 0;    //默认值0。0-个性化;1-系统默认。
            gwProduct.IsEnable = 1;    //0-停用;1-启用;默认1
            List<GwProduct> list = gwProductDao.getAllList(gwProduct);
 
            StringBuilder stringBuilder = new StringBuilder();
            stringBuilder.Append("<table cellpadding='5'>");
            if(list.Count>0)
            {
                for (int i = 0; i < list.Count; i++)
                {
                    GwProduct bean = (GwProduct)list[i];
 
                    //行开始符
                    if (i%5 == 0)
                    {
                        stringBuilder.Append("<tr>");
                    }
 
                    //行单元格
                    stringBuilder.AppendFormat("<td><input  type=\"checkbox\" id=\"_ProductId\"  name=\"_ProductId\" value=\"{0}\" /><span  style='padding:5px;'>{1} </span>  \r\n         </td>", (object)bean.Id, (object)bean.Name);
 
                    //行结束符
                    if (i % 5 == 4 || i == (list.Count - 1))
                    {
                        stringBuilder.Append("</tr>");
                    }
 
                }
            }
            stringBuilder.Append("</table>");
 
            return stringBuilder.ToString();
        }
    }
 
 
}