| | |
| | | <%@ WebHandler Language="C#" Class="GwClientHandler" %> |
| | | using System; |
| | | using System.Linq; |
| | | using System.Web; |
| | | using Dao; |
| | | using Model; |
| | |
| | | using System.Text; |
| | | using System.Text.RegularExpressions; |
| | | using System.IO; |
| | | using Newtonsoft.Json; |
| | | |
| | | |
| | | |
| | |
| | | private UserDao _SysUserDao = new UserDao(); |
| | | private List<SysUser> _SysUserList; |
| | | |
| | | private int _userId = -1; |
| | | private int _userType = -1; |
| | | private string _account = ""; |
| | | |
| | | public override JsonPageResult ProcessRequestInternal(PageContext<Model.SysUser> context) |
| | | { |
| | | string action = context.GetString("action"); |
| | | |
| | | _userId = context.SessionObject.UserID; |
| | | _userType = context.SessionObject.UserType; |
| | | _account = context.SessionObject.Account; |
| | | |
| | | switch (action) |
| | | { |
| | |
| | | |
| | | case "updateBlack": |
| | | return UpdateBlack(context); |
| | | //批量分配客户的个性产品 |
| | | case "batchUpdateClientProduct": |
| | | return BatchUpdateClientProduct(context); |
| | | |
| | | default: |
| | | throw new Exception("Invalid Action=" + action); |
| | |
| | | int pageSize = context.GetInt("pageSize", 20); |
| | | string serverIp = ConfigurationManager.AppSettings["serverIp"]; |
| | | string clientPort = ConfigurationManager.AppSettings["clientPort"]; |
| | | |
| | | string str = ""; |
| | | using (GwClientDao dao = new GwClientDao()) |
| | | { |
| | | var list = dao.LoadInfoList(out recordCount, pageIndex, pageSize, ClientID, ClientName, Telephone, Agent, Company, Salesman, ProductId); |
| | | string permissionsSQL = dao.GetClientPermissions(_userId, _userType, null); |
| | | var list = dao.LoadInfoList(out recordCount, pageIndex, pageSize, ClientID, ClientName, Telephone, Agent, Company, Salesman, ProductId, permissionsSQL); |
| | | |
| | | if (list != null && list.Count > 0) |
| | | { |
| | |
| | | //edit:yangzh by 20220511 |
| | | //str += @"<tr ><td>" + item.ClientID + "</td><td>" + item.Company + "</td><td>" + item.ClientName + "</td><td>" + item.Telephone + "</td><td>" + item.Top_up_Amount_Total + "元</td><td>" + item.Agent + "</td><td>" + Certification_StatusResult + "</td>"; |
| | | //str += @"<tr ><td>" + item.ClientID + "</td><td>" + item.Company + "</td><td>" + item.ClientName + "</td><td>" + item.Telephone + "</td><td>" + item.Balance/1000 + "元</td><td>" + item.Top_up_Amount_Total/1000 + "元</td><td>" + item.Agent + "</td><td>" + Certification_StatusResult + "</td>"; |
| | | str += @"<tr ><td>" + item.ClientID + "</td><td>" + item.Company + "</td><td>" + item.ClientName + "</td><td>" + item.Telephone + "</td><td>" + item.Balance/1000 + "元</td><td>" + item.Top_up_Amount_Total/1000 + "元</td><td>" + SysUserName(string.IsNullOrEmpty(item.Salesman)? 0: int.Parse(item.Salesman) ) + "</td><td>" + Certification_StatusResult + "</td>"; |
| | | str += @"<tr ><td rowspan='1' ><input type='checkbox' name='checkbox' value='" + item.ClientID + "'/></td><td>" + item.ClientID + "</td><td>" + item.Company + "</td><td>" + item.ClientName + "</td><td>" + item.Telephone + "</td><td>" + item.Balance/1000 + "元</td><td>" + item.Top_up_Amount_Total/1000 + "元</td><td>" + SysUserName(string.IsNullOrEmpty(item.Salesman)? 0: int.Parse(item.Salesman) ) + "</td><td>" + Certification_StatusResult + "</td>"; |
| | | |
| | | |
| | | str += @"<td>"; |
| | |
| | | } |
| | | else |
| | | { |
| | | str += @"<tr><td colspan=""9"">暂无信息</td></tr>"; |
| | | str += @"<tr><td colspan=""10"">暂无信息</td></tr>"; |
| | | } |
| | | |
| | | } |
| | |
| | | client.Company = company; |
| | | //client.Password = password; |
| | | client.Password = savePassword; |
| | | |
| | | |
| | | client.ClientName = clientName; |
| | | client.Address = address; |
| | | client.Remark = remark; |
| | | client.Telephone = telephone; |
| | | client.Agent = agent; |
| | | |
| | | |
| | | client.CustomerManager = customerManager; |
| | | client.Salesman = salesman; |
| | | client.SupportStaff = supportStaff; |
| | |
| | | return new JsonPageResult(true, "创建账户成功!"); |
| | | } |
| | | |
| | | //分配客户的个性产品 |
| | | private JsonPageResult BatchUpdateClientProduct(PageContext<SysUser> context) |
| | | { |
| | | string productId = context.GetString("productId"); |
| | | string idArray = context.GetString("idArray"); |
| | | if (string.IsNullOrEmpty(productId)) |
| | | { |
| | | |
| | | throw new ArgumentException("个性产品不能为空,请选择!"); |
| | | } |
| | | |
| | | Model.GwProduct gwProduct = new GwProductDao().Get(productId); |
| | | if (gwProduct == null) |
| | | { |
| | | throw new ArgumentException("指定的个性产品不存在,请重新选择!"); |
| | | } |
| | | string clientIds = gwProduct.ClientIds; |
| | | |
| | | List<string> tmpList = new List<string>(); |
| | | if(!string.IsNullOrEmpty(clientIds)) |
| | | { //字符串转数组,再数组合并 |
| | | tmpList.AddRange( clientIds.Split(',') ); |
| | | } |
| | | //数组合并 |
| | | tmpList.AddRange( JsonConvert.DeserializeObject<string[]>(context.GetString("idArray")) ); |
| | | |
| | | //数组去重 |
| | | string[] tmpArray = DelRepeatData(tmpList.ToArray() ); |
| | | clientIds = string.Join(",", tmpArray) ; |
| | | |
| | | if (!string.IsNullOrEmpty(clientIds)) |
| | | { |
| | | new GwProductDao().UpdateClientIds(clientIds, productId); |
| | | } |
| | | |
| | | |
| | | return new JsonPageResult(true, (object)"批量分配客户个性产品成功!"); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 移除数组中重复数据 |
| | | /// </summary> |
| | | /// <param name="array">需要除重的数组</param> |
| | | /// <returns>不重复数组</returns> |
| | | public static string[] DelRepeatData(string[] array) |
| | | { |
| | | return array.GroupBy(p => p).Select(p => p.Key).ToArray(); |
| | | } |
| | | |
| | | |
| | | |
| | | //获取管理端账户列表 |