From 2f74eb23c0d2d4a246bc612c5c34bdfa8dea5603 Mon Sep 17 00:00:00 2001
From: wzp <2040239371@qq.com>
Date: 星期五, 11 十一月 2022 09:25:02 +0800
Subject: [PATCH] 修改账号产品关联的bug 修改产品不显示的bug

---
 web/web/GwClient.aspx.cs |   80 +++++++++++++++++++++++++++++++++++----
 1 files changed, 71 insertions(+), 9 deletions(-)

diff --git a/web/web/GwClient.aspx.cs b/web/web/GwClient.aspx.cs
index b8a666f..11ff8cb 100644
--- a/web/web/GwClient.aspx.cs
+++ b/web/web/GwClient.aspx.cs
@@ -9,12 +9,13 @@
 using System.Collections.Generic;
 using System.Text;
 using System.Configuration;
+using System.Linq;
 
 public partial class _GwClient : PageBase<SysUser>, IRequiresSessionState
 {
 
     protected List<SysUser> SysUserList;
-    protected List<GwProduct> GwProductList;
+    protected List<GwProduct> GwProductList;    
 
     string addressClasses = ConfigurationManager.AppSettings["addressClasses"];
 
@@ -44,6 +45,13 @@
             this.GwProductList = gwProductDao.getAllList(bean);
         }
     }
+    public int IsEnable
+    {
+        get
+        {
+            return this.AppContext.GetInt("IsEnable");
+        }
+    }
 
 
     //褰掑睘涓氬姟鍛�
@@ -60,8 +68,8 @@
             {
                 continue;
             }
-            //杩囨护鐢ㄦ埛绫诲瀷 1-绠$悊鍛�;2-涓氬姟鍛�--鍏ㄥ憳;3-涓氬姟涓荤;4-涓氬姟鎬荤洃;5-瀹㈡湇浜哄憳;6-璐㈠姟浜哄憳;99-鍏朵粬
-            if (bean.UserType == 6 || bean.UserType == 99)
+            //杩囨护鐢ㄦ埛绫诲瀷 1-绠$悊鍛�;2-涓氬姟鍛�--鍏ㄥ憳;3-瀹㈡埛缁忕悊;4-瀹㈡湇浜哄憳;5-璐㈠姟浜哄憳
+            if (!checkStrForArrayStr(1, bean.UserType) && !checkStrForArrayStr(2, bean.UserType) )
             {
                 continue;
             }
@@ -88,8 +96,8 @@
             {
                 continue;
             }
-            //杩囨护鐢ㄦ埛绫诲瀷 1-绠$悊鍛�;2-涓氬姟鍛�--鍏ㄥ憳;3-涓氬姟涓荤;4-涓氬姟鎬荤洃;5-瀹㈡湇浜哄憳;6-璐㈠姟浜哄憳;99-鍏朵粬
-            if (bean.UserType == 2)
+            //杩囨护鐢ㄦ埛绫诲瀷 1-绠$悊鍛�;2-涓氬姟鍛�--鍏ㄥ憳;3-瀹㈡埛缁忕悊;4-瀹㈡湇浜哄憳;5-璐㈠姟浜哄憳
+            if (!checkStrForArrayStr(1, bean.UserType) && !checkStrForArrayStr(3, bean.UserType))
             {
                 continue;
             }
@@ -116,8 +124,8 @@
             {
                 continue;
             }
-            //杩囨护鐢ㄦ埛绫诲瀷 1-绠$悊鍛�;2-涓氬姟鍛�--鍏ㄥ憳;3-涓氬姟涓荤;4-涓氬姟鎬荤洃;5-瀹㈡湇浜哄憳;6-璐㈠姟浜哄憳;99-鍏朵粬
-            if (bean.UserType != 1 && bean.UserType != 5 )
+            //杩囨护鐢ㄦ埛绫诲瀷 1-绠$悊鍛�;2-涓氬姟鍛�--鍏ㄥ憳;3-瀹㈡埛缁忕悊;4-瀹㈡湇浜哄憳;5-璐㈠姟浜哄憳
+            if (!checkStrForArrayStr(1, bean.UserType) && !checkStrForArrayStr(4, bean.UserType))
             {
                 continue;
             }
@@ -144,8 +152,8 @@
             {
                 continue;
             }
-            //杩囨护鐢ㄦ埛绫诲瀷 1-绠$悊鍛�;2-涓氬姟鍛�--鍏ㄥ憳;3-涓氬姟涓荤;4-涓氬姟鎬荤洃;5-瀹㈡湇浜哄憳;6-璐㈠姟浜哄憳;99-鍏朵粬
-            if (bean.UserType != 1 && bean.UserType != 6)
+            //杩囨护鐢ㄦ埛绫诲瀷 1-绠$悊鍛�;2-涓氬姟鍛�--鍏ㄥ憳;3-瀹㈡埛缁忕悊;4-瀹㈡湇浜哄憳;5-璐㈠姟浜哄憳
+            if (!checkStrForArrayStr(1, bean.UserType) && !checkStrForArrayStr(5, bean.UserType))
             {
                 continue;
             }
@@ -221,5 +229,59 @@
         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();
+        }
+    }
+
+    //妫�鏌ユ暟缁勬牸寮忓瓧绗︿覆涓槸鍚﹀寘鍚煇鍏冪礌
+    public static bool checkStrForArrayStr(object str, string arrayStr)
+    {
+        return stringToArray(arrayStr).Contains(str.ToString());
+    }
+
+    //瀛楃涓茶浆鏁扮粍
+    public static object[] stringToArray(string str)
+    {
+        object[] array = str.Split(',');
+        return array;
+    }
 
 }

--
Gitblit v1.9.1