From 6c4ea53f92500f49959013c36b5c67fed25cd791 Mon Sep 17 00:00:00 2001
From: yzh <snbbt@21cn.com>
Date: 星期一, 11 十月 2021 19:00:15 +0800
Subject: [PATCH] 产品分配账户

---
 web/web/GwClient.ashx |   78 ++++++++++++++++++++++++++++++++++++++
 1 files changed, 77 insertions(+), 1 deletions(-)

diff --git a/web/web/GwClient.ashx b/web/web/GwClient.ashx
index 40e0def..b484b32 100644
--- a/web/web/GwClient.ashx
+++ b/web/web/GwClient.ashx
@@ -8,6 +8,7 @@
 using System.Text;
 using System.Text.RegularExpressions;
 using System.IO;
+using Newtonsoft.Json;
 
 
 
@@ -25,6 +26,12 @@
 
             case "loadGwClientPageList":
                 return LoadGwClientPageList(context);
+            //寰呮帹閫佽处鎴锋煡璇㈠垪琛�
+            case "loadGwClientAllPageList":
+                return LoadGwClientAllPageList(context);
+            //纭畾鎺ㄩ��
+            case "saveClientProduct":
+                return SaveClientProduct(context);
             case "save":
                 return Save(context);
 
@@ -54,6 +61,8 @@
         }
     }
     private Dao.GwClientDao _Dao = new Dao.GwClientDao();
+    private Dao.GwClientProductDao gwClientProductDao = new Dao.GwClientProductDao();
+    private Dao.SysXhDao sysXhDao = new Dao.SysXhDao();
     private GwSpDao _GwSpDao = new GwSpDao();
 
 
@@ -65,6 +74,7 @@
     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");
         int pageIndex = context.GetInt("pageIndex", 1);
@@ -77,7 +87,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, Company, ClientName, Telephone, Agent);
 
             if (list != null && list.Count > 0)
             {
@@ -123,7 +133,73 @@
         return new JsonPageResult(true, new { Table = str.ToString(), TotalCount = recordCount });
     }
 
+        
+    /// <summary>
+    /// 鍔犺浇寰呮帹閫佷骇鍝佺殑浠g悊鍟嗚处鍙峰垪琛�
+    /// </summary>
+    /// <param name="context"></param>
+    /// <returns></returns>
+    private JsonPageResult LoadGwClientAllPageList(PageContext<Model.SysUser> context)
+    {
+        int pageIndex = context.GetInt("pageIndex", 1);
+        int recordCount = 0;
+        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, null, null, null, null, null);
 
+            if (list != null && list.Count > 0)
+            {
+                foreach (Model.GwClient item in list)
+                {
+                    string Certification_StatusResult = "鏈璇�";
+                    if (item.Certification_Status == 1)
+                    { 
+                            Certification_StatusResult = "宸茶璇�";
+                     }
+                    str += "<tr><td  rowspan=\"1\" ><input type=\"checkbox\"name=\"checkbox\" value=\"" + item.ClientID + "\"/></td>" ;
+                    str += @"<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>";
+                }
+            }
+            else
+            {
+                str += @"<tr><td colspan=""8"">鏆傛棤淇℃伅</td></tr>";
+            }
+
+        }
+        return new JsonPageResult(true, new { Table = str.ToString(), TotalCount = recordCount });
+    }
+
+    //纭畾鎺ㄩ��
+    private JsonPageResult SaveClientProduct(PageContext<Model.SysUser> context)
+    {
+        string product_id = context.GetString("product_id");
+        if (string.IsNullOrEmpty(product_id))
+            throw new ArgumentException("璇烽�夋嫨瑕佸垎閰嶇殑浜у搧锛�");
+
+        foreach (string clientId in JsonConvert.DeserializeObject<string[]>(context.GetString("idArray"))) { 
+                if(gwClientProductDao.IsClientProductExists(clientId, product_id))
+            {
+                    continue;
+            }else {
+                Model.GwClientProduct gwClientProduct = new Model.GwClientProduct();
+                string client_product_id = sysXhDao.getXh("GW_CLIENT_PRODUCT");
+                gwClientProduct.client_product_id = client_product_id;
+                gwClientProduct.client_id = clientId;
+                gwClientProduct.product_id = product_id;
+                gwClientProduct.activate_status = 0;
+
+                //淇濆瓨浜у搧鍒嗛厤缁欒处鎴�
+                this.gwClientProductDao.Add(gwClientProduct);
+             }
+        }
+        return new JsonPageResult(true, (object)"纭畾鍒嗛厤璐︽埛浜у搧鎴愬姛锛�");
+    }
 
 
     //add 2017-10-21

--
Gitblit v1.9.1