private string submitaction(JsonArrayParse jp) { JsonObjectCollection collection = new JsonObjectCollection(); string flag = "1"; try { Business.Sys.BusinessUserInfo bu = new project.Business.Sys.BusinessUserInfo(); bu.load(userid); if (bu.Entity.Password == Encrypt.EncryptDES(jp.getValue("oldpwd"), "1")) { bu.Entity.Password = Encrypt.EncryptDES(jp.getValue("newpwd"), "1"); bu.changepwd(); } else { flag = "3"; } } catch { flag = "2"; } collection.Add(new JsonStringValue("type", "submit")); collection.Add(new JsonStringValue("flag", flag)); return(collection.ToString()); }
private string newpasswordaction(JsonArrayParse jp) { JsonObjectCollection collection = new JsonObjectCollection(); string flag = "1"; try { Business.Sys.BusinessUserInfo bc = new project.Business.Sys.BusinessUserInfo(); bc.load(jp.getValue("id")); string newpwd = getRandom(); bc.Entity.Password = Encrypt.EncryptDES(newpwd, "1"); int r = bc.changepwd(); if (r <= 0) { flag = "2"; } collection.Add(new JsonStringValue("type", "newpassword")); collection.Add(new JsonStringValue("flag", flag)); collection.Add(new JsonStringValue("newpassword", newpwd)); } catch { flag = "2"; } return(collection.ToString()); }
private string validaction(JsonArrayParse jp) { JsonObjectCollection collection = new JsonObjectCollection(); string flag = "1"; try { Business.Sys.BusinessUserInfo bc = new project.Business.Sys.BusinessUserInfo(); bc.load(jp.getValue("id")); bc.Entity.Valid = !bc.Entity.Valid; int r = bc.valid(); if (r <= 0) { flag = "2"; } if (bc.Entity.Valid) { collection.Add(new JsonStringValue("stat", "<span class=\"label label-success radius\">有效</span>")); } else { collection.Add(new JsonStringValue("stat", "<span class=\"label radius\">已失效</span>")); } collection.Add(new JsonStringValue("id", jp.getValue("id"))); } catch { flag = "2"; } collection.Add(new JsonStringValue("flag", flag)); collection.Add(new JsonStringValue("type", "valid")); return(collection.ToString()); }
private string deleteaction(JsonArrayParse jp) { JsonObjectCollection collection = new JsonObjectCollection(); string flag = "1"; try { Business.Sys.BusinessUserInfo bc = new project.Business.Sys.BusinessUserInfo(); bc.load(jp.getValue("id")); if (bc.Entity.UserNo.ToUpper() == "ADMIN") { flag = "3"; } else { int r = bc.delete(); if (r <= 0) { flag = "2"; } } } catch { flag = "2"; } collection.Add(new JsonStringValue("type", "delete")); collection.Add(new JsonStringValue("flag", flag)); collection.Add(new JsonStringValue("liststr", createList(string.Empty, jp.getValue("UserNameS")))); return(collection.ToString()); }
private string updateaction(JsonArrayParse jp) { JsonObjectCollection collection = new JsonObjectCollection(); string flag = "1"; string result = "";; try { Business.Sys.BusinessUserInfo bc = new project.Business.Sys.BusinessUserInfo(); bc.load(jp.getValue("id")); collection.Add(new JsonStringValue("UserNo", bc.Entity.UserNo)); collection.Add(new JsonStringValue("UserName", bc.Entity.UserName)); collection.Add(new JsonStringValue("UserType", bc.Entity.UserType)); collection.Add(new JsonStringValue("DeptNo", bc.Entity.DeptNo)); collection.Add(new JsonStringValue("Tel", bc.Entity.Tel)); collection.Add(new JsonStringValue("Email", bc.Entity.Email)); collection.Add(new JsonStringValue("Addr", bc.Entity.Addr)); collection.Add(new JsonStringValue("Manager", bc.Entity.Manager)); collection.Add(new JsonStringValue("ManagerName", bc.Entity.ManagerName)); collection.Add(new JsonStringValue("Picture", bc.Entity.Picture)); } catch { flag = "2"; } collection.Add(new JsonStringValue("type", "update")); collection.Add(new JsonStringValue("flag", flag)); result = collection.ToString(); return(result); }
protected override void Page_Load(object sender, EventArgs e) { try { HttpCookie hc = getCookie("1"); if (hc != null) { string str = hc.Value.Replace("%3D", "="); string userid = Encrypt.DecryptDES(str, "1"); user = new project.Business.Sys.BusinessUserInfo(); user.load(userid); if (user.Entity.UserType.ToUpper() != "ADMIN") { Response.Write(errorpage); return; } if (!Page.IsCallback) { string firsttype = ""; TypeStr = "<select id='UserType' class='input-text' style='width:120px;'>"; Business.Sys.BusinessUserType bu = new project.Business.Sys.BusinessUserType(); foreach (Entity.Sys.EntityUserType it in bu.GetUserTypeListQuery(string.Empty, string.Empty)) { if (it.UserTypeNo.ToUpper() == "ADMIN") { continue; } if (firsttype == "") { firsttype = it.UserTypeNo; TypeStr += "<option value='" + it.UserTypeNo + "' selected='selected'>" + it.UserTypeName + "</option>"; } else { TypeStr += "<option value='" + it.UserTypeNo + "'>" + it.UserTypeName + "</option>"; } } TypeStr += "</select>"; list = createList(firsttype); } } else { Response.Write("<script type='text/javascript'>window.parent.window.location.href='../../login.aspx';</script>"); return; } } catch { Response.Write("<script type='text/javascript'>window.parent.window.location.href='../../login.aspx';</script>"); return; } }
private string submitaction(JsonArrayParse jp) { JsonObjectCollection collection = new JsonObjectCollection(); string flag = "1"; try { Business.Sys.BusinessUserInfo bc = new project.Business.Sys.BusinessUserInfo(); if (jp.getValue("tp") == "update") { bc.load(jp.getValue("id")); bc.Entity.UserName = jp.getValue("UserName"); bc.Entity.UserType = jp.getValue("UserType"); bc.Entity.Tel = jp.getValue("Tel"); bc.Entity.Addr = jp.getValue("Addr"); bc.Entity.Email = jp.getValue("Email"); int r = bc.Save(); if (r <= 0) { flag = "2"; } } else { Data obj = new Data(); DataTable dt = obj.PopulateDataSet("select cnt=COUNT(*) from Sys_UserInfo where UserNo='" + jp.getValue("UserNo") + "'").Tables[0]; if (int.Parse(dt.Rows[0]["cnt"].ToString()) > 0) { flag = "3"; } else { bc.Entity.UserNo = jp.getValue("UserNo"); bc.Entity.UserName = jp.getValue("UserName"); bc.Entity.UserType = jp.getValue("UserType"); bc.Entity.Tel = jp.getValue("Tel"); bc.Entity.Addr = jp.getValue("Addr"); bc.Entity.Email = jp.getValue("Email"); bc.Entity.Valid = true; bc.Entity.RegDate = GetDate(); bc.Entity.Password = Encrypt.EncryptDES("123456", "1"); int r = bc.Save(); if (r <= 0) { flag = "2"; } } } } catch { flag = "2"; } collection.Add(new JsonStringValue("type", "submit")); collection.Add(new JsonStringValue("flag", flag)); collection.Add(new JsonStringValue("liststr", createList(string.Empty, jp.getValue("UserNameS")))); return(collection.ToString()); }
protected override void Page_Load(object sender, EventArgs e) { try { HttpCookie hc = getCookie("1"); if (hc != null) { string str = hc.Value.Replace("%3D", "="); string userid = Encrypt.DecryptDES(str, "1"); user = new project.Business.Sys.BusinessUserInfo(); user.load(userid); if (user.Entity.UserType.ToUpper() != "ADMIN") { GotoNoRightsPage(); } if (!Page.IsCallback) { string firsttype = ""; TypeStr = "<select id='UserType' class='input-text' style='width:120px;'>"; Business.Sys.BusinessUserType bu = new project.Business.Sys.BusinessUserType(); foreach (Entity.Sys.EntityUserType it in bu.GetUserTypeListQuery(string.Empty, string.Empty, user.Entity.AccID, string.Empty)) { if (firsttype == "") { firsttype = it.UserTypeNo; TypeStr += "<option value='" + it.UserTypeNo + "' selected='selected'>" + it.UserTypeName + "</option>"; } else { TypeStr += "<option value='" + it.UserTypeNo + "'>" + it.UserTypeName + "</option>"; } } TypeStr += "</select>"; list = createList(firsttype); } } else { GotoErrorPage(); } } catch { GotoErrorPage(); } }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; try { HttpCookie hc = context.Request.Cookies["__WORKORDER__SYSTEM__GUID__"]; if (hc != null) { string str = hc.Value.Replace("%3D", "="); string userid = Encrypt.DecryptDES(str, "1"); user.load(userid); string username = user.Entity.UserName; string action = context.Request["action"]; if (action == "upload") { upload(context); } else if (action == "uploadpic") { uploadpic(context); } } else { JsonObjectCollection collection = new JsonObjectCollection(); collection.Add(new JsonNumericValue("retCode", 100)); context.Response.Write(collection.ToString()); } } catch { JsonObjectCollection collection = new JsonObjectCollection(); collection.Add(new JsonNumericValue("retCode", 100)); context.Response.Write(collection.ToString()); } }