private string updateaction(JsonArrayParse jp) { JsonObjectCollection collection = new JsonObjectCollection(); string flag = "1"; string result = "";; try { Business.Sys.BusinessUserType bc = new project.Business.Sys.BusinessUserType(); bc.load(jp.getValue("id"), user.Entity.AccID); collection.Add(new JsonStringValue("UserTypeNo", bc.Entity.UserTypeNo)); collection.Add(new JsonStringValue("UserTypeName", bc.Entity.UserTypeName)); collection.Add(new JsonStringValue("OrderType", bc.Entity.OrderType)); collection.Add(new JsonStringValue("OrderTypeName", bc.Entity.OrderTypeName)); } 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.BusinessUserType bc = new project.Business.Sys.BusinessUserType(); if (jp.getValue("tp") == "update") { bc.load(jp.getValue("id"), user.Entity.AccID); bc.Entity.UserTypeName = jp.getValue("UserTypeName"); bc.Entity.OrderType = jp.getValue("OrderType"); bc.Entity.OrderTypeName = jp.getValue("OrderTypeName"); int r = bc.Save("update"); if (r <= 0) { flag = "2"; } } else { Data obj = new Data(); DataTable dt = obj.ExecuteDataSet("select 1 from Sys_User_Type where UserTypeNo=N'" + jp.getValue("UserTypeNo") + "' and AccID='" + user.Entity.AccID + "'").Tables[0]; if (dt.Rows.Count > 0) { flag = "3"; } else { bc.Entity.UserTypeNo = jp.getValue("UserTypeNo"); bc.Entity.UserTypeName = jp.getValue("UserTypeName"); bc.Entity.OrderType = jp.getValue("OrderType"); bc.Entity.OrderTypeName = jp.getValue("OrderTypeName"); bc.Entity.AccID = user.Entity.AccID; int r = bc.Save("insert"); 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())); 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(); } }
protected override void Page_Load(object sender, EventArgs e) { try { HttpCookie hc = getCookie("1"); if (hc != null) { string str = hc.Value.Replace("%3D", "="); userid = Encrypt.DecryptDES(str, "1"); user.load(userid); CheckRight(user.Entity, "pm/Platform/UserInfo.aspx"); if (!Page.IsCallback) { list = createList(string.Empty, string.Empty); userType = "<select class=\"input-text required\" id=\"UserType\" data-valid=\"isNonEmpty\" data-error=\"请选择用户类型\">"; userType += "<option value=\"\" selected>请选择用户类型</option>"; Business.Sys.BusinessUserType tp = new project.Business.Sys.BusinessUserType(); foreach (Entity.Sys.EntityUserType it in tp.GetUserTypeListQuery(string.Empty, string.Empty, user.Entity.AccID, string.Empty)) { userType += "<option value='" + it.UserTypeNo + "'>" + it.UserTypeName + "</option>"; } userType += "</select>"; dept = "<select class=\"input-text required\" id=\"DeptNo\" data-valid=\"isNonEmpty\" data-error=\"请选择部门\">"; dept += "<option value=\"\" selected>请选择部门</option>"; Business.Sys.BusinessDept dt = new project.Business.Sys.BusinessDept(); foreach (Entity.Sys.EntityDept it in dt.GetDeptListQuery(string.Empty, string.Empty, user.Entity.AccID, string.Empty)) { dept += "<option value='" + it.DeptNo + "'>" + it.DeptName + "</option>"; } dept += "</select>"; } } else { GotoErrorPage(); } } catch { GotoErrorPage(); } }
private string deleteaction(JsonArrayParse jp) { JsonObjectCollection collection = new JsonObjectCollection(); string flag = "1"; try { if (jp.getValue("id").ToUpper() == "ADMIN") { flag = "4"; } else { Business.Sys.BusinessUserType bc = new project.Business.Sys.BusinessUserType(); bc.load(jp.getValue("id"), user.Entity.AccID); if (obj.ExecuteDataSet("select 1 from Sys_User_Info where UserType='" + bc.Entity.UserTypeNo + "' and AccID='" + user.Entity.AccID + "'").Tables[0].Rows.Count > 0) { 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())); 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", "="); userid = Encrypt.DecryptDES(str, "1"); user.load(userid); CheckRight(user.Entity, "pm/Platform/UserInfo.aspx"); if (!Page.IsCallback) { if (user.Entity.UserType.ToUpper() != "ADMIN") { string sqlstr = "select a.RightCode from Sys_UserRight a left join sys_menu b on a.MenuId=b.MenuID " + "where a.UserType='" + user.Entity.UserType + "' and menupath='pm/Platform/UserType.aspx'"; DataTable dt = obj.PopulateDataSet(sqlstr).Tables[0]; if (dt.Rows.Count > 0) { string rightCode = dt.Rows[0]["RightCode"].ToString(); if (rightCode.IndexOf("insert") >= 0) { Buttons += "<a href=\"javascript:;\" onclick=\"insert()\" class=\"btn btn-primary radius\"><i class=\"Hui-iconfont\"></i> 添加</a> "; } if (rightCode.IndexOf("update") >= 0) { Buttons += "<a href=\"javascript:;\" onclick=\"update()\" class=\"btn btn-primary radius\"><i class=\"Hui-iconfont\"></i> 修改</a> "; } if (rightCode.IndexOf("delete") >= 0) { Buttons += "<a href=\"javascript:;\" onclick=\"del()\" class=\"btn btn-danger radius\"><i class=\"Hui-iconfont\"></i> 删除</a> "; } if (rightCode.IndexOf("newpassword") >= 0) { Buttons += "<a href=\"javascript:;\" onclick=\"newpassword()\" class=\"btn btn-primary radius\"><i class=\"Hui-iconfont\"></i> 生成新密码</a> "; } if (rightCode.IndexOf("valid") >= 0) { Buttons += "<a href=\"javascript:;\" onclick=\"valid()\" class=\"btn btn-primary radius\"><i class=\"Hui-iconfont\"></i> 启用/停用</a> "; } } } else { Buttons += "<a href=\"javascript:;\" onclick=\"insert()\" class=\"btn btn-primary radius\"><i class=\"Hui-iconfont\"></i> 添加</a> "; Buttons += "<a href=\"javascript:;\" onclick=\"update()\" class=\"btn btn-primary radius\"><i class=\"Hui-iconfont\"></i> 修改</a> "; Buttons += "<a href=\"javascript:;\" onclick=\"del()\" class=\"btn btn-danger radius\"><i class=\"Hui-iconfont\"></i> 删除</a> "; Buttons += "<a href=\"javascript:;\" onclick=\"newpassword()\" class=\"btn btn-primary radius\"><i class=\"Hui-iconfont\"></i> 生成新密码</a> "; Buttons += "<a href=\"javascript:;\" onclick=\"valid()\" class=\"btn btn-primary radius\"><i class=\"Hui-iconfont\"></i> 启用/停用</a> "; } list = createList(string.Empty, string.Empty); userType = "<select class=\"input-text required\" id=\"UserType\" data-valid=\"isNonEmpty\" data-error=\"请选择用户角色\">"; userType += "<option value=\"\" selected>请选择用户角色</option>"; Business.Sys.BusinessUserType tp = new project.Business.Sys.BusinessUserType(); foreach (Entity.Sys.EntityUserType it in tp.GetUserTypeListQuery(string.Empty, string.Empty)) { userType += "<option value='" + it.UserTypeNo + "'>" + it.UserTypeName + "</option>"; } userType += "</select>"; } } 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; } }