public void EditPassword(HttpContext context) { string callback = context.Request["jsoncallback"]; string oldpwd = context.Request["oldpwd"]; string useridcard = context.Request["useridcard"]; string pwd = context.Request["pwd"]; EmsModel.UserInfo user = new EmsBLL.UserInfo().GetModelByUserIdCard(useridcard); int result = 0; if (user != null) { if (user.PassWord != bll_com.Md5Encrypting(oldpwd)) { result = -1; } else { if (!string.IsNullOrEmpty(pwd)) { user.PassWord = bll_com.Md5Encrypting(pwd); user.UpdateTime = DateTime.Now; result = new EmsBLL.UserInfo().Update(user); } } } HttpContext.Current.Response.Write(callback + "({\"result\":" + result + "})"); HttpContext.Current.Response.End(); }
public void EditUserInfo(HttpContext context) { string callback = context.Request["jsoncallback"]; int userid = Convert.ToInt32(context.Request["itemid"]); string name = context.Request["name"]; string addloginname = context.Request["addloginname"]; int result; if (new EmsBLL.UserInfo().IsNameExists(addloginname, userid)) { result = -1; } else { EmsModel.UserInfo user = new EmsBLL.UserInfo().GetEmsModel(userid); string pwd = context.Request["pwd"]; user.Id = userid; user.LoginName = addloginname; if (!string.IsNullOrEmpty(pwd)) { user.PassWord = bll_com.Md5Encrypting(pwd); } user.Name = name; user.Sex = context.Request["sex"]; user.KaNo = context.Request["kano"]; user.IDCard = context.Request["idcard"]; user.Editor = context.Request["useridcard"]; user.UpdateTime = DateTime.Now; result = new EmsBLL.UserInfo().Update(user); } //输出Json HttpContext.Current.Response.Write(callback + "({\"result\":" + result + "})"); HttpContext.Current.Response.End(); }
public void AddUserInfo(HttpContext context) { string callback = context.Request["jsoncallback"]; string name = context.Request["name"]; string addloginname = context.Request["addloginname"]; int result; if (new EmsBLL.UserInfo().IsNameExists(addloginname)) { result = -1; } else { string pwd = bll_com.Md5Encrypting(context.Request["pwd"]); EmsModel.UserInfo user = new EmsModel.UserInfo(); user.LoginName = addloginname; user.PassWord = pwd; user.Name = name; user.Sex = context.Request["sex"]; user.KaNo = context.Request["kano"]; user.IDCard = context.Request["idcard"]; user.Creator = context.Request["useridcard"]; user.CreateTime = DateTime.Now; user.IsDelete = 0; user.UseStatus = 0; result = new EmsBLL.UserInfo().Add(user); } //输出Json HttpContext.Current.Response.Write(callback + "({\"result\":" + result + "})"); HttpContext.Current.Response.End(); }
public void GetModelByUserIdCard(HttpContext context) { string callback = context.Request["jsoncallback"]; string useridcard = context.Request["userIdCard"]; //序列化 System.Web.Script.Serialization.JavaScriptSerializer jss = new System.Web.Script.Serialization.JavaScriptSerializer(); EmsModel.UserInfo user = new EmsBLL.UserInfo().GetModelByUserIdCard(useridcard); //输出Json HttpContext.Current.Response.Write(callback + "({\"result\":" + jss.Serialize(user) + "})"); HttpContext.Current.Response.End(); }
public void GetModelById(HttpContext context) { string callback = context.Request["jsoncallback"]; int userid = Convert.ToInt32(context.Request["itemid"]); //序列化 System.Web.Script.Serialization.JavaScriptSerializer jss = new System.Web.Script.Serialization.JavaScriptSerializer(); EmsModel.UserInfo user = new EmsBLL.UserInfo().GetEmsModel(userid); //输出Json HttpContext.Current.Response.Write(callback + "({\"result\":" + jss.Serialize(user) + "})"); HttpContext.Current.Response.End(); }
public void DeleteUserInfo(HttpContext context) { string callback = context.Request["jsoncallback"]; int userid = Convert.ToInt32(context.Request["intID"]); EmsModel.UserInfo user = new EmsBLL.UserInfo().GetEmsModel(userid); user.Id = userid; user.IsDelete = 1; int result = new EmsBLL.UserInfo().Update(user); //输出Json HttpContext.Current.Response.Write(callback + "({\"result\":" + result + "})"); HttpContext.Current.Response.End(); }
public void GetData(HttpContext context) { string callback = context.Request["jsoncallback"]; string name = context.Request["name"]; EmsModel.UserInfo user = new EmsModel.UserInfo(); if (!string.IsNullOrEmpty(name)) { user.Name = name; } //序列化 System.Web.Script.Serialization.JavaScriptSerializer jss = new System.Web.Script.Serialization.JavaScriptSerializer(); EmsModel.JsonModel mod = new EmsBLL.UserInfo().GetJsonModel(user); //输出Json HttpContext.Current.Response.Write(callback + "({\"result\":" + jss.Serialize(mod) + "})"); HttpContext.Current.Response.End(); }
/// <summary> /// 导入教师信息 /// </summary> /// <returns></returns> public void ImportTeacher(HttpContext context) { EmsBLL.UserInfo BLL = new EmsBLL.UserInfo(); string callback = context.Request["jsoncallback"]; Hashtable ht = new Hashtable(); ht.Add("Creator", context.Request["Creator"].ToString()); ht.Add("FilePath", context.Request["FilePath"].ToString()); ht.Add("UseStatus", System.Configuration.ConfigurationManager.ConnectionStrings["DefaultUserStatus"].ConnectionString); ht.Add("Password", System.Configuration.ConfigurationManager.ConnectionStrings["InitialPassword"].ConnectionString); ht.Add("RoleId", System.Configuration.ConfigurationManager.ConnectionStrings["RoleId"].ConnectionString); EmsModel.JsonModel Model = BLL.ImportTeacher(ht); System.Web.Script.Serialization.JavaScriptSerializer jss = new System.Web.Script.Serialization.JavaScriptSerializer(); //jss.Serialize(ModelPlan); HttpContext.Current.Response.Write(callback + "({\"result\":" + jss.Serialize(Model) + "})"); HttpContext.Current.Response.End(); }
public void Login(HttpContext context) { string callback = context.Request["jsoncallback"]; string loginName = context.Request["loginName"]; string passWord = bll_com.Md5Encrypting(context.Request["passWord"]); //序列化 System.Web.Script.Serialization.JavaScriptSerializer jss = new System.Web.Script.Serialization.JavaScriptSerializer(); EmsModel.UserInfo user = new EmsBLL.UserInfo().IsLogin(loginName, passWord); string result = ""; if (user != null) { result = user.Id + "," + user.LoginName + "," + user.Name + "," + user.Sex + "," + user.KaNo + "," + user.IDCard + "," + user.KaLv + "," + user.UseStatus + "," + user.RoleId + "," + user.RoleName + "," + user.WarehouseId + "," + user.WarehouseName; } //输出Json HttpContext.Current.Response.Write(callback + "({\"result\":'" + result + "',\"usestatus\":'" + (user != null ? user.UseStatus.ToString() : "") + "'})"); HttpContext.Current.Response.End(); }
public void GetDataPage(HttpContext context) { string callback = context.Request["jsoncallback"]; //当前页 int startIndex = Convert.ToInt32(context.Request["startIndex"]); //页容量 int pageSize = Convert.ToInt32(context.Request["pageSize"]); string name = context.Request["name"]; EmsModel.UserInfo user = new EmsModel.UserInfo(); if (!string.IsNullOrEmpty(name)) { user.Name = name; } user.IsDelete = 0; //序列化 System.Web.Script.Serialization.JavaScriptSerializer jss = new System.Web.Script.Serialization.JavaScriptSerializer(); EmsModel.JsonModel mod = new EmsBLL.UserInfo().GetJsonModel(user, startIndex, pageSize, "", ""); //输出Json HttpContext.Current.Response.Write(callback + "({\"result\":" + jss.Serialize(mod) + "})"); HttpContext.Current.Response.End(); }