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/Bin/Dao.dll                                      |    0 
 web/Model/Model.csproj                                   |    1 
 web/Dao/obj/Debug/Dao.csproj.CoreCompileInputs.cache     |    2 
 web/Lib/Model.pdb                                        |    0 
 web/Model/obj/Debug/Model.pdb                            |    0 
 web/web/GwClient.aspx.cs                                 |   25 ++
 web/Dao/obj/Debug/Dao.pdb                                |    0 
 web/Dao/GwClientDao.cs                                   |    9 
 web/Lib/Dao.dll                                          |    0 
 web/Dao/Dao.csproj                                       |    1 
 web/web/GwClient.ashx                                    |   78 ++++++++
 web/Dao/obj/Debug/Dao.dll                                |    0 
 web/Model/obj/Debug/Model.dll                            |    0 
 web/web/Bin/Model.pdb                                    |    0 
 web/.vs/Web/v16/.suo                                     |    0 
 web/Lib/Model.dll                                        |    0 
 web/web/GwClient.aspx                                    |  147 +++++++++++++++
 web/Dao/GwProductDao.cs                                  |   18 ++
 web/web/Bin/Model.dll                                    |    0 
 web/Dao/GwClientProductDao.cs                            |  196 +++++++++++++++++++++
 web/Lib/Dao.pdb                                          |    0 
 web/web/Bin/Dao.pdb                                      |    0 
 web/Model/Model/GwClientProduct.cs                       |   51 +++++
 web/Model/obj/Debug/Model.csproj.CoreCompileInputs.cache |    2 
 24 files changed, 521 insertions(+), 9 deletions(-)

diff --git a/web/.vs/Web/v16/.suo b/web/.vs/Web/v16/.suo
index 6c8b9b9..e2b4b50 100644
--- a/web/.vs/Web/v16/.suo
+++ b/web/.vs/Web/v16/.suo
Binary files differ
diff --git a/web/Dao/Dao.csproj b/web/Dao/Dao.csproj
index c2a5002..1ee91f7 100644
--- a/web/Dao/Dao.csproj
+++ b/web/Dao/Dao.csproj
@@ -75,6 +75,7 @@
     <Compile Include="GwClientCertificationDao.cs" />
     <Compile Include="GwClientPayLogDao.cs" />
     <Compile Include="GwClientPayMentDao.cs" />
+    <Compile Include="GwClientProductDao.cs" />
     <Compile Include="GwMobileAreaDao.cs" />
     <Compile Include="GwMoRouteDao.cs" />
     <Compile Include="GwProductDao.cs" />
diff --git a/web/Dao/GwClientDao.cs b/web/Dao/GwClientDao.cs
index 1d595b4..e3f102f 100644
--- a/web/Dao/GwClientDao.cs
+++ b/web/Dao/GwClientDao.cs
@@ -24,7 +24,7 @@
         /// <param name="telphone">鑱旂郴鐢佃瘽</param>
         /// <param name="agent">涓氬姟鍛�</param>
         /// <returns></returns>
-        public List<GwClient> LoadInfoList(out int recordCount, int pageIndex, int pageSizestring, string clientID, string clientName, string telphone, string agent)
+        public List<GwClient> LoadInfoList(out int recordCount, int pageIndex, int pageSizestring, string clientID, string company, string clientName, string telphone, string agent)
         {
 
             List<GwClient> list = new List<GwClient>();
@@ -39,6 +39,12 @@
                     oracleParameterArray[0] = new OracleParameter(":ClientID", (OracleDbType)126);
                     ((DbParameter)oracleParameterArray[0]).Value = (object)('%' + clientID + '%');
                     stringBuilder.Append(" and CLIENT_ID like :ClientID");
+                }
+                if (company != null && company != "")
+                {
+                    oracleParameterArray[1] = new OracleParameter(":Company", (OracleDbType)126);
+                    ((DbParameter)oracleParameterArray[1]).Value = (object)('%' + company + '%');
+                    stringBuilder.Append(" and Company like :Company");
                 }
                 if (clientName != null && clientName != "")
                 {
@@ -331,6 +337,7 @@
             }
             return true;
         }
+
     }
 }
 
diff --git a/web/Dao/GwClientProductDao.cs b/web/Dao/GwClientProductDao.cs
new file mode 100644
index 0000000..76664d7
--- /dev/null
+++ b/web/Dao/GwClientProductDao.cs
@@ -0,0 +1,196 @@
+锘�// Decompiled with JetBrains decompiler
+// Type: Dao.GwStatisV3Dao
+// Assembly: Dao, Version=3.2.1.428, Culture=neutral, PublicKeyToken=c1a16487c920c3dc
+// MVID: 22E6EB3F-6D25-4B57-BE09-AD2F5391CFA5
+// Assembly location: C:\Users\Administrator\Desktop\wwww\bin\Dao.dll
+
+using Common;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
+using Oracle.DataAccess.Client;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Data.Common;
+using Model;
+
+namespace Dao
+{
+  public class GwClientProductDao : IDisposable
+  {
+
+    /**
+     * 鏍规嵁瀹㈡埛ID鑾峰彇瀹㈡埛浜у搧鍒楄〃
+     */
+    public List<GwClientProduct> getClientProduct(string clientID)
+    {
+            string sql = "";
+            sql += "select aa.*, c.balance, (c.basic_num + c.giving_num ) available_num from "
+                + "( "
+                + " select a.id client_product_id, a.client_id, a.sp_id, a.activate_status, "
+                + " b.id product_id, b.name, b.icon, b.instructions, b.classes, b.parent_id, "
+                + " b.path, b.is_default, b.is_enable, b.sort, b.giving_num, b.remark, b.api_sp_xh_id "
+                + " from gw_client_product a, gw_product b "
+                + " where a.product_id = b.id "
+                + " ) aa "
+                + " left join gw_sp c "
+                + " on aa.sp_id = c.sp_id and aa.client_id = :clientId "  //鍙傛暟锛氬鎴稩D
+                + " order by sort ";
+
+            //return OracleHelper.Execute(sql, OracleHelper.Connection, new OracleParameter(":clientId", (object)clientID));
+
+
+            List<GwClientProduct> list = new List<GwClientProduct>();
+            using (OracleDataReader reader = OracleHelper.ExecuteReader(sql, OracleHelper.Connection, new OracleParameter(":clientId", (object)clientID)))
+            {
+                while (reader != null && ((DbDataReader)reader).Read())
+                {
+                    GwClientProduct gwClientProduct = new GwClientProduct();
+                    OracleReaderWrapper oracleReaderWrapper = new OracleReaderWrapper(reader);
+
+                    gwClientProduct.client_product_id = oracleReaderWrapper.GetString("client_product_id", "");
+                    gwClientProduct.client_id = oracleReaderWrapper.GetString("client_id", "");
+                    gwClientProduct.sp_id = oracleReaderWrapper.GetString("sp_id", "");
+                    gwClientProduct.activate_status = oracleReaderWrapper.GetInt("activate_status", 0);
+                    gwClientProduct.product_id = oracleReaderWrapper.GetString("product_id", "");
+                    gwClientProduct.product_name = oracleReaderWrapper.GetString("name", "");
+                    gwClientProduct.icon = oracleReaderWrapper.GetString("icon", "");
+                    gwClientProduct.instructions = oracleReaderWrapper.GetString("instructions", "");
+                    gwClientProduct.classes = oracleReaderWrapper.GetInt("classes", 0);
+                    gwClientProduct.parent_id = oracleReaderWrapper.GetString("parent_id", "");
+                    gwClientProduct.path = oracleReaderWrapper.GetString("path", "");
+                    gwClientProduct.is_default = oracleReaderWrapper.GetInt("is_default", 0);
+                    gwClientProduct.is_enable = oracleReaderWrapper.GetInt("is_enable", 0);
+                    gwClientProduct.sort = oracleReaderWrapper.GetInt("sort", 0);
+                    gwClientProduct.balance = oracleReaderWrapper.GetInt("balance", 0);
+                    gwClientProduct.giving_num = oracleReaderWrapper.GetInt("giving_num", 0);
+                    gwClientProduct.available_num = oracleReaderWrapper.GetInt("available_num", 0);
+                    gwClientProduct.remark = oracleReaderWrapper.GetString("remark", "");
+                    gwClientProduct.api_sp_xh_id = oracleReaderWrapper.GetString("api_sp_xh_id", "");
+                    list.Add(gwClientProduct);
+                }
+            }
+            return list;
+            
+        }
+
+        public bool Add(GwClientProduct o)
+        {
+            return OracleHelper.ExecuteSql("INSERT INTO GW_CLIENT_PRODUCT(ID, CLIENT_ID, SP_ID, PRODUCT_ID, ACTIVATE_STATUS) VALUES(:ID,:CLIENT_ID,:SP_ID,:PRODUCT_ID,:ACTIVATE_STATUS)", OracleHelper.Connection, 
+                new OracleParameter(":ID", (object)o.client_product_id), 
+                new OracleParameter(":CLIENT_ID", (object)o.client_id),
+                new OracleParameter(":SP_ID", (object)o.sp_id), 
+                new OracleParameter(":PRODUCT_ID", (object)o.product_id), 
+                new OracleParameter(":ACTIVATE_STATUS", (object)o.activate_status)
+                ) > 0;
+        }
+
+        public bool update(GwClientProduct o)
+        {
+            string sql = "";
+            sql += " update gw_client_product set CLIENT_ID=:CLIENT_ID, SP_ID=:SP_ID, PRODUCT_ID=:PRODUCT_ID,ACTIVATE_STATUS=:ACTIVATE_STATUS ";
+            sql += " where ID=:ID ";
+
+            return OracleHelper.ExecuteSql(sql, OracleHelper.Connection,
+                new OracleParameter(":CLIENT_ID", (object)o.client_id),
+                new OracleParameter(":SP_ID", (object)o.sp_id),
+                new OracleParameter(":PRODUCT_ID", (object)o.product_id),
+                new OracleParameter(":ACTIVATE_STATUS", (object)o.activate_status),
+                new OracleParameter(":ID", (object)o.client_product_id)
+                ) > 0;
+        }
+
+
+        /**
+         * 鏍规嵁瀹㈡埛ID鑾峰彇瀹㈡埛浜у搧鍒楄〃
+         */
+        public GwClientProduct find(GwClientProduct o)
+        {
+            string sql = "";
+            //sql += "select * from Gw_Client_Product a where a.id = :client_product_id ";
+            sql += " select a.id client_product_id, a.client_id, a.sp_id, a.activate_status ";
+            sql += " , b.id product_id, b.name product_name, b.icon ,b.instructions, b.classes, b.parent_id ";
+            sql += " , b.path, b.is_default, b.is_enable, b.sort, b.giving_num, b.remark, b.api_sp_xh_id ";
+            sql += " from gw_client_product a ";
+            sql += " left join gw_product b ";
+            sql += " on a.product_id = b.id ";
+            sql += " where b.is_enable = :is_enable and a.id = :client_product_id ";
+
+            //return OracleHelper.Execute(sql, OracleHelper.Connection, new OracleParameter(":clientId", (object)clientID));
+
+
+            GwClientProduct gwClientProduct = new GwClientProduct();
+            using (OracleDataReader reader = OracleHelper.ExecuteReader(sql, OracleHelper.Connection,
+                new OracleParameter(":is_enable", (object)o.is_enable),
+                new OracleParameter(":client_product_id", (object)o.client_product_id)
+                ))
+            {
+                if (((DbDataReader)reader).Read())
+                {
+                    this.ReadInfo(reader, gwClientProduct);
+                    return gwClientProduct;
+                }
+            }
+
+            return gwClientProduct;
+
+        }
+
+    //鏁版嵁杞崲灏佽
+    private bool ReadInfo(OracleDataReader reader, GwClientProduct gwClientProduct)
+    {
+        OracleReaderWrapper oracleReaderWrapper = new OracleReaderWrapper(reader);
+
+        gwClientProduct.client_product_id = oracleReaderWrapper.GetString("client_product_id", "");
+        gwClientProduct.client_id = oracleReaderWrapper.GetString("client_id", "");
+        gwClientProduct.sp_id = oracleReaderWrapper.GetString("sp_id", "");
+        gwClientProduct.activate_status = oracleReaderWrapper.GetInt("activate_status", 0);
+        gwClientProduct.product_id = oracleReaderWrapper.GetString("product_id", "");
+        gwClientProduct.product_name = oracleReaderWrapper.GetString("name", "");
+        gwClientProduct.icon = oracleReaderWrapper.GetString("icon", "");
+        gwClientProduct.instructions = oracleReaderWrapper.GetString("instructions", "");
+        gwClientProduct.classes = oracleReaderWrapper.GetInt("classes", 0);
+        gwClientProduct.parent_id = oracleReaderWrapper.GetString("parent_id", "");
+        gwClientProduct.path = oracleReaderWrapper.GetString("path", "");
+        gwClientProduct.is_default = oracleReaderWrapper.GetInt("is_default", 0);
+        gwClientProduct.is_enable = oracleReaderWrapper.GetInt("is_enable", 0);
+        gwClientProduct.sort = oracleReaderWrapper.GetInt("sort", 0);
+        gwClientProduct.giving_num = oracleReaderWrapper.GetInt("giving_num", 0);
+        gwClientProduct.remark = oracleReaderWrapper.GetString("remark", "");
+        gwClientProduct.api_sp_xh_id = oracleReaderWrapper.GetString("api_sp_xh_id", "");
+
+            return true;
+    }
+
+    public void Dispose()
+    {
+    }
+
+    public DataTable GetClientCount(string clientID)
+    {
+      return OracleHelper.Execute("select * from gw_client_product a where a.client_id = :clientId", OracleHelper.Connection, new OracleParameter(":clientId", (object) clientID) );
+    }
+
+
+
+        /// <summary>
+        /// 妫�鏌ヨ处鎴蜂骇鍝佹槸鍚﹀瓨鍦�
+        /// </summary>
+        /// <param name="clientID">璐︽埛</param>
+        /// <returns></returns>
+        public bool IsClientProductExists(string clientID, string productId)
+        {
+            if (string.IsNullOrEmpty(clientID) || string.Equals("0", clientID))
+                return true;
+            if (string.IsNullOrEmpty(productId) || string.Equals("0", productId))
+                return true;
+            using (OracleDataReader oracleDataReader = OracleHelper.ExecuteReader(string.Format("select * from GW_CLIENT_PRODUCT where CLIENT_ID=:CLIENT_ID AND PRODUCT_ID=:PRODUCT_ID"), OracleHelper.Connection, new OracleParameter(":CLIENT_ID", (object)clientID), new OracleParameter(":PRODUCT_ID", (object)productId)))
+            {
+                if (((DbDataReader)oracleDataReader).Read())
+                    return true;
+            }
+            return false;
+        }
+    }
+
+}
diff --git a/web/Dao/GwProductDao.cs b/web/Dao/GwProductDao.cs
index c9be952..f8d54af 100644
--- a/web/Dao/GwProductDao.cs
+++ b/web/Dao/GwProductDao.cs
@@ -118,6 +118,24 @@
         }
 
         /**
+         * 鑾峰彇浜у搧鍒楄〃
+         * */
+        public List<GwProduct> getGwProductList()
+        {
+            List<GwProduct> list = new List<GwProduct>();
+            using (OracleDataReader reader = OracleHelper.ExecuteReader(string.Format("select * from GW_PRODUCT where IS_ENABLE = 1 AND CLASSES=1 "), OracleHelper.Connection))
+            {
+                while (reader != null && ((DbDataReader)reader).Read())
+                {
+                    GwProduct o = new GwProduct();
+                    if (this.ReadInfo(reader, o))
+                        list.Add(o);
+                }
+            }
+            return list;
+        }
+
+        /**
          * 鏍规嵁浜у搧ID鑾峰彇浜у搧淇℃伅
          * */
         public GwProduct find(string productId)
diff --git a/web/Dao/obj/Debug/Dao.csproj.CoreCompileInputs.cache b/web/Dao/obj/Debug/Dao.csproj.CoreCompileInputs.cache
index f946d8f..3d7058c 100644
--- a/web/Dao/obj/Debug/Dao.csproj.CoreCompileInputs.cache
+++ b/web/Dao/obj/Debug/Dao.csproj.CoreCompileInputs.cache
@@ -1 +1 @@
-99191e045427b8c77772d20e0f9eacbeab5c5bd3
+2f4ee5a304a64e1617ed59777b36c0169fa3e828
diff --git a/web/Dao/obj/Debug/Dao.dll b/web/Dao/obj/Debug/Dao.dll
index 53f3357..c16384d 100644
--- a/web/Dao/obj/Debug/Dao.dll
+++ b/web/Dao/obj/Debug/Dao.dll
Binary files differ
diff --git a/web/Dao/obj/Debug/Dao.pdb b/web/Dao/obj/Debug/Dao.pdb
index a2a75ce..ba1e31b 100644
--- a/web/Dao/obj/Debug/Dao.pdb
+++ b/web/Dao/obj/Debug/Dao.pdb
Binary files differ
diff --git a/web/Lib/Dao.dll b/web/Lib/Dao.dll
index 53f3357..c16384d 100644
--- a/web/Lib/Dao.dll
+++ b/web/Lib/Dao.dll
Binary files differ
diff --git a/web/Lib/Dao.pdb b/web/Lib/Dao.pdb
index a2a75ce..ba1e31b 100644
--- a/web/Lib/Dao.pdb
+++ b/web/Lib/Dao.pdb
Binary files differ
diff --git a/web/Lib/Model.dll b/web/Lib/Model.dll
index 6a96b73..927ad5b 100644
--- a/web/Lib/Model.dll
+++ b/web/Lib/Model.dll
Binary files differ
diff --git a/web/Lib/Model.pdb b/web/Lib/Model.pdb
index 0567d8b..532bd0c 100644
--- a/web/Lib/Model.pdb
+++ b/web/Lib/Model.pdb
Binary files differ
diff --git a/web/Model/Model.csproj b/web/Model/Model.csproj
index 0263a6d..33dbb38 100644
--- a/web/Model/Model.csproj
+++ b/web/Model/Model.csproj
@@ -64,6 +64,7 @@
     <Compile Include="Model\GwClientCertification.cs" />
     <Compile Include="Model\GwClientPayLog.cs" />
     <Compile Include="Model\GwClientPayMent.cs" />
+    <Compile Include="Model\GwClientProduct.cs" />
     <Compile Include="Model\GwMobileArea.cs" />
     <Compile Include="Model\GwMoRoute.cs" />
     <Compile Include="Model\GwOpGroupItem.cs" />
diff --git a/web/Model/Model/GwClientProduct.cs b/web/Model/Model/GwClientProduct.cs
new file mode 100644
index 0000000..0f9d6eb
--- /dev/null
+++ b/web/Model/Model/GwClientProduct.cs
@@ -0,0 +1,51 @@
+锘� 
+
+namespace Model
+{
+
+    /**
+     * 璐︽埛浜у搧淇℃伅
+     */
+  public class GwClientProduct
+  {
+        //public int id { get; set; } //璐︽埛浜у搧琛↖D
+
+        public string client_product_id { get; set; }  //璐︽埛浜у搧ID
+
+        public string client_id { get; set; }  //璐︽埛ID
+
+        public string sp_id { get; set; }  //API璐﹀彿ID
+
+        public int activate_status { get; set; }    //婵�娲荤姸鎬�
+
+        public string product_id { get; set; }    //浜у搧ID
+
+        public string product_name { get; set; }    //浜у搧鍚嶇О
+
+        public string icon { get; set; }    //浜у搧鍥炬爣
+
+        public string instructions { get; set; }    //浣跨敤璇存槑
+
+        public int classes { get; set; }    //绫诲埆
+
+        public string parent_id { get; set; }
+
+        public string path { get; set; }    //浜у搧鍒嗙被璺緞
+
+        public int is_default { get; set; } //鏄惁榛樿
+
+        public int is_enable { get; set; }  //鏄惁鍚敤
+
+        public int sort { get; set; }   //鍦ㄨ处鎴蜂俊鎭樉绀洪『搴忥紝鍊艰秺灏忚秺鎺掑墠
+
+        public int giving_num { get; set; } //榛樿璧犻�佹潯鏁�
+
+        public string remark { get; set; }  //澶囨敞
+
+        public int balance { get; set; } //浣欓
+
+        public int available_num { get; set; }   //鍙敤鏉℃暟锛屽熀鏈暟 + 璧犻�佹暟
+
+        public string api_sp_xh_id { get; set; }  //API璐﹀彿鐢熸垚瑙勫垯
+    }
+}
diff --git a/web/Model/obj/Debug/Model.csproj.CoreCompileInputs.cache b/web/Model/obj/Debug/Model.csproj.CoreCompileInputs.cache
index 9a211ce..43635fb 100644
--- a/web/Model/obj/Debug/Model.csproj.CoreCompileInputs.cache
+++ b/web/Model/obj/Debug/Model.csproj.CoreCompileInputs.cache
@@ -1 +1 @@
-386caef0a68152082007ea9053d4fd5b4b62f129
+00bfb7d603acc6cb6309f95b0c5c17d4ff8f2b67
diff --git a/web/Model/obj/Debug/Model.dll b/web/Model/obj/Debug/Model.dll
index 6a96b73..927ad5b 100644
--- a/web/Model/obj/Debug/Model.dll
+++ b/web/Model/obj/Debug/Model.dll
Binary files differ
diff --git a/web/Model/obj/Debug/Model.pdb b/web/Model/obj/Debug/Model.pdb
index 0567d8b..532bd0c 100644
--- a/web/Model/obj/Debug/Model.pdb
+++ b/web/Model/obj/Debug/Model.pdb
Binary files differ
diff --git a/web/web/Bin/Dao.dll b/web/web/Bin/Dao.dll
index 53f3357..c16384d 100644
--- a/web/web/Bin/Dao.dll
+++ b/web/web/Bin/Dao.dll
Binary files differ
diff --git a/web/web/Bin/Dao.pdb b/web/web/Bin/Dao.pdb
index a2a75ce..ba1e31b 100644
--- a/web/web/Bin/Dao.pdb
+++ b/web/web/Bin/Dao.pdb
Binary files differ
diff --git a/web/web/Bin/Model.dll b/web/web/Bin/Model.dll
index 6a96b73..927ad5b 100644
--- a/web/web/Bin/Model.dll
+++ b/web/web/Bin/Model.dll
Binary files differ
diff --git a/web/web/Bin/Model.pdb b/web/web/Bin/Model.pdb
index 0567d8b..532bd0c 100644
--- a/web/web/Bin/Model.pdb
+++ b/web/web/Bin/Model.pdb
Binary files differ
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
diff --git a/web/web/GwClient.aspx b/web/web/GwClient.aspx
index 05a73a2..2a28525 100644
--- a/web/web/GwClient.aspx
+++ b/web/web/GwClient.aspx
@@ -14,14 +14,15 @@
             });
 
             function loadPageList() {
-                var ClientID = $("#ClientID").val();
+                var ClientID = $("#ClientID").val(); 
+                var Company = $("#Company").val();
                 var ClientName = $("#ClientName").val();
                 var Telephone = $("#Telephone").val();
                 var Agent = $("#Agent").val();
                 $.ajax({
                     url: "GwClient.ashx",
                     type: "POST",
-                    data: { action: "loadGwClientPageList", ClientID: ClientID, ClientName: ClientName, Telephone: Telephone, Agent: Agent, pageSize: $("#pager").Pager("getPageSize"), pageIndex: $("#pager").Pager("getPageIndex") },
+                    data: { action: "loadGwClientPageList", ClientID: ClientID, Company: Company, ClientName: ClientName, Telephone: Telephone, Agent: Agent, pageSize: $("#pager").Pager("getPageSize"), pageIndex: $("#pager").Pager("getPageIndex") },
                     success: function(result) {
                         if (result.OK) {
                             $("#gwclientTable tbody").html(result.Message.Table);
@@ -32,6 +33,67 @@
                     }
                 });
             }
+
+            //寰呮帹閫佽处鎴蜂骇鍝�-鏄剧ず璐︽埛鍒楄〃
+            function loadClientList() {
+                $.ajax({
+                    url: "GwClient.ashx",
+                    type: "POST",
+                    data: { action: "loadGwClientAllPageList", pageSize: $("#clientProductPager").Pager("getPageSize"), pageIndex: $("#clientProductPager").Pager("getPageIndex") },
+                    success: function (result) {
+                        if (result.OK) {
+                            $("#gwclientProductTable tbody").html(result.Message.Table);
+                            $("#clientProductPager").Pager("setTotalCount", result.Message.TotalCount);
+                        } else {
+                            mytek.alert(result.Message, result.OK);
+                        }
+                    }
+                });
+                $("#clientProductDialog .modal-title").text("鎺ㄩ�佽处鎴蜂骇鍝�");
+                $("#clientProductDialog input[name=action]").val("loadGwClientAllPageList");
+                $("#clientProductDialog").modal("show");
+            }
+
+            //鍏ㄩ��
+            $("#checkAll").click(function () {
+                $("input[name='checkbox']").prop("checked", $(this).is(":checked"));
+            });
+
+            //淇濆瓨寰呮帹閫佺殑璐︽埛
+            $(document).on("click", ".action-client-save", function () {
+                var idArray = [];
+
+                $("input[name='checkbox']:checkbox:checked").each(function () {
+                    var id = $(this).val();
+                    idArray.push(id);
+                });
+
+                if (idArray.length == 0) {
+                    mytek.alert("璇烽�夋嫨瑕佸垎閰嶇殑璐︽埛锛�", false);
+                    return false;
+                }
+
+                var product_id = $("#product_id").val();
+                if (product_id == "") {
+                    mytek.alert("璇烽�夋嫨瑕佸垎閰嶇殑浜у搧锛�", false);
+                    return false;
+                }
+
+                $.ajax({
+                    url: "GwClient.ashx",
+                    type: "POST",
+                    data: { action: "saveClientProduct", idArray: $.toJSON(idArray), product_id: product_id },
+                    success: function (result) {
+                        if (r.OK) {
+                            $("#clientProductDialog").modal("show");
+                        }
+                        else {
+                            mytek.alert(r.Message, r.OK);
+                        }
+                    }
+                });
+
+            });
 
             function randomString(len) {
                 len = len || 32;
@@ -57,6 +119,11 @@
                     $("#clientDialog input").attr("readonly", false);
                     $("#clientDialog input[name=action]").val("save");
                     $("#clientDialog").modal("show");
+                });
+
+                //鎺ㄩ�佽处鎴蜂骇鍝�
+                $(document).on("click", ".action-modal-client-product", function () {
+                    loadClientList();
                 });
 
                 $(document).on("click", ".action-generate-password", function() {
@@ -333,6 +400,77 @@
             </div>
         </div>
         </form>
+    </div>    
+
+    <!--鎺ㄩ�佽处鎴蜂骇鍝侀潰鏉� -->
+    <div class="modal inmodal fade" id="clientProductDialog" tabindex="-1" role="dialog" aria-hidden="true">
+        <form name="clientProductForm" method="post" action="gwclient.ashx" id="clientProductForm" class="form-horizontal">
+        <div class="modal-dialog modal-lg">
+            <div class="modal-content ">
+                <input name="action" value="client-product" type="hidden" />
+                <div class="modal-header">
+                    <button type="button" class="close" data-dismiss="modal">
+                        <span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
+                    <h4 class="modal-title">
+                        鎺ㄩ�佽处鎴蜂骇鍝�
+                    </h4>
+                </div>
+                <div class="form-group">
+                    <label class="col-sm-4 control-label">
+                        閫夋嫨浜у搧</label>
+                    <div class="col-sm-6  input-group">
+                        <select class="form-control" name="product_id" id="product_id">
+                            <%=GetGwProductOptionsAll() %>
+                        </select>
+                    </div>
+                </div>
+                
+                <div class="table-responsive">
+                    <table class="table table-striped table-bordered table-hover" id="gwclientProductTable">
+                        <thead>
+                            <tr class="header">
+                                <th>
+                                    <input type='checkbox' name='checkAll' id='checkAll' />
+                                </th>
+                                <th>
+                                    瀹㈡埛璐﹀彿
+                                </th>
+                                <th>鍏徃鍚嶇О</th>
+                                <th>
+                                    鑱旂郴浜�
+                                </th>
+                                <th>
+                                    鑱旂郴鐢佃瘽
+                                </th>
+                                <th>
+                                    绱鍏呭��
+                                </th>
+
+                                <th>
+                                    涓氬姟鍛�
+                                </th>
+                                <th>
+                                    璁よ瘉鐘舵��
+                                </th>
+                            </tr>
+                        </thead>
+                        <tbody>
+                        </tbody>
+       
+                    </table>
+                </div>
+                <div id="clientProductPager">
+                </div>
+
+                <div class="modal-footer">
+                    <button class="btn btn-warning" data-dismiss="modal" aria-hidden="true">
+                        鍙栨秷</button>&nbsp;&nbsp;
+                    <button class="btn btn-primary action-client-save">
+                        纭畾鎺ㄩ��</button>
+                </div>
+            </div>
+        </div>
+        </form>
     </div>
 
     <form name="queryForm" method="post" id="queryForm" class="form-inline">
@@ -368,8 +506,9 @@
     </div>
     <div class="form-group">
         <div class="input-group m-b">
-            <input type="button" value="鏌ヨ" class="btn btn-primary action-query" />&nbsp
-            <input class="btn btn-success action-modal-create" value="鍒涘缓瀹㈡埛" type="button" />
+            <input type="button" value="鏌ヨ" class="btn btn-primary action-query" />&nbsp;&nbsp;
+            <input class="btn btn-success action-modal-create" value="鍒涘缓瀹㈡埛" type="button" />&nbsp;&nbsp;
+            <input class="btn btn-success action-modal-client-product" value="鎺ㄩ�佽处鎴蜂骇鍝�" type="button" />
         </div>
         
     </div>
diff --git a/web/web/GwClient.aspx.cs b/web/web/GwClient.aspx.cs
index 0cb9c4f..54ed256 100644
--- a/web/web/GwClient.aspx.cs
+++ b/web/web/GwClient.aspx.cs
@@ -5,12 +5,35 @@
 using System.Web;
 using System.Web.Profile;
 using System.Web.SessionState;
+using Dao;
+using System.Text;
+using System.Collections.Generic;
 
 public partial class _GwClient : PageBase<SysUser>, IRequiresSessionState
-{ 
+{
+    protected List<GwProduct> getGwProductList;    //浜у搧鍒嗙被
+
     protected void Page_Load(object sender, EventArgs e)
     {
         //鏉冮檺鏍¢獙
         this.CheckRight("301", FailedOperation.ErrorMsgOnly);
+        //鑾峰彇浜у搧
+        using (GwProductDao gwProductDao = new GwProductDao())
+            this.getGwProductList = gwProductDao.getGwProductList();
+    }
+
+
+    //浜у搧鍒嗙被涓嬫媺妗嗘暟鎹�
+    public string GetGwProductOptionsAll()
+    {
+        StringBuilder stringBuilder = new StringBuilder();
+        if (this.getGwProductList.Count == 0)
+            return "<option value=''>鏃犱骇鍝佷俊鎭�</option>";
+        stringBuilder.AppendFormat("<option value=\"{0}\" >{1}</option>", "", "--璇烽�夋嫨浜у搧--");
+        foreach (GwProduct gwProduct in this.getGwProductList)
+        {
+            stringBuilder.AppendFormat("<option value=\"{0}\" >{0}-{1}-{2}</option>", gwProduct.id, gwProduct.name, gwProduct.is_default==0 ? "鍚�":"榛樿");
+        }
+        return stringBuilder.ToString();
     }
 }

--
Gitblit v1.9.1