From 597399726303f4f6f41b0a55d8dcaa153f49b97a Mon Sep 17 00:00:00 2001
From: yzh <snbbt@21cn.com>
Date: 星期四, 19 五月 2022 14:57:33 +0800
Subject: [PATCH] 账号信息增加是否自动返还 系统账号信息增加:用户类型 客户信息增加:归属客户经理、归属业务员、归属客服人员、归属财务等 客户账号查询优化 账号查询充值优化

---
 web/web/GwClient.ashx |  174 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 170 insertions(+), 4 deletions(-)

diff --git a/web/web/GwClient.ashx b/web/web/GwClient.ashx
index 151e4be..181efcc 100644
--- a/web/web/GwClient.ashx
+++ b/web/web/GwClient.ashx
@@ -15,6 +15,10 @@
 
 public class GwClientHandler : PageHandler<Model.SysUser>
 {
+
+    private UserDao _SysUserDao = new UserDao();
+    private List<SysUser> _SysUserList;
+
     public override JsonPageResult ProcessRequestInternal(PageContext<Model.SysUser> context)
     {
         string action = context.GetString("action");
@@ -66,8 +70,11 @@
     private JsonPageResult LoadGwClientPageList(PageContext<Model.SysUser> context)
     {
         string ClientID = context.GetString("ClientID");
+        string Company = context.GetString("Company");
         string ClientName = context.GetString("ClientName");
         string Telephone = context.GetString("Telephone");
+        string Salesman = context.GetString("Salesman");
+        string ProductId = context.GetString("ProductId");
         int pageIndex = context.GetInt("pageIndex", 1);
 
         string Agent = context.GetString("Agent");
@@ -78,7 +85,7 @@
         string str = "";
         using (GwClientDao dao = new GwClientDao())
         {
-            var list = dao.LoadInfoList(out recordCount, pageIndex, pageSize, ClientID, ClientName, Telephone, Agent);
+            var list = dao.LoadInfoList(out recordCount, pageIndex, pageSize, ClientID, ClientName, Telephone, Agent, Company, Salesman, ProductId);
 
             if (list != null && list.Count > 0)
             {
@@ -91,7 +98,9 @@
                     }
                     //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>" + 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 += @"<td>";
                     string loginStr = "http://" + serverIp + ":" + clientPort + "/Attachedlogin.aspx?action=Attachedlogin&account=" + item.Account + "&password=" + item.Password;
@@ -119,7 +128,7 @@
             }
             else
             {
-                str += @"<tr><td colspan=""8"">鏆傛棤淇℃伅</td></tr>";
+                str += @"<tr><td colspan=""9"">鏆傛棤淇℃伅</td></tr>";
             }
 
         }
@@ -238,6 +247,13 @@
         string telephone = context.GetString("telephone");
         string remark = context.GetString("remark");
         string agent = context.GetString("agent");
+        string salesman = context.GetString("salesman");
+        string customerManager = context.GetString("customerManager");
+        string supportStaff = context.GetString("supportStaff");
+        string financialStaff = context.GetString("financialStaff");
+        string chargeType = context.GetString("chargeType");
+        string smsStatusReport = context.GetString("smsStatusReport");
+        string mmsStatusReport = context.GetString("mmsStatusReport");
         string data = context.GetString("permissionData");
         if(data.Contains("1"))
         {
@@ -264,18 +280,74 @@
             throw new ArgumentException("鑱旂郴浜�/鑱旂郴鐢佃瘽锛屼笉鑳戒负绌猴紒");
         }
 
+        if (string.IsNullOrEmpty(customerManager))
+        {
+            throw new ArgumentException("褰掑睘瀹㈡埛缁忕悊涓嶈兘涓虹┖锛岃閫夋嫨锛�");
+        }
+
+        if (string.IsNullOrEmpty(salesman))
+        {
+            throw new ArgumentException("褰掑睘涓氬姟鍛樹笉鑳戒负绌猴紝璇烽�夋嫨锛�");
+        }
+
+        if (string.IsNullOrEmpty(supportStaff))
+        {
+            throw new ArgumentException("褰掑睘瀹㈡湇浜哄憳涓嶈兘涓虹┖锛岃閫夋嫨锛�");
+        }
+
+        if (string.IsNullOrEmpty(financialStaff))
+        {
+            throw new ArgumentException("褰掑睘璐㈠姟浜哄憳涓嶈兘涓虹┖锛岃閫夋嫨锛�");
+        }
+
+        if (string.IsNullOrEmpty(chargeType))
+        {
+            throw new ArgumentException("璁¤垂鏂瑰紡涓嶈兘涓虹┖锛岃閫夋嫨锛�");
+        }
+
+        if (string.IsNullOrEmpty(smsStatusReport))
+        {
+            throw new ArgumentException("鐭俊鏄惁鏀寔鏄剧ず鐘舵�佹姤鍛婁笉鑳戒负绌猴紝璇烽�夋嫨锛�");
+        }
+
+        if (string.IsNullOrEmpty(mmsStatusReport))
+        {
+            throw new ArgumentException("褰╀俊鏄惁鏀寔鏄剧ず鐘舵�佹姤鍛婁笉鑳戒负绌猴紝璇烽�夋嫨锛�");
+        }
+
+        string savePassword = "";
+        if (!string.IsNullOrEmpty(clientID))
+        {
+            GwClient gwClient = this._Dao.Get(clientID);
+            savePassword = (gwClient.Password == password ? gwClient.Password : DataHelper.MD5Hex(password) );
+        }
+        else
+        {
+            savePassword = DataHelper.MD5Hex(password);
+        }
+
 
         var client = new Model.GwClient();
 
         client.Id = id;
         client.ClientID = clientID;
         client.Company = company;
-        client.Password = password;
+        //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;
+        client.FinancialStaff = financialStaff;
+        client.ChargeType = string.IsNullOrEmpty(chargeType) ? 0 : int.Parse(chargeType);
+        client.SmsStatusReport = string.IsNullOrEmpty(smsStatusReport) ? 0 : int.Parse(smsStatusReport);
+        client.MmsStatusReport = string.IsNullOrEmpty(mmsStatusReport) ? 0 : int.Parse(mmsStatusReport);
         client.PermissionData = permissionData;
 
         _Dao.Update(client);
@@ -294,6 +366,13 @@
         string remark = context.GetString("remark");
         string agent = context.GetString("agent");
         string company = context.GetString("company");
+        string salesman = context.GetString("salesman");
+        string customerManager = context.GetString("customerManager");
+        string supportStaff = context.GetString("supportStaff");
+        string financialStaff = context.GetString("financialStaff");
+        string chargeType = context.GetString("chargeType");
+        string smsStatusReport = context.GetString("smsStatusReport");
+        string mmsStatusReport = context.GetString("mmsStatusReport");
         string data = context.GetString("permissionData");
         if(data.Contains("1"))
         {
@@ -315,6 +394,11 @@
             throw new ArgumentException("瀹㈡埛瀵嗙爜涓嶈兘涓虹┖锛屼笖蹇呴』涓�4-10浣嶈嫳鏂囨垨鏁板瓧瀛楃缁勫悎锛�");
         }
 
+        if (string.IsNullOrEmpty(clientName) || string.IsNullOrEmpty(telephone))
+        {
+            throw new ArgumentException("鑱旂郴浜�/鑱旂郴鐢佃瘽锛屼笉鑳戒负绌猴紒");
+        }
+
         //if (string.IsNullOrEmpty(clientName))
         //{
         //    throw new ArgumentException("瀹㈡埛鍚嶇О涓嶈兘涓虹┖锛�");
@@ -323,6 +407,41 @@
         if (_Dao.IsIDExists(clientID))
         {
             throw new ArgumentException("瀹㈡埛璐﹀彿宸茬粡瀛樺湪锛�");
+        }
+
+        if (string.IsNullOrEmpty(customerManager))
+        {
+            throw new ArgumentException("褰掑睘瀹㈡埛缁忕悊涓嶈兘涓虹┖锛岃閫夋嫨锛�");
+        }
+
+        if (string.IsNullOrEmpty(salesman))
+        {
+            throw new ArgumentException("褰掑睘涓氬姟鍛樹笉鑳戒负绌猴紝璇烽�夋嫨锛�");
+        }
+
+        if (string.IsNullOrEmpty(supportStaff))
+        {
+            throw new ArgumentException("褰掑睘瀹㈡湇浜哄憳涓嶈兘涓虹┖锛岃閫夋嫨锛�");
+        }
+
+        if (string.IsNullOrEmpty(financialStaff))
+        {
+            throw new ArgumentException("褰掑睘璐㈠姟浜哄憳涓嶈兘涓虹┖锛岃閫夋嫨锛�");
+        }
+
+        if (string.IsNullOrEmpty(chargeType))
+        {
+            throw new ArgumentException("璁¤垂鏂瑰紡涓嶈兘涓虹┖锛岃閫夋嫨锛�");
+        }
+
+        if (string.IsNullOrEmpty(smsStatusReport))
+        {
+            throw new ArgumentException("鐭俊鏄惁鏀寔鏄剧ず鐘舵�佹姤鍛婁笉鑳戒负绌猴紝璇烽�夋嫨锛�");
+        }
+
+        if (string.IsNullOrEmpty(mmsStatusReport))
+        {
+            throw new ArgumentException("褰╀俊鏄惁鏀寔鏄剧ず鐘舵�佹姤鍛婁笉鑳戒负绌猴紝璇烽�夋嫨锛�");
         }
 
         HttpFileCollection _file = HttpContext.Current.Request.Files;
@@ -362,8 +481,14 @@
                     return new JsonPageResult(false, "涓婁紶鍥剧墖澶勭悊寮傚父锛�" + ex.Message);
                 }
             }
+            else
+            {
+                throw new ArgumentException("鏂囦欢鏍煎紡閿欒锛岃纭鏄惁涓簀pg|jpeg|gif|png銆�");
+            }
         }
 
+        //瀵嗙爜鍔犲瘑
+        password = DataHelper.MD5Hex(password);
 
         var client = new Model.GwClient();
         client.ClientID = clientID;
@@ -378,6 +503,14 @@
         client.ParentId = context.OperatorID;
         client.Certification_Status = 1;
         client.Company = company;
+        client.CustomerManager = customerManager;
+        client.Salesman = salesman;
+        client.SupportStaff = supportStaff;
+        client.FinancialStaff = financialStaff;
+        client.ChargeType = string.IsNullOrEmpty(chargeType) ? 0 : int.Parse(chargeType);
+        client.SmsStatusReport = string.IsNullOrEmpty(smsStatusReport) ? 0 : int.Parse(smsStatusReport);
+        client.MmsStatusReport = string.IsNullOrEmpty(mmsStatusReport) ? 0 : int.Parse(mmsStatusReport);
+
         _Dao.Add(client);//鎻掑叆鏁版嵁搴撱�傚垱寤鸿处鎴�
 
         //淇濆瓨浜у搧璁板綍
@@ -400,6 +533,39 @@
 
         return new JsonPageResult(true, "鍒涘缓璐︽埛鎴愬姛锛�");
     }
+
+
+
+    //鑾峰彇绠$悊绔处鎴峰垪琛�
+    private List<SysUser> SysUserList
+    {
+        get
+        {
+            if (this._SysUserList == null)
+            {
+
+                using (UserDao sysUserDao = new UserDao())
+                {
+                    int recordCount = 0;
+                    int int1 = 999999999;
+                    int int2 = 1;
+                    this._SysUserList = sysUserDao.LoadInfoList(out recordCount, int1, int2);
+                }
+            }
+            return this._SysUserList;
+        }
+    }
+
+    //绠$悊绔处鎴峰悕绉�
+    private string SysUserName(int userId)
+    {
+        if (this.SysUserList == null)
+            return string.Empty;
+        SysUser sysUser = this._SysUserList.Find((Predicate<SysUser>)(bean => bean.UserID == userId));
+        if (sysUser != null)
+            return string.Format("{0}-{1}", (object)sysUser.UserID, (object)sysUser.UserName);
+        return string.Empty;
+    }
 }
 
 

--
Gitblit v1.9.1