From 37080f5d0add35dc528212ece83adff1db6c50ee Mon Sep 17 00:00:00 2001 From: wzp <2880584989@qq.com> Date: 星期四, 16 九月 2021 15:54:27 +0800 Subject: [PATCH] 更新 --- web/web/GwClient.ashx | 98 +++++++++++++++++++++++++++++++++++++------------ 1 files changed, 74 insertions(+), 24 deletions(-) diff --git a/web/web/GwClient.ashx b/web/web/GwClient.ashx index 2f0b866..40e0def 100644 --- a/web/web/GwClient.ashx +++ b/web/web/GwClient.ashx @@ -3,12 +3,13 @@ using System.Web; using Dao; using Common; - using System.Collections.Generic; using System.Configuration; using System.Text; using System.Text.RegularExpressions; - +using System.IO; + + public class GwClientHandler : PageHandler<Model.SysUser> @@ -21,7 +22,7 @@ { case "clientSpList": return this.GetGwspList(context); - + case "loadGwClientPageList": return LoadGwClientPageList(context); case "save": @@ -55,7 +56,7 @@ private Dao.GwClientDao _Dao = new Dao.GwClientDao(); private GwSpDao _GwSpDao = new GwSpDao(); - + /// <summary> /// 鍔犺浇浠g悊鍟嗚处鍙峰垪琛� /// </summary> @@ -77,12 +78,17 @@ using (GwClientDao dao = new GwClientDao()) { var list = dao.LoadInfoList(out recordCount, pageIndex, pageSize, ClientID, ClientName, Telephone, Agent); - + if (list != null && list.Count > 0) { foreach (Model.GwClient item in list) { - str += @"<tr ><td>" + item.ClientID + "</td><td>" + item.ClientName + "</td><td>" + item.Telephone + "</td><td>" +item.TotalAmount / 1000 + "鍏�/" + item.Balance / 1000 + "鍏�</td><td>" + item.Agent + "</td><td>" + item.Remark + "</td>"; + string Certification_StatusResult = "鏈璇�"; + if (item.Certification_Status == 1) + { + Certification_StatusResult = "宸茶璇�"; + } + 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 += @"<td>"; string loginStr = "http://" + serverIp + ":" + clientPort + "/Attachedlogin.aspx?action=Attachedlogin&account=" + item.Account + "&password=" + item.Password; @@ -112,13 +118,15 @@ { str += @"<tr><td colspan=""8"">鏆傛棤淇℃伅</td></tr>"; } - + } return new JsonPageResult(true, new { Table = str.ToString(), TotalCount = recordCount }); } - //add 2017-10-21 + + + //add 2017-10-21 private JsonPageResult GetGwspList(PageContext<Model.SysUser> context) { string clientID = context.GetString("clientID"); @@ -145,10 +153,10 @@ get = gwClient }); } - + //end - - + + private JsonPageResult UpdateWhite(PageContext<Model.SysUser> context) { string clientID = context.GetString("clientID"); @@ -210,7 +218,7 @@ return new JsonPageResult(true, "鍒犻櫎瀹㈡埛璧勬枡鎴愬姛锛�"); } - + /// <summary> /// 淇濆瓨瀹㈡埛璧勬枡 /// </summary> @@ -261,16 +269,17 @@ return new JsonPageResult(true, "淇敼瀹㈡埛璧勬枡鎴愬姛锛�"); } - //鍒涘缓鏂板鎴� + ///鍒涘缓鏂板鎴� private JsonPageResult Save(PageContext<Model.SysUser> context) { string clientID = context.GetString("clientID"); string password = context.GetString("password"); - string clientName = context.GetString("clientName"); + //string clientName = context.GetString("clientName"); string address = context.GetString("address"); string telephone = context.GetString("telephone"); string remark = context.GetString("remark"); string agent = context.GetString("agent"); + string company = context.GetString("company"); string permissionData = Newtonsoft.Json.JsonConvert.SerializeObject(context.GetString("permissionData").Split(',')); if (string.IsNullOrEmpty(clientID)) @@ -283,33 +292,74 @@ throw new ArgumentException("瀹㈡埛瀵嗙爜涓嶈兘涓虹┖锛屼笖蹇呴』涓�4-10浣嶈嫳鏂囨垨鏁板瓧瀛楃缁勫悎锛�"); } - if (string.IsNullOrEmpty(clientName)) - { - throw new ArgumentException("瀹㈡埛鍚嶇О涓嶈兘涓虹┖锛�"); - } + //if (string.IsNullOrEmpty(clientName)) + //{ + // throw new ArgumentException("瀹㈡埛鍚嶇О涓嶈兘涓虹┖锛�"); + //} if (_Dao.IsIDExists(clientID)) { throw new ArgumentException("瀹㈡埛璐﹀彿宸茬粡瀛樺湪锛�"); } + HttpFileCollection _file = HttpContext.Current.Request.Files; + if (_file.Count > 0) + { + long size = _file[0].ContentLength; //鏂囦欢澶у皬 + string type = _file[0].ContentType; //鏂囦欢绫诲瀷 + string name = _file[0].FileName; //鏂囦欢鍚� + string _tp = Path.GetExtension(name);//鏂囦欢鎵╁睍鍚� + if (_tp.ToLower() == ".jpg" || _tp.ToLower() == ".jpeg" || _tp.ToLower() == ".gif" || _tp.ToLower() == ".png") + { + Stream stream = _file[0].InputStream;//鑾峰彇鏂囦欢娴� + string savaName = clientID + "-" + DateTime.Now.ToString("yyyyMMddHHssmm") + _tp; //淇濆瓨鏂囦欢銆傛枃浠跺悕 + string filepath = "\\UploadFile\\" + savaName; + string path = AppDomain.CurrentDomain.BaseDirectory + filepath;//鍥剧墖璺緞 + _file[0].SaveAs(path); + + try + { + //鍒涘缓瀹℃牳閫氳繃鐨勮褰� + Model.GwClientCertification gwClientCertification = new Model.GwClientCertification(); + gwClientCertification.Client_ID = clientID; + gwClientCertification.Certificate_Path = path; + gwClientCertification.Client_Classes = 0;//绫诲瀷锛�0-浼佷笟銆�1-涓汉 + gwClientCertification.Audit_Status = 1;//瀹℃牳鐘舵�侊紝0-寰呭鏍革紝1-閫氳繃锛�2-涓嶉�氳繃 + gwClientCertification.Certification_Time = DateTime.Now;//璁よ瘉瀹℃牳鏃堕棿 + gwClientCertification.Operator = context.OperatorID;//鎿嶄綔瀹℃牳浜� + gwClientCertification.Upload_Time = DateTime.Now;//涓婁紶鏃堕棿 + gwClientCertification.Remark = "绠$悊鍚庡彴鎿嶄綔鍒涘缓"; + + //淇濆瓨瀹℃牳璁板綍 + GwClientCertificationDao certificationDao = new GwClientCertificationDao(); + certificationDao.Insert(gwClientCertification); + } + catch (Exception ex) + { + return new JsonPageResult(false, "涓婁紶鍥剧墖澶勭悊寮傚父锛�" + ex.Message); + } + } + } + + var client = new Model.GwClient(); client.ClientID = clientID; client.Password = password; - - client.ClientName = clientName; + + //client.ClientName = clientName; client.Address = address; client.Remark = remark; client.Telephone = telephone; client.Agent = agent; client.PermissionData = permissionData; client.ParentId = context.OperatorID; - - _Dao.Add(client); + client.Certification_Status = 1; + client.Company = company; + _Dao.Add(client);//鎻掑叆鏁版嵁搴撱�傚垱寤鸿处鎴� - return new JsonPageResult(true, "鍒涘缓瀹㈡埛鎴愬姛锛�"); + return new JsonPageResult(true, "鍒涘缓璐︽埛鎴愬姛锛�"); } -} +} -- Gitblit v1.9.1