From dbda463cdacc6c6101acdf9d58e22450a281b9b0 Mon Sep 17 00:00:00 2001
From: yzh <snbbt@21cn.com>
Date: 星期二, 07 六月 2022 23:11:04 +0800
Subject: [PATCH] 客户信息管理 停用客户信息管理
---
web/web/GwClient.ashx | 677 +++++++++++++++++++++++++++++++++++++++++++++++++------
1 files changed, 599 insertions(+), 78 deletions(-)
diff --git a/web/web/GwClient.ashx b/web/web/GwClient.ashx
index 2f0b866..47443d7 100644
--- a/web/web/GwClient.ashx
+++ b/web/web/GwClient.ashx
@@ -1,27 +1,44 @@
锘�<%@ WebHandler Language="C#" Class="GwClientHandler" %>
using System;
+using System.Linq;
using System.Web;
using Dao;
+using Model;
using Common;
-
using System.Collections.Generic;
using System.Configuration;
using System.Text;
using System.Text.RegularExpressions;
-
+using System.IO;
+using Newtonsoft.Json;
+
+
public class GwClientHandler : PageHandler<Model.SysUser>
{
+
+ private UserDao _SysUserDao = new UserDao();
+ private List<SysUser> _SysUserList;
+
+ private int _userId = -1;
+ private int _userType = -1;
+ private string _account = "";
+ private string initPwd = ConfigurationManager.AppSettings["initPwd"];
+
public override JsonPageResult ProcessRequestInternal(PageContext<Model.SysUser> context)
{
string action = context.GetString("action");
+
+ _userId = context.SessionObject.UserID;
+ _userType = context.SessionObject.UserType;
+ _account = context.SessionObject.Account;
switch (action)
{
case "clientSpList":
return this.GetGwspList(context);
-
+
case "loadGwClientPageList":
return LoadGwClientPageList(context);
case "save":
@@ -47,6 +64,27 @@
case "updateBlack":
return UpdateBlack(context);
+ //鎵归噺鍒嗛厤瀹㈡埛鐨勪釜鎬т骇鍝�
+ case "batchUpdateClientProduct":
+ return BatchUpdateClientProduct(context);
+ //閲嶇疆瀵嗙爜
+ case "resetPwd":
+ return ResetPwd(context);
+ //淇敼瀵嗙爜
+ case "updatePwd":
+ return UpdatePwd(context);
+ //鑾峰彇瀹㈡埛鍒嗛厤涓�т骇鍝�
+ case "getPersonalityProduct":
+ return GetPersonalityProduct(context);
+ //淇敼鍒嗛厤涓�т骇鍝�
+ case "updateProduct":
+ return UpdateProduct(context);
+ //鍚敤鎴栧仠鐢�
+ case "updateStatus":
+ return UpdateStatus(context);
+ //鑾峰彇Token锛氭湭瀹炵幇鐢熸垚Token
+ case "getToken":
+ return GetToken(context);
default:
throw new Exception("Invalid Action=" + action);
@@ -55,7 +93,7 @@
private Dao.GwClientDao _Dao = new Dao.GwClientDao();
private GwSpDao _GwSpDao = new GwSpDao();
-
+
/// <summary>
/// 鍔犺浇浠g悊鍟嗚处鍙峰垪琛�
/// </summary>
@@ -64,8 +102,13 @@
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");
+ string Salesman = context.GetString("Salesman");
+ string SupportStaff = context.GetString("SupportStaff");
+ string ProductId = context.GetString("ProductId");
+ int IsEnable = context.GetInt("IsEnable", -1);
int pageIndex = context.GetInt("pageIndex", 1);
string Agent = context.GetString("Agent");
@@ -73,52 +116,109 @@
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, ClientID, ClientName, Telephone, Agent);
-
+ string permissionsSQL = dao.GetClientPermissions(_userId, _userType, "gwc");
+ var list = dao.LoadInfoList(out recordCount, pageIndex, pageSize, ClientID, ClientName, Telephone, Agent, Company, Salesman, SupportStaff, ProductId, IsEnable, permissionsSQL);
+
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 = "宸茶璇�";
+ }
+ //edit:yangzh by 20220511
+ //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 += @"<tr ><td>" + item.ClientID + "</td><td>" + item.Company + "</td><td>" + item.ClientName + "</td><td>" + item.Telephone + "</td><td>" + item.Balance/1000 + "鍏�</td><td>" + item.Top_up_Amount_Total/1000 + "鍏�</td><td>" + item.Agent + "</td><td>" + Certification_StatusResult + "</td>";
+ //str += @"<tr ><td rowspan='1' ><input type='checkbox' name='checkbox' value='" + item.ClientID + "'/></td><td>" + item.ClientID + "</td><td>" + item.Company + "</td><td>" + item.ClientName + "</td><td>" + item.Telephone + "</td><td>" + item.Balance/1000 + "鍏�</td><td>" + item.Top_up_Amount_Total/1000 + "鍏�</td><td>" + SysUserName(string.IsNullOrEmpty(item.Salesman)? 0: int.Parse(item.Salesman) ) + "</td><td>" + Certification_StatusResult + "</td>";
+ str += @"<tr ><td rowspan='1' ><input type='checkbox' name='checkbox' value='" + item.ClientID + "'/></td><td>" + item.ClientID + "</td><td>" + item.Company + "</td><td>" + item.ClientName + "</td><td>" + item.Telephone + "</td><td>" + item.Balance/1000 + "</td><td>" + item.Top_up_Amount_Total/1000 + "</td><td>" + SysUserName(string.IsNullOrEmpty(item.Salesman)? 0: int.Parse(item.Salesman) ) + "</td>"
+ + "<td>" + item.ProductIds + "</td>"
+ + "<td>"+ (item.Is_Enable == 1 ? "<span class='label label-primary'>鍚敤</span>" : "<span class='label label-default'>鍋滅敤</span>") + "</td>";
str += @"<td>";
- string loginStr = "http://" + serverIp + ":" + clientPort + "/Attachedlogin.aspx?action=Attachedlogin&account=" + item.Account + "&password=" + item.Password;
- str += string.Format("<a class=\"action-modal-login btn btn-success btn-xs \" href=\"{0}\" data-id=\"{1}\" target=\"_blank\">", (object)loginStr, (object)item.ClientID);
- str += " 鐧诲綍</a> ";
+
+ if (item.Is_Enable == 1)
+ {
+ //string loginStr = "http://" + serverIp + ":" + clientPort + "/Attachedlogin.aspx?action=Attachedlogin&account=" + item.Account + "&password=" + item.Password;
+ string loginStr = "http://" + serverIp + ":" + clientPort + "/Attachedlogin.aspx?action=Attachedlogin&account=" + item.Account ;
+ str += string.Format("<a class=\"action-modal-login btn btn-success btn-xs \" href=\"javascript:;\" data-url=\"{0}\" data-id=\"{1}\" target=\"_blank\">", (object)loginStr, (object)item.ClientID);
+ str += " 鐧诲綍</a> ";
- str += string.Format(@"<a class=""action-modal-edit btn btn-xs btn-primary"" href=""javascript:;"" data-id=""{0}"">", item.ClientID);
- str += @"缂栬緫";
+ str += string.Format(@"<a class=""action-modal-edit btn btn-xs btn-primary"" href=""javascript:;"" data-id=""{0}"">", item.ClientID);
+ str += @"缂栬緫";
+ str += @"</a> ";
+
+ str += string.Format(@"<a class=""action-modal-white btn btn-xs btn-primary"" href=""javascript:;"" data-id=""{0}"">", item.ClientID);
+ str += @"鐧藉悕鍗�";
+ str += @"</a> ";
+
+ str += string.Format(@"<a class=""action-modal-black btn btn-xs btn-primary"" href=""javascript:;"" data-id=""{0}"">", item.ClientID);
+ str += @"榛戝悕鍗�";
+ str += @"</a> ";
+
+ //str += string.Format(@"<a class=""action-modal-resetPwd btn btn-xs btn-primary"" href=""javascript:;"" data-id=""{0}"">", item.ClientID);
+ //str += @"閲嶇疆瀵嗙爜";
+ //str += @"</a> ";
+
+ str += string.Format(@"<a class=""action-modal-updatePwd btn btn-xs btn-primary"" href=""javascript:;"" data-id=""{0}"">", item.ClientID);
+ str += @"淇敼瀵嗙爜";
+ str += @"</a> ";
+
+ str += string.Format(@"<a class=""action-modal-updateProduct btn btn-xs btn-primary"" href=""javascript:;"" data-id=""{0}"">", item.ClientID);
+ str += @"淇敼浜у搧";
+ str += @"</a> ";
+
+ str += string.Format(@"<a class=""action-modal-orderCreate btn btn-xs btn-primary"" href=""javascript:;"" data-id=""{0}"">", item.ClientID);
+ str += @"鍏呭��";
+ str += @"</a> ";
+ }
+
+ str += string.Format(@"<a class=""action-modal-orderLog btn btn-xs btn-primary"" href=""javascript:;"" data-id=""{0}"">", item.ClientID);
+ str += @"鍏呭�兼棩蹇�";
str += @"</a> ";
- str += string.Format(@"<a class=""action-modal-white btn btn-xs btn-primary"" href=""javascript:;"" data-id=""{0}"">", item.ClientID);
- str += @"鐧藉悕鍗�";
- str += @"</a> ";
+ if(item.Is_Enable == 1)
+ {
+ str += string.Format(@"<a class=""action-modal-updateStatus btn btn-xs btn-default"" href=""javascript:;"" data-id=""{0}"" data-status=0 >", item.ClientID);
+ str += @"<i class='fa fa-toggle-on'></i>鍋滅敤</a> ";
- str += string.Format(@"<a class=""action-modal-black btn btn-xs btn-primary"" href=""javascript:;"" data-id=""{0}"">", item.ClientID);
- str += @"榛戝悕鍗�";
- str += @"</a> ";
+ }
+ else
+ {
+ str += string.Format(@"<a class=""action-modal-updateStatus btn btn-xs btn-primary"" href=""javascript:;"" data-id=""{0}"" data-status=1 >", item.ClientID);
+ str += @"<i class='fa fa-toggle-off'></i>鍚敤</a> ";
- str += string.Format(@"<a class=""action-delete btn btn-xs btn-default"" href=""javascript:;"" data-id=""{0}"">", item.ClientID);
- str += @"鍒犻櫎";
- str += @"</a>";
+ }
+
+ if (item.Is_Enable == 0)
+ {
+ str += string.Format(@"<a class=""action-delete btn btn-xs btn-default"" href=""javascript:;"" data-id=""{0}"">", item.ClientID);
+ str += @"鍒犻櫎";
+ str += @"</a>";
+ }
+
str += @"</td>";
str += @"</tr>";
}
}
else
{
- str += @"<tr><td colspan=""8"">鏆傛棤淇℃伅</td></tr>";
+ str += @"<tr><td colspan=""11"">鏆傛棤淇℃伅</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 +245,10 @@
get = gwClient
});
}
-
+
//end
-
-
+
+
private JsonPageResult UpdateWhite(PageContext<Model.SysUser> context)
{
string clientID = context.GetString("clientID");
@@ -183,6 +283,89 @@
return new JsonPageResult(true, _Dao.GetBlackList(clientID));
}
+ //鏍规嵁瀹㈡埛璐﹀彿鐢熸垚Token
+ private JsonPageResult GetToken(PageContext<Model.SysUser> context)
+ {
+ string clientID = context.GetString("clientID");
+ if (string.IsNullOrEmpty(clientID) )
+ {
+ throw new ArgumentException("瀹㈡埛璐﹀彿鍙傛暟寮傚父锛�");
+ }
+
+ //鐢熸垚Token
+ string token = clientID;
+
+ return new JsonPageResult(true, token);
+ }
+
+
+ //閲嶇疆瀵嗙爜
+ private JsonPageResult ResetPwd(PageContext<Model.SysUser> context)
+ {
+ string clientID = context.GetString("clientID");
+ string password = string.IsNullOrEmpty(initPwd ) ? "123456" : initPwd;
+
+ //瀵嗙爜MD5鍔犲瘑锛�
+ password = DataHelper.MD5Hex(password);
+
+ _Dao.UpdatePassword(clientID, password);
+
+ return new JsonPageResult(true, "閲嶇疆瀵嗙爜鎴愬姛锛�");
+ }
+
+ //淇敼瀵嗙爜
+ private JsonPageResult UpdatePwd(PageContext<Model.SysUser> context)
+ {
+ string clientID = context.GetString("clientID");
+ string newPwd = context.GetString("newPwd");
+
+ if (string.IsNullOrEmpty(newPwd) || !System.Text.RegularExpressions.Regex.IsMatch(newPwd, @"[a-zA-Z0-9]{4,10}"))
+ {
+ throw new ArgumentException("鐧诲綍瀵嗙爜涓嶈兘涓虹┖锛屼笖蹇呴』涓�4-10浣嶈嫳鏂囨垨鏁板瓧瀛楃缁勫悎锛�");
+ }
+
+ //瀵嗙爜MD5鍔犲瘑锛�
+ newPwd = DataHelper.MD5Hex(newPwd);
+
+ _Dao.UpdatePassword(clientID, newPwd);
+
+ return new JsonPageResult(true, "淇敼瀵嗙爜鎴愬姛锛�");
+ }
+
+ //鑾峰彇瀹㈡埛涓�т骇鍝�
+ private JsonPageResult GetPersonalityProduct(PageContext<Model.SysUser> context)
+ {
+ string clientId = context.GetString("clientId");
+
+ return new JsonPageResult(true, _Dao.GetPersonalityProduct(clientId).Keys);
+ }
+
+ //淇敼鍒嗛厤涓�т骇鍝侊細淇敼纭
+ private JsonPageResult UpdateProduct(PageContext<SysUser> context)
+ {
+ //context.CheckRight("1042", FailedOperation.PromptOnly);
+ string @string = context.GetString("productIdArray");
+ string clientId = context.GetString("clientId");
+ string[] productIdArray = JsonConvert.DeserializeObject<string[]>(@string);
+ if (productIdArray == null)
+ throw new ArgumentException("涓�у垎閰嶄骇鍝佹暟鎹紓甯革紒");
+ if (string.IsNullOrEmpty(clientId) )
+ throw new ArgumentException("瀹㈡埛璐﹀彿鍙傛暟寮傚父锛�");
+ this._Dao.UpdateProduct(clientId, productIdArray);
+ return new JsonPageResult(true, (object) "淇敼鍒嗛厤涓�т骇鍝佹垚鍔燂紒");
+ }
+
+ //鏇存柊淇℃伅鍚敤鎴栧仠鐢�
+ private JsonPageResult UpdateStatus(PageContext<SysUser> context)
+ {
+ string clientId = context.GetString("clientId");
+ string isEnable = context.GetString("isEnable");
+
+ this._Dao.UpdateStatus(clientId, isEnable);
+ return new JsonPageResult(true, "鏇存柊淇℃伅鐘舵�佹垚鍔燂紒");
+
+ }
+
/// <summary>
/// 閫氳繃璐﹀彿鍚嶈幏鍙栦唬鐞嗗晢淇℃伅
/// </summary>
@@ -210,7 +393,7 @@
return new JsonPageResult(true, "鍒犻櫎瀹㈡埛璧勬枡鎴愬姛锛�");
}
-
+
/// <summary>
/// 淇濆瓨瀹㈡埛璧勬枡
/// </summary>
@@ -220,13 +403,190 @@
{
int id = Int32.Parse(context.GetString("id"));
string clientID = context.GetString("clientID");
+ string company = context.GetString("company");
string password = context.GetString("password");
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 permissionData = Newtonsoft.Json.JsonConvert.SerializeObject(context.GetString("permissionData").Split(','));
+ string salesman = context.GetString("salesman");
+ string customerManager = context.GetString("customerManager");
+ string supportStaff = context.GetString("supportStaff");
+ string financialStaff = context.GetString("financialStaff");
+ string chargeType = context.GetString("chargeType");
+ string smsStatusReport = context.GetString("smsStatusReport");
+ string mmsStatusReport = context.GetString("mmsStatusReport");
+
+ string isEnableWhite = context.GetString("isEnableWhite");
+ string isEnableBlack = context.GetString("isEnableBlack");
+ string isRemoteLoginNotice = context.GetString("isRemoteLoginNotice");
+ string isMobileCaptcha = context.GetString("isMobileCaptcha");
+ string isHideMobile = context.GetString("isHideMobile");
+ string isDisplayStatus = context.GetString("isDisplayStatus");
+ string isLoginIpRestrict = context.GetString("isLoginIpRestrict");
+ string isLoginIpAllowGather = context.GetString("isLoginIpAllowGather");
+ string isLoginCityRestrict = context.GetString("isLoginCityRestrict");
+ string isLoginCityAllowGather = context.GetString("isLoginCityAllowGather");
+
+ string data = context.GetString("permissionData");
+ if(data.Contains("1"))
+ {
+ data += ",sp.aspx,GwTaskSmssend,SpPrePattern.aspx";
+ }
+ if(data.Contains("2"))
+ {
+ data += ",molog.aspx,mtlog.aspx#stat,mtlog.aspx,statis.aspx";
+ }
+ string permissionData = Newtonsoft.Json.JsonConvert.SerializeObject(data.Split(','));
+
+ if (string.IsNullOrEmpty(clientID))
+ {
+ throw new ArgumentException("瀹㈡埛璐﹀彿涓嶈兘涓虹┖锛屼笖蹇呴』涓哄叕鍙稿悕绉帮紒");
+ }
+
+ /**
+ if (string.IsNullOrEmpty(password) || !System.Text.RegularExpressions.Regex.IsMatch(password, @"[a-zA-Z0-9]{4,10}"))
+ {
+ throw new ArgumentException("瀹㈡埛瀵嗙爜涓嶈兘涓虹┖锛屼笖蹇呴』涓�4-10浣嶈嫳鏂囨垨鏁板瓧瀛楃缁勫悎锛�");
+ }**/
+
+ if (string.IsNullOrEmpty(clientName) || string.IsNullOrEmpty(telephone))
+ {
+ throw new ArgumentException("鑱旂郴浜�/鑱旂郴鐢佃瘽锛屼笉鑳戒负绌猴紒");
+ }
+
+ if (string.IsNullOrEmpty(customerManager))
+ {
+ throw new ArgumentException("褰掑睘瀹㈡埛缁忕悊涓嶈兘涓虹┖锛岃閫夋嫨锛�");
+ }
+
+ if (string.IsNullOrEmpty(salesman))
+ {
+ throw new ArgumentException("褰掑睘涓氬姟鍛樹笉鑳戒负绌猴紝璇烽�夋嫨锛�");
+ }
+
+ if (string.IsNullOrEmpty(supportStaff))
+ {
+ throw new ArgumentException("褰掑睘瀹㈡湇浜哄憳涓嶈兘涓虹┖锛岃閫夋嫨锛�");
+ }
+
+ if (string.IsNullOrEmpty(financialStaff))
+ {
+ throw new ArgumentException("褰掑睘璐㈠姟浜哄憳涓嶈兘涓虹┖锛岃閫夋嫨锛�");
+ }
+
+ if (string.IsNullOrEmpty(chargeType))
+ {
+ throw new ArgumentException("璁¤垂鏂瑰紡涓嶈兘涓虹┖锛岃閫夋嫨锛�");
+ }
+
+ if (string.IsNullOrEmpty(smsStatusReport))
+ {
+ throw new ArgumentException("鐭俊鏄惁鏀寔鏄剧ず鐘舵�佹姤鍛婁笉鑳戒负绌猴紝璇烽�夋嫨锛�");
+ }
+
+ /**
+ if (string.IsNullOrEmpty(mmsStatusReport))
+ {
+ throw new ArgumentException("褰╀俊鏄惁鏀寔鏄剧ず鐘舵�佹姤鍛婁笉鑳戒负绌猴紝璇烽�夋嫨锛�");
+ }**/
+
+ /**
+ //缂栬緫鏃朵笉鏀寔涓�у瘑鐮�
+ string savePassword = "";
+ if (!string.IsNullOrEmpty(clientID))
+ {
+ GwClient gwClient = this._Dao.Get(clientID);
+ savePassword = (gwClient.Password == password ? gwClient.Password : DataHelper.MD5Hex(password) );
+ }
+ else
+ {
+ savePassword = DataHelper.MD5Hex(password);
+ }
+
+ **/
+
+ var client = new Model.GwClient();
+
+ client.Id = id;
+ client.ClientID = clientID;
+ client.Company = company;
+ //client.Password = password;
+ //client.Password = savePassword;
+
+ client.ClientName = clientName;
+ client.Address = address;
+ client.Remark = remark;
+ client.Telephone = telephone;
+ client.Agent = agent;
+
+ client.CustomerManager = customerManager;
+ client.Salesman = salesman;
+ client.SupportStaff = supportStaff;
+ client.FinancialStaff = financialStaff;
+ client.ChargeType = string.IsNullOrEmpty(chargeType) ? 0 : int.Parse(chargeType);
+ client.SmsStatusReport = string.IsNullOrEmpty(smsStatusReport) ? 0 : int.Parse(smsStatusReport);
+ client.MmsStatusReport = string.IsNullOrEmpty(mmsStatusReport) ? 0 : int.Parse(mmsStatusReport);
+
+ client.IsEnableWhite = string.IsNullOrEmpty(isEnableWhite) ? 0 : int.Parse(isEnableWhite);
+ client.IsEnableBlack = string.IsNullOrEmpty(isEnableBlack) ? 0 : int.Parse(isEnableBlack);
+ client.IsRemoteLoginNotice = string.IsNullOrEmpty(isRemoteLoginNotice) ? 0 : int.Parse(isRemoteLoginNotice);
+ client.IsMobileCaptcha = string.IsNullOrEmpty(isMobileCaptcha) ? 0 : int.Parse(isMobileCaptcha);
+ client.IsHideMobile = string.IsNullOrEmpty(isHideMobile) ? 0 : int.Parse(isHideMobile);
+ client.IsDisplayStatus = string.IsNullOrEmpty(isDisplayStatus) ? 0 : int.Parse(isDisplayStatus);
+ client.IsLoginIpRestrict = string.IsNullOrEmpty(isLoginIpRestrict) ? 0 : int.Parse(isLoginIpRestrict);
+ client.IsLoginIpAllowGather = isLoginIpAllowGather;
+ client.IsLoginCityRestrict = string.IsNullOrEmpty(isLoginCityRestrict) ? 0 : int.Parse(isLoginCityRestrict);
+ client.IsLoginCityAllowGather = isLoginCityAllowGather;
+
+ client.PermissionData = permissionData;
+
+ _Dao.Update(client);
+
+ 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 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 salesman = context.GetString("salesman");
+ string customerManager = context.GetString("customerManager");
+ string supportStaff = context.GetString("supportStaff");
+ string financialStaff = context.GetString("financialStaff");
+ string chargeType = context.GetString("chargeType");
+ string smsStatusReport = context.GetString("smsStatusReport");
+ string mmsStatusReport = context.GetString("mmsStatusReport");
+
+ string isEnableWhite = context.GetString("isEnableWhite");
+ string isEnableBlack = context.GetString("isEnableBlack");
+ string isRemoteLoginNotice = context.GetString("isRemoteLoginNotice");
+ string isMobileCaptcha = context.GetString("isMobileCaptcha");
+ string isHideMobile = context.GetString("isHideMobile");
+ string isDisplayStatus = context.GetString("isDisplayStatus");
+ string isLoginIpRestrict = context.GetString("isLoginIpRestrict");
+ string isLoginIpAllowGather = context.GetString("isLoginIpAllowGather");
+ string isLoginCityRestrict = context.GetString("isLoginCityRestrict");
+ string isLoginCityAllowGather = context.GetString("isLoginCityAllowGather");
+
+ string data = context.GetString("permissionData");
+ if(data.Contains("1"))
+ {
+ data += ",sp.aspx,GwTaskSmssend,SpPrePattern.aspx";
+ }
+ if(data.Contains("2"))
+ {
+ data += ",molog.aspx,mtlog.aspx#stat,mtlog.aspx,statis.aspx";
+ }
+ string permissionData = Newtonsoft.Json.JsonConvert.SerializeObject(data.Split(','));
if (string.IsNullOrEmpty(clientID))
{
@@ -243,60 +603,101 @@
throw new ArgumentException("鑱旂郴浜�/鑱旂郴鐢佃瘽锛屼笉鑳戒负绌猴紒");
}
-
- var client = new Model.GwClient();
-
- client.Id = id;
- client.ClientID = clientID;
- client.Password = password;
- client.ClientName = clientName;
- client.Address = address;
- client.Remark = remark;
- client.Telephone = telephone;
- client.Agent = agent;
- client.PermissionData = permissionData;
-
- _Dao.Update(client);
-
- 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 address = context.GetString("address");
- string telephone = context.GetString("telephone");
- string remark = context.GetString("remark");
- string agent = context.GetString("agent");
- string permissionData = Newtonsoft.Json.JsonConvert.SerializeObject(context.GetString("permissionData").Split(','));
-
- if (string.IsNullOrEmpty(clientID))
- {
- throw new ArgumentException("瀹㈡埛璐﹀彿涓嶈兘涓虹┖锛屼笖蹇呴』涓哄叕鍙稿悕绉帮紒");
- }
-
- if (string.IsNullOrEmpty(password) || !System.Text.RegularExpressions.Regex.IsMatch(password, @"[a-zA-Z0-9]{4,10}"))
- {
- 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("瀹㈡埛璐﹀彿宸茬粡瀛樺湪锛�");
}
+ if (string.IsNullOrEmpty(customerManager))
+ {
+ throw new ArgumentException("褰掑睘瀹㈡埛缁忕悊涓嶈兘涓虹┖锛岃閫夋嫨锛�");
+ }
+
+ if (string.IsNullOrEmpty(salesman))
+ {
+ throw new ArgumentException("褰掑睘涓氬姟鍛樹笉鑳戒负绌猴紝璇烽�夋嫨锛�");
+ }
+
+ if (string.IsNullOrEmpty(supportStaff))
+ {
+ throw new ArgumentException("褰掑睘瀹㈡湇浜哄憳涓嶈兘涓虹┖锛岃閫夋嫨锛�");
+ }
+
+ if (string.IsNullOrEmpty(financialStaff))
+ {
+ throw new ArgumentException("褰掑睘璐㈠姟浜哄憳涓嶈兘涓虹┖锛岃閫夋嫨锛�");
+ }
+
+ if (string.IsNullOrEmpty(chargeType))
+ {
+ throw new ArgumentException("璁¤垂鏂瑰紡涓嶈兘涓虹┖锛岃閫夋嫨锛�");
+ }
+
+ if (string.IsNullOrEmpty(smsStatusReport))
+ {
+ throw new ArgumentException("鐭俊鏄惁鏀寔鏄剧ず鐘舵�佹姤鍛婁笉鑳戒负绌猴紝璇烽�夋嫨锛�");
+ }
+ /**
+ if (string.IsNullOrEmpty(mmsStatusReport))
+ {
+ 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);
+ }
+ }
+ else
+ {
+ throw new ArgumentException("鏂囦欢鏍煎紡閿欒锛岃纭鏄惁涓簀pg|jpeg|gif|png銆�");
+ }
+ }
+
+ //瀵嗙爜鍔犲瘑
+ password = DataHelper.MD5Hex(password);
+
var client = new Model.GwClient();
client.ClientID = clientID;
client.Password = password;
-
+
client.ClientName = clientName;
client.Address = address;
client.Remark = remark;
@@ -304,12 +705,132 @@
client.Agent = agent;
client.PermissionData = permissionData;
client.ParentId = context.OperatorID;
-
- _Dao.Add(client);
+ client.Certification_Status = 1;
+ client.Company = company;
+ client.CustomerManager = customerManager;
+ client.Salesman = salesman;
+ client.SupportStaff = supportStaff;
+ client.FinancialStaff = financialStaff;
+ client.ChargeType = string.IsNullOrEmpty(chargeType) ? 0 : int.Parse(chargeType);
+ client.SmsStatusReport = string.IsNullOrEmpty(smsStatusReport) ? 0 : int.Parse(smsStatusReport);
+ client.MmsStatusReport = string.IsNullOrEmpty(mmsStatusReport) ? 0 : int.Parse(mmsStatusReport);
+
+ client.IsEnableWhite = string.IsNullOrEmpty(isEnableWhite) ? 0 : int.Parse(isEnableWhite);
+ client.IsEnableBlack = string.IsNullOrEmpty(isEnableBlack) ? 0 : int.Parse(isEnableBlack);
+ client.IsRemoteLoginNotice = string.IsNullOrEmpty(isRemoteLoginNotice) ? 0 : int.Parse(isRemoteLoginNotice);
+ client.IsMobileCaptcha = string.IsNullOrEmpty(isMobileCaptcha) ? 0 : int.Parse(isMobileCaptcha);
+ client.IsHideMobile = string.IsNullOrEmpty(isHideMobile) ? 0 : int.Parse(isHideMobile);
+ client.IsDisplayStatus = string.IsNullOrEmpty(isDisplayStatus) ? 0 : int.Parse(isDisplayStatus);
+ client.IsLoginIpRestrict = string.IsNullOrEmpty(isLoginIpRestrict) ? 0 : int.Parse(isLoginIpRestrict);
+ client.IsLoginIpAllowGather = isLoginIpAllowGather;
+ client.IsLoginCityRestrict = string.IsNullOrEmpty(isLoginCityRestrict) ? 0 : int.Parse(isLoginCityRestrict);
+ client.IsLoginCityAllowGather = isLoginCityAllowGather;
- return new JsonPageResult(true, "鍒涘缓瀹㈡埛鎴愬姛锛�");
+ _Dao.Add(client);//鎻掑叆鏁版嵁搴撱�傚垱寤鸿处鎴�
+
+ //淇濆瓨浜у搧璁板綍
+ //鑾峰彇鍚敤鐨勯粯璁ょ殑浜у搧
+ /**
+ //edit:鍦ㄥ鎴锋縺娲绘椂娣诲姞璁板綍
+ List<string> defaultProductList = GwProductDao.Instance.GetDefaultProduct();
+ if (defaultProductList.Count > 0)
+ {
+ foreach (string productId in defaultProductList)
+ {
+ GwClientProduct gcp = new GwClientProduct();
+ gcp.Id = Guid.NewGuid().ToString();
+ gcp.ClientId = clientID;
+ gcp.ProductId = productId;
+ GwClientProductDao.Instance.Add(gcp);
+ }
+ }
+ **/
+
+ return new JsonPageResult(true, "鍒涘缓璐︽埛鎴愬姛锛�");
}
-}
+
+ //鍒嗛厤瀹㈡埛鐨勪釜鎬т骇鍝�
+ private JsonPageResult BatchUpdateClientProduct(PageContext<SysUser> context)
+ {
+ string productId = context.GetString("productId");
+ string idArray = context.GetString("idArray");
+ if (string.IsNullOrEmpty(productId))
+ {
+
+ throw new ArgumentException("涓�т骇鍝佷笉鑳戒负绌猴紝璇烽�夋嫨锛�");
+ }
+
+ Model.GwProduct gwProduct = new GwProductDao().Get(productId);
+ if (gwProduct == null)
+ {
+ throw new ArgumentException("鎸囧畾鐨勪釜鎬т骇鍝佷笉瀛樺湪锛岃閲嶆柊閫夋嫨锛�");
+ }
+ string clientIds = gwProduct.ClientIds;
+
+ List<string> tmpList = new List<string>();
+ if(!string.IsNullOrEmpty(clientIds))
+ { //瀛楃涓茶浆鏁扮粍锛屽啀鏁扮粍鍚堝苟
+ tmpList.AddRange( clientIds.Split(',') );
+ }
+ //鏁扮粍鍚堝苟
+ tmpList.AddRange( JsonConvert.DeserializeObject<string[]>(context.GetString("idArray")) );
+
+ //鏁扮粍鍘婚噸
+ string[] tmpArray = DelRepeatData(tmpList.ToArray() );
+ clientIds = string.Join(",", tmpArray) ;
+
+ if (!string.IsNullOrEmpty(clientIds))
+ {
+ new GwProductDao().UpdateClientIds(clientIds, productId);
+ }
+
+
+ return new JsonPageResult(true, (object)"鎵归噺鍒嗛厤瀹㈡埛涓�т骇鍝佹垚鍔燂紒");
+ }
+
+ /// <summary>
+ /// 绉婚櫎鏁扮粍涓噸澶嶆暟鎹�
+ /// </summary>
+ /// <param name="array">闇�瑕侀櫎閲嶇殑鏁扮粍</param>
+ /// <returns>涓嶉噸澶嶆暟缁�</returns>
+ public static string[] DelRepeatData(string[] array)
+ {
+ return array.GroupBy(p => p).Select(p => p.Key).ToArray();
+ }
+
+
+
+ //鑾峰彇绠$悊绔处鎴峰垪琛�
+ private List<SysUser> SysUserList
+ {
+ get
+ {
+ if (this._SysUserList == null)
+ {
+
+ using (UserDao sysUserDao = new UserDao())
+ {
+ int recordCount = 0;
+ int int1 = 999999999;
+ int int2 = 1;
+ this._SysUserList = sysUserDao.LoadInfoList(out recordCount, int1, int2);
+ }
+ }
+ return this._SysUserList;
+ }
+ }
+
+ //绠$悊绔敤鎴稩D杞悕绉�
+ private string SysUserName(int userId)
+ {
+ if (this.SysUserList == null)
+ return string.Empty;
+ SysUser sysUser = this._SysUserList.Find((Predicate<SysUser>)(bean => bean.UserID == userId));
+ if (sysUser != null)
+ return string.Format("{0}", (object)sysUser.UserName);
+ return string.Empty;
+ }
+}
--
Gitblit v1.9.1