From 0200c90ad90c94cfc14264d1f46e0ea20a20ebbd Mon Sep 17 00:00:00 2001 From: wzp <2040239371@qq.com> Date: 星期三, 23 十一月 2022 14:17:47 +0800 Subject: [PATCH] 优化多项 --- web/web/GwClient.aspx.cs | 238 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 231 insertions(+), 7 deletions(-) diff --git a/web/web/GwClient.aspx.cs b/web/web/GwClient.aspx.cs index 4acc808..11ff8cb 100644 --- a/web/web/GwClient.aspx.cs +++ b/web/web/GwClient.aspx.cs @@ -8,11 +8,16 @@ using Dao; 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; + + string addressClasses = ConfigurationManager.AppSettings["addressClasses"]; protected void Page_Load(object sender, EventArgs e) { @@ -29,16 +34,33 @@ this.SysUserList = userDao.LoadInfoList(out recordCount, int1, int2); } + + //鑾峰彇鍚敤鐨勪骇鍝� + using (GwProductDao gwProductDao = new GwProductDao()) + { + GwProduct bean = new GwProduct(); + bean.Classes = 1; + bean.IsDefault = -1; + bean.IsEnable = -1; + this.GwProductList = gwProductDao.getAllList(bean); + } + } + public int IsEnable + { + get + { + return this.AppContext.GetInt("IsEnable"); + } } - //鑾峰彇浜у搧鍒嗙被淇℃伅 - public string SysUserOptions(int userId) + //褰掑睘涓氬姟鍛� + public string salesmanOptions(int userId) { StringBuilder stringBuilder = new StringBuilder(); if (this.SysUserList.Count == 0) return "<option value=''>鏃�</option>"; - stringBuilder.AppendFormat("<option value=\"{0}\" >{1}</option>", (object)0, (object)"鏃�"); + stringBuilder.AppendFormat("<option value=\"{0}\" >{1}</option>", (object)"", (object)"鏃�"); foreach (SysUser bean in this.SysUserList) { //鍋滅敤鐨勭敤鎴蜂笉鍐嶆樉绀� @@ -46,18 +68,220 @@ { continue; } - //杩囨护瓒呯骇绠$悊鍛� - if (bean.UserID == 1) + //杩囨护鐢ㄦ埛绫诲瀷 1-绠$悊鍛�;2-涓氬姟鍛�--鍏ㄥ憳;3-瀹㈡埛缁忕悊;4-瀹㈡湇浜哄憳;5-璐㈠姟浜哄憳 + if (!checkStrForArrayStr(1, bean.UserType) && !checkStrForArrayStr(2, bean.UserType) ) { continue; } if (userId == bean.UserID) - stringBuilder.AppendFormat("<option value=\"{0}\" selected>{0}-{1}</option>", (object)bean.UserID, (object)bean.UserName); + stringBuilder.AppendFormat("<option value=\"{0}\" selected>{1}</option>", (object)bean.UserID, (object)bean.UserName); else - stringBuilder.AppendFormat("<option value=\"{0}\">{0}-{1}</option>", (object)bean.UserID, (object)bean.UserName); + stringBuilder.AppendFormat("<option value=\"{0}\">{1}</option>", (object)bean.UserID, (object)bean.UserName); } return stringBuilder.ToString(); } + //褰掑睘瀹㈡埛缁忕悊 + public string customerManagerOptions(int userId) + { + StringBuilder stringBuilder = new StringBuilder(); + if (this.SysUserList.Count == 0) + return "<option value=''>鏃�</option>"; + stringBuilder.AppendFormat("<option value=\"{0}\" >{1}</option>", (object)"", (object)"鏃�"); + foreach (SysUser bean in this.SysUserList) + { + //鍋滅敤鐨勭敤鎴蜂笉鍐嶆樉绀� + if (bean.Status == 0) + { + continue; + } + //杩囨护鐢ㄦ埛绫诲瀷 1-绠$悊鍛�;2-涓氬姟鍛�--鍏ㄥ憳;3-瀹㈡埛缁忕悊;4-瀹㈡湇浜哄憳;5-璐㈠姟浜哄憳 + if (!checkStrForArrayStr(1, bean.UserType) && !checkStrForArrayStr(3, bean.UserType)) + { + continue; + } + + if (userId == bean.UserID) + stringBuilder.AppendFormat("<option value=\"{0}\" selected>{1}</option>", (object)bean.UserID, (object)bean.UserName); + else + stringBuilder.AppendFormat("<option value=\"{0}\">{1}</option>", (object)bean.UserID, (object)bean.UserName); + } + return stringBuilder.ToString(); + } + + //褰掑睘瀹㈡湇浜哄憳 + public string supportStaffOptions(int userId) + { + StringBuilder stringBuilder = new StringBuilder(); + if (this.SysUserList.Count == 0) + return "<option value=''>鏃�</option>"; + stringBuilder.AppendFormat("<option value=\"{0}\" >{1}</option>", (object)"", (object)"鏃�"); + foreach (SysUser bean in this.SysUserList) + { + //鍋滅敤鐨勭敤鎴蜂笉鍐嶆樉绀� + if (bean.Status == 0) + { + continue; + } + //杩囨护鐢ㄦ埛绫诲瀷 1-绠$悊鍛�;2-涓氬姟鍛�--鍏ㄥ憳;3-瀹㈡埛缁忕悊;4-瀹㈡湇浜哄憳;5-璐㈠姟浜哄憳 + if (!checkStrForArrayStr(1, bean.UserType) && !checkStrForArrayStr(4, bean.UserType)) + { + continue; + } + + if (userId == bean.UserID) + stringBuilder.AppendFormat("<option value=\"{0}\" selected>{1}</option>", (object)bean.UserID, (object)bean.UserName); + else + stringBuilder.AppendFormat("<option value=\"{0}\">{1}</option>", (object)bean.UserID, (object)bean.UserName); + } + return stringBuilder.ToString(); + } + + //褰掑睘璐㈠姟浜哄憳 + public string financialStaffOptions(int userId) + { + StringBuilder stringBuilder = new StringBuilder(); + if (this.SysUserList.Count == 0) + return "<option value=''>鏃�</option>"; + stringBuilder.AppendFormat("<option value=\"{0}\" >{1}</option>", (object)"", (object)"鏃�"); + foreach (SysUser bean in this.SysUserList) + { + //鍋滅敤鐨勭敤鎴蜂笉鍐嶆樉绀� + if (bean.Status == 0) + { + continue; + } + //杩囨护鐢ㄦ埛绫诲瀷 1-绠$悊鍛�;2-涓氬姟鍛�--鍏ㄥ憳;3-瀹㈡埛缁忕悊;4-瀹㈡湇浜哄憳;5-璐㈠姟浜哄憳 + if (!checkStrForArrayStr(1, bean.UserType) && !checkStrForArrayStr(5, bean.UserType)) + { + continue; + } + + if (userId == bean.UserID) + stringBuilder.AppendFormat("<option value=\"{0}\" selected>{1}</option>", (object)bean.UserID, (object)bean.UserName); + else + stringBuilder.AppendFormat("<option value=\"{0}\">{1}</option>", (object)bean.UserID, (object)bean.UserName); + } + return stringBuilder.ToString(); + } + + + //鑾峰彇浜у搧淇℃伅 + public string GetProductOptions(string productId) + { + StringBuilder stringBuilder = new StringBuilder(); + if (this.GwProductList.Count == 0) + return "<option value=''>鏃�</option>"; + stringBuilder.AppendFormat("<option value=\"{0}\" >{1}</option>", (object)"", (object)"鏃�"); + foreach (GwProduct bean in this.GwProductList) + { + //鍋滅敤鐨勪骇鍝佸垎绫讳笉鍐嶆樉绀� + if (bean.IsEnable == 0) + { + continue; + } + //杩囨护浜у搧绫诲埆 + if (bean.Classes == 0) + { + continue; + } + + if (productId.Equals(bean.Id)) + stringBuilder.AppendFormat("<option value=\"{0}\" selected>{1}</option>", (object)bean.Id, (object)bean.Name); + else + stringBuilder.AppendFormat("<option value=\"{0}\">{1}</option>", (object)bean.Id, (object)bean.Name); + } + return stringBuilder.ToString(); + } + + + //鑾峰彇涓�т骇鍝佷俊鎭� + public string GetPersonalityProductOptions(string productId) + { + StringBuilder stringBuilder = new StringBuilder(); + if (this.GwProductList.Count == 0) + return "<option value=''>鏃�</option>"; + stringBuilder.AppendFormat("<option value=\"{0}\" >{1}</option>", (object)"", (object)"鏃�"); + foreach (GwProduct bean in this.GwProductList) + { + //鍋滅敤鐨勪骇鍝佸垎绫讳笉鍐嶆樉绀� + if (bean.IsEnable == 0) + { + continue; + } + //杩囨护浜у搧绫诲埆 + if (bean.Classes == 0) + { + continue; + } + //杩囨护鎺ㄥ箍鏂瑰紡 + if (bean.IsDefault == 1) + { + continue; + } + + if (productId.Equals(bean.Id)) + stringBuilder.AppendFormat("<option value=\"{0}\" selected>{1}</option>", (object)bean.Id, (object)bean.Name); + else + stringBuilder.AppendFormat("<option value=\"{0}\">{1}</option>", (object)bean.Id, (object)bean.Name); + } + 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