public string GetAdminPurviewInfo(string iAdminID) { if (string.IsNullOrEmpty(iAdminID)) { return(WebExport.ExportSuccess("iAdminID!")); } DataTable DT; string ErrInfo = ""; bool IsOk = APP.SQLServer_PingTai.GetDataTable("select * from V_P_Admin where iAdminID=" + iAdminID.Trim(), out DT, out ErrInfo); //执行完成返回 if (IsOk) { if (DT.Rows.Count > 0) { string Sql = "SELECT distinct [iFunID] ,[cFunName],iFunFatherID,cFunMenuOrder FROM [V_P_FunPurview] where (iPurviewID =" + iAdminID.Trim() + " and iPurviewType=1) or (iPurviewID =" + DT.Rows[0]["iRoleID"].ToString() + " and iPurviewType=2) or (iPurviewID =" + DT.Rows[0]["iDeptID"].ToString() + " and iPurviewType=3)"; DataTable DT2; IsOk = APP.SQLServer_PingTai.GetDataTable(Sql, out DT2, out ErrInfo); if (IsOk) { StringBuilder listStr = new StringBuilder(); bool[] arrShowLine = new bool[10]; listStr.Append("[{\"id\":0,\"text\":\"APP系统\",\"children\":"); listStr.Append(getChidrenTree(DT2, "1000016", 0, false, "iFunFatherID", "cFunMenuOrder", " asc", arrShowLine)); listStr.Append("}]"); return(listStr.ToString()); } else { return(WebExport.ExportErrMsg("权限获取中用户权限信息失败!" + ErrInfo)); } } else { return(WebExport.ExportErrMsg("权限获取中没有查询到用户信息!")); } } else { return(WebExport.ExportErrMsg("权限获取中用户信息失败!")); } }
public override void Ashx_Load() { Context.Response.ContentType = "text/plain"; Context.Response.AddHeader("Access-Control-Allow-Origin", "*"); Context.Response.AddHeader("Access-Control-Allow-Methods", "POST"); Context.Response.AddHeader("Access-Control-Max-Ag", "1000"); string actionType = ""; //string retStr = "";//返回值 string ErrInfo = string.Empty; string sqlStr = ""; CheckRequery.checkNotNull("actionType", "类型不能为空!", out actionType); string id = ""; string personName = ""; string personTelphone = ""; string deptID = ""; string personPassword = ""; string deptName = ""; string roleId = ""; CheckRequery.check("deptID", out deptID); CheckRequery.checkNotNull("id", "不能为空!", out id); CheckRequery.check("personName", out personName); CheckRequery.check("personTelphone", out personTelphone); CheckRequery.check("roleId", out roleId); switch (actionType) { //添加一个人员 case "ADD": CheckRequery.check("personPassword", out personPassword); CheckRequery.check("deptName", out deptName); sqlStr = "INSERT INTO L_Person( PersonName, Telephone, DepartmentId, PersonId, PassWord,iRoleID,DeleteStatus )VALUES ( '" + personName + "','" + personTelphone + "','" + deptID + "','" + id + "','" + personPassword + "','" + roleId + "','0')"; int m = APP.SQLServer_Helper.UpDate(sqlStr, out ErrInfo); if (!string.IsNullOrEmpty(ErrInfo)) { Context.Response.Write(WebExport.ExportErrMsg("添加失败,请检查数据!")); } if (m > 0) { Context.Response.Write(WebExport.ExportSuccess("添加成功!")); } break; //删除一个人员 case "DEL": //sqlStr = "delete from L_Person where PersonId = " + id + ""; sqlStr = " UPDATE dbo.L_Person SET DeleteStatus='1' WHERE PersonId='" + id + "'"; int d = APP.SQLServer_Helper.UpDate(sqlStr, out ErrInfo); if (!string.IsNullOrEmpty(ErrInfo)) { Context.Response.Write(WebExport.ExportErrMsg("删除失败,请检查数据!")); } if (d > 0) { Context.Response.Write(WebExport.ExportSuccess("删除成功!")); } break; //更新人员 case "MODIFY": sqlStr = "update L_Person set PersonName = '" + personName + "',Telephone='" + personTelphone + "',DepartmentId='" + deptID + "',iRoleID = '" + roleId + "' where PersonId=" + id + ""; int update1 = APP.SQLServer_Helper.UpDate(sqlStr, out ErrInfo); if (!string.IsNullOrEmpty(ErrInfo)) { Context.Response.Write(WebExport.ExportErrMsg("修改失败,请检查数据!")); } if (update1 > 0) { Context.Response.Write(WebExport.ExportSuccess("修改成功!")); } break; default: break; } //Context.Response.Write(retStr); }