protected void Page_Load(object sender, EventArgs e) { Rule_Regulation ent = null; seltype = RequestData.Get <string>("seltype"); switch (this.RequestAction) { case RequestActionEnum.Delete: ent = this.GetTargetData <Rule_Regulation>(); ent.DoDelete(); this.SetMessage("删除成功!"); break; default: if (RequestActionString == "batchdelete") { DoBatchDelete(); } else if (RequestActionString == "bathrelease") { DoBatchRelease(); } else if (RequestActionString == "bathunrelease") { DoBatchUnRelease(); } else { DoSelect(); } break; } }
private void DoBatchDelete() { IList <object> idList = RequestData.GetList <object>("IdList"); if (idList != null && idList.Count > 0) { Rule_Regulation.DoBatchDelete(idList.ToArray()); } }
string type = String.Empty; // 对象类型 #endregion #region ASP.NET 事件 protected void Page_Load(object sender, EventArgs e) { op = RequestData.Get <string>("op"); id = RequestData.Get <string>("id"); type = RequestData.Get <string>("type"); Rule_Regulation ent = null; switch (this.RequestAction) { case RequestActionEnum.Update: ent = Rule_Regulation.Find(id); ent.AuthType = RequestData.Get <string>("AuthType"); if (ent.AuthType == "specify") { SetAuth(); } ent.LastModifyId = UserInfo.UserID; ent.LastModifyName = UserInfo.Name; ent.LastModifyTime = System.DateTime.Now; ent.DoUpdate(); this.SetMessage("修改成功!"); break; return; } if (op != "c" && op != "cs") { if (!String.IsNullOrEmpty(id)) { ent = Rule_Regulation.Find(id); } this.SetFormData(ent); if (!string.IsNullOrEmpty(id)) { this.PageState.Add("DeptList", Rule_Regulation_BrowseDept.FindAllByProperties("Rule_Regulation", id)); this.PageState.Add("UserList", Rule_Regulation_BrowseAuth.FindAllByProperties("Rule_Regulation", id)); } } }
private void DoBatchUnRelease() { IList <object> idList = RequestData.GetList <object>("IdList"); if (idList != null && idList.Count > 0) { foreach (string id in idList) { Rule_Regulation rr = Rule_Regulation.TryFind(id); if (rr != null) { if (rr.ReleaseState == "已发布") { rr.ReleaseState = "未发布"; rr.ReleaseId = UserInfo.UserID; rr.ReleaseName = UserInfo.Name; rr.ReleaseTime = System.DateTime.Now; rr.DoUpdate(); } } } } }
/// <summary> /// 查询 /// </summary> private void DoSelect() { pid = RequestData.Get <string>("pid"); if (!string.IsNullOrEmpty(pid)) { string where = ""; foreach (CommonSearchCriterionItem item in SearchCriterion.Searches.Searches) { if (!String.IsNullOrEmpty(item.Value.ToString())) { where += " and a." + item.PropertyName + " like '%" + item.Value + "%' "; } } SysGroup sg = SysGroup.Find(pid); string path = sg.Path;//所点击的部门的path //ents = Rule_Regulation.FindAll(SearchCriterion, Expression.Sql(" charindex(DeptId,'" + path + "')>0")); //this.PageState.Add("Rule_RegulationList", ents); string sql = ""; if (seltype == "browse") { sql = @"select distinct a.* from ( SELECT * FROM BJKY_IntegratedManage..Rule_Regulation where AuthType='all' union select a.* from BJKY_IntegratedManage..Rule_Regulation a left join BJKY_Portal..View_SysUserGroup b on a.DeptId like '%'+b.DeptId+'%' where b.UserId='{2}' and b.Type<>'3' and a.AuthType='dept' union select a.* from BJKY_IntegratedManage..Rule_Regulation a left join BJKY_IntegratedManage..Rule_Regulation_BrowseAuth b on b.Rule_Regulation=a.Id where b.UserId='{2}' and a.AuthType='specify' union select a.* from BJKY_IntegratedManage..Rule_Regulation a left join BJKY_IntegratedManage..Rule_Regulation_BrowseDept b on b.Rule_Regulation=a.Id left join BJKY_Portal..View_SysUserGroup c on b.DeptId=c.DeptId where c.UserId='{2}' and c.Type<>'3' and a.AuthType='specify')a left join BJKY_Portal..SysGroup b on a.DeptId like '%'+b.GroupID+'%' where b.Path like '%{0}%' {1} "; //sql = @"SELECT a.* FROM BJKY_IntegratedManage..Rule_Regulation a left join BJKY_IntegratedManage..Rule_Regulation_BrowseAuth c on c.Rule_Regulation=a.Id LEFT JOIN BJKY_Portal..SysGroup b ON a.DeptId=b.GroupID WHERE b.Path like '%{0}%' and c.UserId='{2}' {1}"; sql = string.Format(sql, path, where, UserInfo.UserID); } else { sql = @"SELECT a.* FROM BJKY_IntegratedManage..Rule_Regulation a LEFT JOIN BJKY_Portal..SysGroup b ON a.DeptId=b.GroupID WHERE b.Path like '%{0}%' {1}"; sql = string.Format(sql, path, where); } this.PageState.Add("Rule_RegulationList", GetPageData(sql, SearchCriterion)); } else { if (seltype == "browse") { string where = ""; foreach (CommonSearchCriterionItem item in SearchCriterion.Searches.Searches) { if (!String.IsNullOrEmpty(item.Value.ToString())) { where += " and a." + item.PropertyName + " like '%" + item.Value + "%' "; } } string sql = ""; sql = @"select distinct a.* from (SELECT * FROM BJKY_IntegratedManage..Rule_Regulation where AuthType='all' union select a.* from BJKY_IntegratedManage..Rule_Regulation a left join BJKY_Portal..View_SysUserGroup b on a.DeptId like '%'+b.DeptId+'%' where b.UserId='{1}' and b.Type<>'3' and a.AuthType='dept' union select a.* from BJKY_IntegratedManage..Rule_Regulation a left join BJKY_IntegratedManage..Rule_Regulation_BrowseAuth b on b.Rule_Regulation=a.Id where b.UserId='{1}' and a.AuthType='specify' union select a.* from BJKY_IntegratedManage..Rule_Regulation a left join BJKY_IntegratedManage..Rule_Regulation_BrowseDept b on b.Rule_Regulation=a.Id left join BJKY_Portal..View_SysUserGroup c on b.DeptId=c.DeptId where c.UserId='{1}' and c.Type<>'3' and a.AuthType='specify')a where 1=1 {0}"; //sql = @"SELECT a.* FROM BJKY_IntegratedManage..Rule_Regulation a left join BJKY_IntegratedManage..Rule_Regulation_BrowseAuth c on c.Rule_Regulation=a.Id LEFT JOIN BJKY_Portal..SysGroup b ON a.DeptId=b.GroupID WHERE c.UserId='{1}' {0}"; sql = string.Format(sql, where, UserInfo.UserID); this.PageState.Add("Rule_RegulationList", GetPageData(sql, SearchCriterion)); } else { ents = Rule_Regulation.FindAll(SearchCriterion); this.PageState.Add("Rule_RegulationList", ents); } } }
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; } }
string type = String.Empty; // 对象类型 #endregion #region ASP.NET 事件 protected void Page_Load(object sender, EventArgs e) { op = RequestData.Get <string>("op"); id = RequestData.Get <string>("id"); type = RequestData.Get <string>("type"); Rule_Regulation ent = null; switch (this.RequestAction) { case RequestActionEnum.Update: ent = this.GetMergedData <Rule_Regulation>(); ent.AuthType = RequestData.Get <string>("AuthType"); ent.ReleaseState = RequestData.Get <string>("IsRelease"); if (ent.ReleaseState == "已发布") { ent.ReleaseId = UserInfo.UserID; ent.ReleaseName = UserInfo.Name; ent.ReleaseTime = System.DateTime.Now; } ent.LastModifyId = UserInfo.UserID; ent.LastModifyName = UserInfo.Name; ent.LastModifyTime = System.DateTime.Now; ent.DoUpdate(); if (ent.AuthType == "specify") { SetAuth(ent.Id); } this.SetMessage("修改成功!"); break; case RequestActionEnum.Insert: case RequestActionEnum.Create: ent = this.GetPostedData <Rule_Regulation>(); ent.AuthType = RequestData.Get <string>("AuthType"); ent.ReleaseState = RequestData.Get <string>("IsRelease"); if (ent.ReleaseState == "已发布") { ent.ReleaseId = UserInfo.UserID; ent.ReleaseName = UserInfo.Name; ent.ReleaseTime = System.DateTime.Now; } ent.LastModifyId = UserInfo.UserID; ent.LastModifyName = UserInfo.Name; ent.LastModifyTime = System.DateTime.Now; ent.DoCreate(); if (ent.AuthType == "specify") { SetAuth(ent.Id); } this.SetMessage("新建成功!"); break; case RequestActionEnum.Delete: ent = this.GetTargetData <Rule_Regulation>(); ent.DoDelete(); this.SetMessage("删除成功!"); return; } if (op != "c" && op != "cs") { if (!String.IsNullOrEmpty(id)) { ent = Rule_Regulation.Find(id); } this.SetFormData(ent); if (!string.IsNullOrEmpty(id)) { this.PageState.Add("DeptList", Rule_Regulation_BrowseDept.FindAllByProperties("Rule_Regulation", id)); this.PageState.Add("UserList", Rule_Regulation_BrowseAuth.FindAllByProperties("Rule_Regulation", id)); } } else { string sql = ""; // sql = @"select top 1 case [Type] when 3 then ParentDeptName when 2 then ChildDeptName end as DeptName, // case [Type] when 3 then ParentId when 2 then DeptId end as DeptId // from View_SysUserGroup where UserId='{0}'"; sql = @"select DeptId,ChildDeptName as DeptName from View_SysUserGroup where UserId='{0}' and Type<>'3'"; sql = string.Format(sql, UserInfo.UserID); IList <EasyDictionary> deptDics = DataHelper.QueryDictList(sql); if (deptDics.Count > 0) { var obj = new { DeptId = string.Join(",", deptDics.Select(s => s.Get <string>("DeptId")).ToArray()), DeptName = string.Join(",", deptDics.Select(s => s.Get <string>("DeptName")).ToArray()), CreateId = UserInfo.UserID, CreateName = UserInfo.Name }; SetFormData(obj); } } }