You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
257 lines
11 KiB
C#
257 lines
11 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Text;
|
|
using System.Text.RegularExpressions;
|
|
using System.Web;
|
|
using DSWebMobileService;
|
|
using DSWebMobileService.Common;
|
|
using Newtonsoft.Json;
|
|
|
|
namespace DSWebMobile.Handler
|
|
{
|
|
/// <summary>
|
|
/// UserInfo 的摘要说明
|
|
/// </summary>
|
|
public class UserInfo : IHttpHandler, System.Web.SessionState.IRequiresSessionState
|
|
{
|
|
|
|
public void ProcessRequest(HttpContext context)
|
|
{
|
|
string action = context.Request.QueryString["action"].ToString();
|
|
switch (action)
|
|
{
|
|
case "0":
|
|
GetUserInfo(context);
|
|
break;
|
|
case "1":
|
|
SetUserInfo(context);
|
|
break;
|
|
case "2":
|
|
GetUserID(context);
|
|
break;
|
|
case "3":
|
|
GetUserInformation(context);
|
|
break;
|
|
}
|
|
}
|
|
|
|
private void GetUserInformation(HttpContext context)
|
|
{
|
|
string relUserName = "";
|
|
string relPassword = "";
|
|
string userName = Encrypt.DesDecrypt("#7c&e@63", context.Request.QueryString["u"].ToString());
|
|
string password = Encrypt.DesDecrypt("#7c&e@63", context.Request.QueryString["w"].ToString());
|
|
|
|
string pattern = "\0";
|
|
string replacement = "";
|
|
|
|
Regex rgx = new Regex(pattern);
|
|
relUserName = rgx.Replace(userName, replacement);
|
|
relPassword = rgx.Replace(password, replacement);
|
|
pattern = "\t";
|
|
Regex rgx2 = new Regex(pattern);
|
|
relUserName = rgx2.Replace(relUserName, replacement);
|
|
relPassword = rgx2.Replace(relPassword, replacement);
|
|
|
|
UserInfomationModule _user = new UserInfomationModule();
|
|
_user.CodeName = relUserName;
|
|
_user.Password = relPassword;
|
|
|
|
DataTable dt = UserServer.LoginUserInfo(_user);
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
if (dt.Rows.Count == 0) { sb.Append("[{\"GID\":\"\"}]"); }
|
|
else { sb.Append(JsonConvert.SerializeObject(dt)); }
|
|
context.Response.ContentType = "text/plain";
|
|
context.Response.Write(sb.ToString());
|
|
context.Response.End();
|
|
}
|
|
|
|
private void GetUserID(HttpContext context)
|
|
{
|
|
/*string relCodeName = "";
|
|
|
|
string codeName = Common.Encrypt.DesDecrypt("#7c&e@63", context.Request.QueryString["c"].ToString());
|
|
string pattern = "\0";
|
|
string replacement = "";
|
|
|
|
Regex rgx = new Regex(pattern);
|
|
relCodeName = rgx.Replace(codeName, replacement);
|
|
pattern = "\t";
|
|
Regex rgx2 = new Regex(pattern);
|
|
relCodeName = rgx2.Replace(relCodeName, replacement);
|
|
|
|
UserInfomationModule _user = new UserInfomationModule();
|
|
_user.CodeName = relCodeName;
|
|
|
|
DataTable dt = UserServer.GetUserID(_user);*/
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
sb.Append("[{\"GID\":\"" + SessionUtil.Session["USERID"].ToString() + "\"}]");
|
|
context.Response.ContentType = "text/plain";
|
|
context.Response.Write(sb.ToString());
|
|
context.Response.End();
|
|
}
|
|
|
|
private void SetUserInfo(HttpContext context)
|
|
{
|
|
string relCodeName = "";
|
|
string relPassword = "";
|
|
string relShowName = "";
|
|
string relNewPassword = "";
|
|
string relQQ = "";
|
|
string relMSN = "";
|
|
string relOfficePhone = "";
|
|
string relHomePhone = "";
|
|
string relMobile = "";
|
|
string relFax = "";
|
|
string relEmail = "";
|
|
string relEmailBackup = "";
|
|
string relHomeAddress = "";
|
|
string relRemark = "";
|
|
string relEmergUser = "";
|
|
string relEmergPhone = "";
|
|
string relEmergEmail = "";
|
|
string relPostcode = "";
|
|
|
|
string codeName = Encrypt.DesDecrypt("#7c&e@63", context.Request.Form["codeName"].ToString());
|
|
string password = Encrypt.DesDecrypt("#7c&e@63", context.Request.Form["password"].ToString());
|
|
string showName = Encrypt.DesDecrypt("#7c&e@63", context.Request.Form["showName"].ToString());
|
|
string newPassword = Encrypt.DesDecrypt("#7c&e@63", context.Request.Form["newPassword"].ToString());
|
|
string qq = Encrypt.DesDecrypt("#7c&e@63", context.Request.Form["qq"].ToString());
|
|
string msn = Encrypt.DesDecrypt("#7c&e@63", context.Request.Form["msn"].ToString());
|
|
string officePhone = Encrypt.DesDecrypt("#7c&e@63", context.Request.Form["officePhone"].ToString());
|
|
string homePhone = Encrypt.DesDecrypt("#7c&e@63", context.Request.Form["homePhone"].ToString());
|
|
string mobile = Encrypt.DesDecrypt("#7c&e@63", context.Request.Form["mobile"].ToString());
|
|
string fax = Encrypt.DesDecrypt("#7c&e@63", context.Request.Form["fax"].ToString());
|
|
string email = Encrypt.DesDecrypt("#7c&e@63", context.Request.Form["email"].ToString());
|
|
string emailBackup = Encrypt.DesDecrypt("#7c&e@63", context.Request.Form["emailBackup"].ToString());
|
|
string homeAddress = Encrypt.DesDecrypt("#7c&e@63", context.Request.Form["homeAddress"].ToString());
|
|
string remark = Encrypt.DesDecrypt("#7c&e@63", context.Request.Form["remark"].ToString());
|
|
string emergUser = Encrypt.DesDecrypt("#7c&e@63", context.Request.Form["emergUser"].ToString());
|
|
string emergPhone = Encrypt.DesDecrypt("#7c&e@63", context.Request.Form["emergPhone"].ToString());
|
|
string emergEmail = Encrypt.DesDecrypt("#7c&e@63", context.Request.Form["emergEmail"].ToString());
|
|
string postcode = Encrypt.DesDecrypt("#7c&e@63", context.Request.Form["postcode"].ToString());
|
|
|
|
string pattern = "\0";
|
|
string replacement = "";
|
|
|
|
Regex rgx = new Regex(pattern);
|
|
relCodeName = rgx.Replace(codeName, replacement);
|
|
relPassword = rgx.Replace(password, replacement);
|
|
relShowName = rgx.Replace(showName, replacement);
|
|
relNewPassword = rgx.Replace(newPassword, replacement);
|
|
relQQ = rgx.Replace(qq, replacement);
|
|
relMSN = rgx.Replace(msn, replacement);
|
|
relOfficePhone = rgx.Replace(officePhone, replacement);
|
|
relHomePhone = rgx.Replace(homePhone, replacement);
|
|
relMobile = rgx.Replace(mobile, replacement);
|
|
relFax = rgx.Replace(fax, replacement);
|
|
relEmail = rgx.Replace(email, replacement);
|
|
relEmailBackup = rgx.Replace(emailBackup, replacement);
|
|
relHomeAddress = rgx.Replace(homeAddress, replacement);
|
|
relRemark = rgx.Replace(remark, replacement);
|
|
relEmergUser = rgx.Replace(emergUser, replacement);
|
|
relEmergPhone = rgx.Replace(emergPhone, replacement);
|
|
relEmergEmail = rgx.Replace(emergEmail, replacement);
|
|
relPostcode = rgx.Replace(postcode, replacement);
|
|
pattern = "\t";
|
|
Regex rgx2 = new Regex(pattern);
|
|
relCodeName = rgx2.Replace(relCodeName, replacement);
|
|
relPassword = rgx2.Replace(relPassword, replacement);
|
|
relShowName = rgx2.Replace(relShowName, replacement);
|
|
relNewPassword = rgx2.Replace(relNewPassword, replacement);
|
|
relQQ = rgx2.Replace(relQQ, replacement);
|
|
relMSN = rgx2.Replace(relMSN, replacement);
|
|
relOfficePhone = rgx2.Replace(relOfficePhone, replacement);
|
|
relHomePhone = rgx2.Replace(relHomePhone, replacement);
|
|
relMobile = rgx2.Replace(relMobile, replacement);
|
|
relFax = rgx2.Replace(relFax, replacement);
|
|
relEmail = rgx2.Replace(relEmail, replacement);
|
|
relEmailBackup = rgx2.Replace(relEmailBackup, replacement);
|
|
relHomeAddress = rgx2.Replace(relHomeAddress, replacement);
|
|
relRemark = rgx2.Replace(relRemark, replacement);
|
|
relEmergUser = rgx2.Replace(relEmergUser, replacement);
|
|
relEmergPhone = rgx2.Replace(relEmergPhone, replacement);
|
|
relEmergEmail = rgx2.Replace(relEmergEmail, replacement);
|
|
relPostcode = rgx2.Replace(relPostcode, replacement);
|
|
|
|
UserInfomationModule _user = new UserInfomationModule();
|
|
_user.CodeName = relCodeName;
|
|
_user.Password = relPassword;
|
|
UserInfomationModule _modify = new UserInfomationModule();
|
|
_modify.ShowName = relShowName;
|
|
_modify.Password = relNewPassword;
|
|
_modify.QQ = relQQ;
|
|
_modify.MSN = relMSN;
|
|
_modify.OfficePhone = relOfficePhone;
|
|
_modify.HomePhone = relHomePhone;
|
|
_modify.Mobile = relMobile;
|
|
_modify.Fax = relFax;
|
|
_modify.Email = relEmail;
|
|
_modify.EmailBackup = relEmailBackup;
|
|
_modify.HomeAddress = relHomeAddress;
|
|
_modify.Remark = relRemark;
|
|
_modify.EmergUser = relEmergUser;
|
|
_modify.EmergPhone = relEmergPhone;
|
|
_modify.EmergEmail = relEmergEmail;
|
|
_modify.PostCode = relPostcode;
|
|
|
|
bool succ = UserServer.UpdateUserInfo(_user, _modify);
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
if (!succ) { sb.Append("[{\"result\":\"fail\"}]"); }
|
|
else { sb.Append("[{\"result\":\"success\"}]"); }
|
|
context.Response.ContentType = "text/plain";
|
|
context.Response.Write(sb.ToString());
|
|
context.Response.End();
|
|
}
|
|
|
|
private void GetUserInfo(HttpContext context)
|
|
{
|
|
string relUserName = "";
|
|
string relPassword = "";
|
|
string userName = Encrypt.DesDecrypt("#7c&e@63", context.Request.QueryString["u"].ToString());
|
|
string password = Encrypt.DesDecrypt("#7c&e@63", context.Request.QueryString["w"].ToString());
|
|
string _userName = SessionUtil.Session["SHOWNAME"].ToString();
|
|
string _password = SessionUtil.Session["Password"].ToString();
|
|
string _year = DateTime.Today.Year.ToString();
|
|
string _month = DateTime.Today.Month.ToString();
|
|
string _day = DateTime.Today.Day.ToString();
|
|
string _hours = DateTime.Now.Hour.ToString();
|
|
|
|
string pattern = "\0";
|
|
string replacement = "";
|
|
|
|
Regex rgx = new Regex(pattern);
|
|
relUserName = rgx.Replace(userName, replacement);
|
|
relPassword = rgx.Replace(password, replacement);
|
|
pattern = "\t";
|
|
Regex rgx2 = new Regex(pattern);
|
|
relUserName = rgx2.Replace(relUserName, replacement);
|
|
relPassword = rgx2.Replace(relPassword, replacement);
|
|
|
|
UserInfomationModule _user = new UserInfomationModule();
|
|
_user.CodeName = relUserName;
|
|
_user.Password = relPassword;
|
|
|
|
DataTable dt = UserServer.LoginUserInfo(_user);
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
if (dt.Rows.Count == 0) { sb.Append("[{\"GID\":\"\"}]"); }
|
|
else { sb.Append(JsonConvert.SerializeObject(dt)); }
|
|
context.Response.ContentType = "text/plain";
|
|
context.Response.Write(sb.ToString());
|
|
context.Response.End();
|
|
}
|
|
|
|
public bool IsReusable
|
|
{
|
|
get
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
} |