private void SetAuth(string rid) { string connStr = ConfigurationManager.AppSettings["ConStr"].ToString(); SqlConnection sqlConn = new SqlConnection(connStr); sqlConn.Open(); IList <string> entStrList_Dept = RequestData.GetList <string>("DeptData"); if (entStrList_Dept.Count > 0) { DataTable deptDt = GetTableSchema("dept"); IList <Rule_Regulation_BrowseDept> ents_Dept = entStrList_Dept.Select(tent => Aim.JsonHelper.GetObject <Rule_Regulation_BrowseDept>(tent) as Rule_Regulation_BrowseDept).ToList(); foreach (Rule_Regulation_BrowseDept item in ents_Dept) { DataRow dr = deptDt.NewRow(); dr[0] = Guid.NewGuid(); dr[1] = rid; dr[2] = item.DeptId; dr[3] = item.DeptName; deptDt.Rows.Add(dr); } Rule_Regulation_BrowseDept.DeleteAll("Rule_Regulation='" + rid + "'"); DataHelper.CopyDataToDatabase(deptDt, sqlConn, "BJKY_IntegratedManage..Rule_Regulation_BrowseDept"); } IList <string> entStrList_User = RequestData.GetList <string>("UserData"); if (entStrList_User.Count > 0) { DataTable deptDt = GetTableSchema("user"); IList <Rule_Regulation_BrowseAuth> ents_Dept = entStrList_User.Select(tent => Aim.JsonHelper.GetObject <Rule_Regulation_BrowseAuth>(tent) as Rule_Regulation_BrowseAuth).ToList(); foreach (Rule_Regulation_BrowseAuth item in ents_Dept) { DataRow dr = deptDt.NewRow(); dr[0] = Guid.NewGuid(); dr[1] = rid; dr[2] = item.UserId; dr[3] = item.UserName; deptDt.Rows.Add(dr); } Rule_Regulation_BrowseAuth.DeleteAll("Rule_Regulation='" + rid + "'"); DataHelper.CopyDataToDatabase(deptDt, sqlConn, "BJKY_IntegratedManage..Rule_Regulation_BrowseAuth"); } }
protected void Page_Load(object sender, EventArgs e) { id = RequestData.Get <string>("id", String.Empty); ids = RequestData.GetList <string>("ids"); pids = RequestData.GetList <string>("pids"); did = RequestData.Get <string>("did"); ruleId = RequestData.Get <string>("ruleid"); type = RequestData.Get <string>("type"); carryadmin = RequestData.Get <string>("carryadmin"); carrybrowse = RequestData.Get <string>("carryadmin"); SysGroup ent = null; //if (IsAsyncRequest) //{ //} //else //{ // ents = SysGroup.FindAll(Expression.Eq("PathLevel", 1)); // //ents = ents.OrderByDescending(ment => ment.Type).ToArray(); // this.PageState.Add("DtList", ents); //} switch (this.RequestAction) { case RequestActionEnum.Custom: if (RequestActionString == "querychildren") { if (String.IsNullOrEmpty(id)) { ents = SysGroup.FindAll("FROM SysGroup as ent WHERE ParentId is null and Type = 2 Order By SortIndex asc"); } else { ents = SysGroup.FindAll("FROM SysGroup as ent WHERE ParentId = '" + id + "' and Type = 2 Order By SortIndex asc"); } this.PageState.Add("DtList", ents); } else if (RequestActionString == "batchdelete") { IList <object> idList = RequestData.GetList <object>("IdList"); if (idList != null && idList.Count > 0) { SysGroup.DoBatchDelete(idList.ToArray()); } } else if (RequestActionString == "submitopt") { Rule_Regulation rrEnt = Rule_Regulation.Find(ruleId); SysGroup sg = SysGroup.Find(did); if (type == "copy") { Rule_Regulation newRr = new Rule_Regulation(); newRr.Code = rrEnt.Code; newRr.Name = rrEnt.Name; newRr.KeyWord = rrEnt.KeyWord; newRr.Summary = rrEnt.Summary; newRr.Files = rrEnt.Files; newRr.ReleaseState = "未发布"; newRr.DeptId = sg.GroupID; newRr.DeptName = sg.Name; newRr.CreateId = UserInfo.UserID; newRr.CreateName = UserInfo.Name; newRr.CreateTime = System.DateTime.Now; newRr.LastModifyId = UserInfo.UserID; newRr.LastModifyName = UserInfo.Name; newRr.LastModifyTime = DateTime.Now; newRr.DoCreate(); if (carryadmin == "y") { Rule_Regulation_AdminAuth[] rraas = Rule_Regulation_AdminAuth.FindAllByProperty("Rule_Regulation", ruleId); if (rraas.Length > 0) { DataTable dt = GetTableSchema(); foreach (Rule_Regulation_AdminAuth item in rraas) { DataRow dr = dt.NewRow(); dr[0] = Guid.NewGuid(); dr[1] = newRr.Id; dr[2] = item.UserId; dr[3] = item.UserName; dt.Rows.Add(dr); } string connStr = ConfigurationManager.AppSettings["ConStr"].ToString(); BulkCopy(connStr, "Rule_Regulation_AdminAuth", dt); } } if (carrybrowse == "y") { Rule_Regulation_BrowseAuth[] rraas = Rule_Regulation_BrowseAuth.FindAllByProperty("Rule_Regulation", ruleId); if (rraas.Length > 0) { DataTable dt = GetTableSchema(); foreach (Rule_Regulation_BrowseAuth item in rraas) { DataRow dr = dt.NewRow(); dr[0] = Guid.NewGuid(); dr[1] = newRr.Id; dr[2] = item.UserId; dr[3] = item.UserName; dt.Rows.Add(dr); } string connStr = ConfigurationManager.AppSettings["ConStr"].ToString(); BulkCopy(connStr, "Rule_Regulation_BrowseAuth", dt); } } } else if (type == "cut") { rrEnt.DeptId = sg.GroupID; rrEnt.DeptName = sg.Name; rrEnt.CreateId = UserInfo.UserID; rrEnt.CreateName = UserInfo.Name; rrEnt.CreateTime = System.DateTime.Now; rrEnt.LastModifyId = UserInfo.UserID; rrEnt.LastModifyName = UserInfo.Name; rrEnt.LastModifyTime = DateTime.Now; rrEnt.DoUpdate(); if (carryadmin == "n") { Rule_Regulation_AdminAuth.DeleteAll(" Rule_Regulation='" + ruleId + "'"); } if (carrybrowse == "n") { Rule_Regulation_BrowseAuth.DeleteAll(" Rule_Regulation='" + ruleId + "'"); } } } else if (RequestActionString == "c") { DoCreateSubByRole(); } break; default: SysGroup[] grpList = SysGroup.FindAll("From SysGroup as ent where ParentId is null and Type = 2Order By SortIndex, CreateDate Desc"); this.PageState.Add("DtList", grpList); break; } }