/// <summary> /// 根据权限代码查询当行栏目 /// </summary> /// <param name="Roleidlist">权限总和</param> /// <param name="ParentID">父类代码</param> /// <returns></returns> private List <Model.Angel_Admin_Navigation> getRoleMenuList(string Roleidlist, int ParentID) { StringBuilder str_condition = new StringBuilder(); str_condition.Append(" NavName in ("); str_condition.Append(Roleidlist); str_condition.Append(") and ParentID=" + ParentID + " order by Sequence"); AngelData menuData = new AngelData("Angel_Admin_Navigation", "Angel_Admin_Navigation"); return(menuData.getObjectListByCondition <Model.Angel_Admin_Navigation>(str_condition.ToString())); }
/// <summary> /// 处理客户端请求 /// </summary> /// <param name="context">请求参数</param> public void ProcessRequest(HttpContext context) { string tableName = context.Request.Params["tableName"]; //表名 string modelClassName = context.Request.Params["modelClassName"]; //类名 if ((tableName == null || tableName == "") || (modelClassName == null || modelClassName == "")) { //写dataGrid数据 context.Response.ContentType = "text/plain"; context.Response.Clear(); context.Response.Write("{total:0,rows:[]}"); //写空数据 return; } //context.Response.Write("<script>alert('"+tableName+"');</script>"); AngelData TestData = new AngelData(tableName, modelClassName); //分页控件上传的参数 int pageNo = int.Parse(context.Request.Params["pageNo"]); int pageSize = int.Parse(context.Request.Params["pageSize"]); //查询条件 string str_querryConditon = context.Request.Params["querryCondition"]; if ((str_querryConditon == "") || (str_querryConditon == null)) { TestData.SetConditionAll(); //this.ConditionStr = "1=1"; } else { //对PC栏目菜单按照排序号排序 if (tableName == "t_entpcpermission" || tableName == "t_enttermpermission") { TestData.SetConditionString(str_querryConditon + " order by PermissionNo desc"); } else { TestData.SetConditionString(str_querryConditon); } } // 在表中增加企业条件 TestData.GetObjIdList(modelClassName); // 获得实体的id列表 if (TestData.lst_colId.Contains("Corp_ID") && tableName != "t_corp" && tableName != "t_nodeurl") // id中含有“Corp_ID” //if (tableName != "t_corp" && tableName != "t_actiontype" && tableName != "v_actiontype" && tableName != "t_entpcpermission" && tableName != "t_enttermpermission" && tableName != "t_superpcpermission" && tableName != "v_nodetype" && tableName != "t_flowstatus") { string str_Corp_ID = context.Session["Corp_ID"] == null ? "" : context.Session["Corp_ID"].ToString(); TestData.AddCondition("Corp_ID", str_Corp_ID); } // 排序条件 string str_orderBy = context.Request.Params["orderBy"]; //if (tableName == "t_depart") //{ // string str_Corp_ID = Session["Corp_ID"] == null ? "" : Session["Corp_ID"].ToString(); // string id = context.Request.Params["nodeid"]; // List<string> list = new List<string>(); // getChildrenid(list, tableName, id, str_Corp_ID); // if (list.Count > 0) // { // Newtonsoft.Json.Converters.IsoDateTimeConverter timeConverter = new Newtonsoft.Json.Converters.IsoDateTimeConverter(); // timeConverter.DateTimeFormat = "yyyy'-'MM'-'dd"; // string ResJsonStr = JsonConvert.SerializeObject(list, Formatting.Indented, timeConverter); // TestData.AddConditionString("id in (" + ResJsonStr.Replace("[", "").Replace("]", "") + ")"); // } //} // TestData //获得分页数据 int total = TestData.GetDataSetPage(pageNo, pageSize); //数据集==>json串 TestData.GetDsJson(total); //写dataGrid数据 context.Response.ContentType = "text/plain"; context.Response.Clear(); context.Response.Write(TestData.strDsJson); }
/// <summary> /// ---------------操作响应-------Server Side----- /// 根据上传参数,执行相应操作,返回是否成功 /// </summary> /// <param name="context"></param> public void ProcessRequest(HttpContext context) { bool b_result = false; //上传的参数 //data: {tableName:str_tableName, modelClassName:str_modelClassName, actionType: str_actType, actionObj: str_actObj }, string tableName = context.Request.Params["tableName"]; //表名 string modelClassName = context.Request.Params["modelClassName"]; //类名 string action = context.Request.Params["actionType"]; //操作:删除对象、删除列表、添加对象、修改对象 string targetObject = context.Request.Params["actionObj"]; //对象json或对象数组 //缺少参数,返回错误 if ((tableName == null || tableName == "") || (modelClassName == null || modelClassName == "")) { context.Response.Write("{'success':" + "false" + "}"); } //视图改成表操作 //V开头的视图改成T开头 if (tableName.Substring(0, 1) == "v") { tableName = "t" + tableName.Substring(1); } //v开头的模型去掉v if (modelClassName.Substring(0, 1) == "v") { modelClassName = modelClassName.Substring(1); } AngelData OperatingData = new AngelData(tableName, modelClassName); //"Test","Test"--操作数据库数据方法 context.Response.ContentType = "text/plain"; //对象是否存在(id) if (action == "isObjectExist") { b_result = OperatingData.ObjectExistById(targetObject); // 对于用户表,还要检查同一企业的用户名是否已存在 } string AdminName = AngelUtils.GetCookie("AgeRememberName") == null ? "" : AngelUtils.GetCookie("AgeRememberName").ToString(); if ((AdminName == "") || (AdminName == null)) { context.Response.Write("{'success':" + "false" + "}"); return; } //删除对象(id) switch (tableName) { case "t_product": //Product pro1 = TestData.GetObject_ById<Product>(targetObject); //if (action == "deleteObject") //{ // C_xData quolinedata = new C_xData("t_quoteline", "Quoteline"); // quolinedata.SetConditionString(" Product_ID='" + pro1.Product_ID + "' and Corp_ID='" + str_Corp_ID + "'"); // C_xData orderlinedata = new C_xData("t_orderline", "Orderline"); // orderlinedata.SetConditionString(" Product_ID='" + pro1.Product_ID + "' and Corp_ID='" + str_Corp_ID + "'"); // bool isProduct = quolinedata.Condition_DataExist(); // bool isProduct1 = orderlinedata.Condition_DataExist(); // if (isProduct || isProduct1) // { // b_result = false; // } // else // { // b_result = TestData.DeleteObjectById(targetObject); // } //} break; default: if (action == "deleteObject") { b_result = OperatingData.DeleteObjectById(targetObject); } break; } //删除多个对象(id[]) if (action == "deleteObjects") { b_result = OperatingData.DeleteObjectsById(targetObject); } //批量审批多个对象(id[]) if (action == "reviewObjects") { b_result = OperatingData.setObjectsAttributById(targetObject, "Status", "审批通过"); } //审批一个对象 if (action == "reviewObject") { b_result = OperatingData.setObjectAttributById(targetObject, "Status", "审批通过"); } //更新对象(json) if (action == "updateObject") { // 读取Json数据 Angel_DataJson.getValuelistByJsonString(targetObject, OperatingData.lst_colId, out OperatingData.lst_Value); //if (tableName != "t_corp") //{ // // 写入企业代码 // for (int i = 0; i < TestData.lst_colId.Count; i++) // if (TestData.lst_colId[i] == "Corp_ID") TestData.lst_Value[i] = str_Corp_ID; //} b_result = OperatingData.UpdateData(); } //插入新对象(json) if (action == "insertObject") { //if (TestData.lst_colId[4] == "PassMd5") // TestData.lst_Value[4] = // 读取Json数据 Angel_DataJson.getValuelistByJsonString(targetObject, OperatingData.lst_colId, out OperatingData.lst_Value); // 如果是用户表,检查User_ID是否重名 bool isUserExist = false; string str_user_id = ""; if (isUserExist) { b_result = false; } else { b_result = OperatingData.InsertData(); // 插入数据 } } //返回结果 if (b_result) { context.Response.Write("{'success':" + "true" + "}"); } else { context.Response.Write("{'success':" + "false" + "}"); } }