protected void Store1_OnRefreshData(object sender, StoreRefreshDataEventArgs e) { int selectResourceID = 0; if (e.Parameters["SelectResourceID"] != null) { selectResourceID = Convert.ToInt32(e.Parameters["SelectResourceID"]); } if (selectResourceID == 0) { Store1.DataSource = new List <SystemPrivilegeWrapper>(); Store1.DataBind(); return; } SystemResourcesWrapper resourcesWrapper = SystemResourcesWrapper.FindById(selectResourceID); SystemRoleWrapper systemRoleWrapper = SystemRoleWrapper.FindById(RoleID); List <SystemPrivilegeWrapper> list1 = SystemPrivilegeWrapper.FindAllByResourcesID(resourcesWrapper); List <string> list2 = SystemRoleWrapper.GetRoleAssignedPermissionsByResources(systemRoleWrapper, resourcesWrapper); List <SystemPrivilegeWrapper> list3 = list1.FindAll(p => !list2.Contains(p.PrivilegeID.ToString())); Store1.DataSource = list3; Store1.DataBind(); }
public void Show(int id) { try { SystemRoleWrapper obj = SystemRoleWrapper.FindById(id); if (obj != null) { this.txtRoleName.Text = obj.RoleName.ToString(); this.txtRoleDescription.Text = obj.RoleDescription.ToString(); this.chkRoleIsSystemRole.Checked = ValueConvertUtil.ConvertNullableValue <bool>(obj.RoleIsSystemRole); hidSystemRoleID.Text = id.ToString(); winSystemRoleEdit.Show(); } else { ResourceManager.AjaxSuccess = false; ResourceManager.AjaxErrorMessage = "错误信息:数据不存在"; return; } } catch (Exception ex) { ResourceManager.AjaxSuccess = false; ResourceManager.AjaxErrorMessage = "错误信息:" + ex.Message; return; } }
public void Show(int id) { try { SystemRoleWrapper obj = SystemRoleWrapper.FindById(id); if (obj != null) { this.txtRoleName.Text = obj.RoleName; this.txtRoleDescription.Text = obj.RoleDescription; this.txtRoleCode.Text = obj.RoleCode; this.chkRoleIsSystemRole.Checked = ValueConvertUtil.ConvertNullableValue <bool>(obj.RoleIsSystemRole); hidSystemRoleID.Text = id.ToString(); winSystemRoleEdit.Show(); } else { ResourceManager.AjaxSuccess = false; ResourceManager.AjaxErrorMessage = "错误信息:数据不存在"; return; } } catch (Exception ex) { ResourceManager.AjaxSuccess = false; ResourceManager.AjaxErrorMessage = string.Format(this.GetGlobalResourceObject("GlobalResource", "msgServerErrorMsg").ToString(), ex.Message); return; } }
protected void Store2_OnRefreshData(object sender, StoreRefreshDataEventArgs e) { int selectResourceID = 0; if (e.Parameters["SelectResourceID"] != null) { selectResourceID = Convert.ToInt32(e.Parameters["SelectResourceID"]); } if (selectResourceID == 0) { Store2.DataSource = new List <SystemPrivilegeWrapper>(); Store2.DataBind(); return; } SystemResourcesWrapper resourcesWrapper = SystemResourcesWrapper.FindById(selectResourceID); SystemRoleWrapper systemRoleWrapper = SystemRoleWrapper.FindById(RoleID); List <string> list2 = SystemRoleWrapper.GetRoleAssignedPermissionsByResources(systemRoleWrapper, resourcesWrapper); List <SystemPrivilegeWrapper> list3 = new List <SystemPrivilegeWrapper>(); foreach (string s in list2) { list3.Add(SystemPrivilegeWrapper.FindById(Int32.Parse(s))); } Store2.DataSource = list3; Store2.DataBind(); }
private void InitStore2() { SystemRoleWrapper systemRoleWrapper = SystemRoleWrapper.FindById(RoleID); List <SystemApplicationWrapper> list2 = SystemRoleWrapper.GetRoleAssignedApplications(systemRoleWrapper); Store2.DataSource = list2; Store2.DataBind(); }
protected void storeAssigned_RefreshData(object sender, StoreRefreshDataEventArgs e) { SystemRoleWrapper systemRoleWrapper = SystemRoleWrapper.FindById(RoleID); List <SystemApplicationWrapper> assignedRoles = SystemRoleWrapper.GetRoleAssignedApplications(systemRoleWrapper); storeAssigned.DataSource = assignedRoles; storeAssigned.DataBind(); }
protected void Store1_OnRefreshData(object sender, StoreRefreshDataEventArgs e) { SystemRoleWrapper systemRoleWrapper = SystemRoleWrapper.FindById(RoleID); List <SystemPrivilegeWrapper> list1 = SystemPrivilegeWrapper.FindAll(); List <string> list2 = SystemRoleWrapper.GetRoleAssignedPermissions(systemRoleWrapper); List <SystemPrivilegeWrapper> list3 = list1.FindAll(p => !list2.Contains(p.PrivilegeID.ToString())); Store1.DataSource = list3; Store1.DataBind(); }
private void InitStore1() { SystemRoleWrapper systemRoleWrapper = SystemRoleWrapper.FindById(RoleID); List <SystemPrivilegeWrapper> list1 = SystemPrivilegeWrapper.FindAll(); List <string> list2 = SystemRoleWrapper.GetRoleAssignedPermissions(systemRoleWrapper); List <SystemPrivilegeWrapper> list3 = list1.FindAll(p => !list2.Contains(p.PrivilegeID.ToString())); Store1.DataSource = list3; Store1.DataBind(); }
protected void storeSystemApplication_Refresh(object sender, StoreRefreshDataEventArgs e) { if (RoleID != 0) { SystemRoleWrapper role = SystemRoleWrapper.FindById(RoleID); List <SystemApplicationWrapper> list = SystemRoleWrapper.GetRoleAssignedApplications(role); storeSystemApplication.DataSource = list; storeSystemApplication.DataBind(); } }
protected void Store2_OnRefreshData(object sender, StoreRefreshDataEventArgs e) { SystemUserWrapper systemUserWrapper = SystemUserWrapper.FindById(UserID); List <string> list2 = SystemUserWrapper.GetUserAssignedRoleIDs(systemUserWrapper); List <SystemRoleWrapper> list3 = new List <SystemRoleWrapper>(); foreach (string s in list2) { list3.Add(SystemRoleWrapper.FindById(Int32.Parse(s))); } Store2.DataSource = list3; Store2.DataBind(); }
private void InitStore2() { SystemUserGroupWrapper systemUserGroupWrapper = SystemUserGroupWrapper.FindById(UserGroupID); List <string> list2 = SystemUserGroupWrapper.GetUserGroupAssignedRoleIDs(systemUserGroupWrapper); List <SystemRoleWrapper> list3 = new List <SystemRoleWrapper>(); foreach (string s in list2) { list3.Add(SystemRoleWrapper.FindById(Int32.Parse(s))); } Store2.DataSource = list3; Store2.DataBind(); }
private void InitStore2() { SystemRoleWrapper systemRoleWrapper = SystemRoleWrapper.FindById(RoleID); List <string> list2 = SystemRoleWrapper.GetRoleAssignedPermissions(systemRoleWrapper); List <SystemPrivilegeWrapper> list3 = new List <SystemPrivilegeWrapper>(); foreach (string s in list2) { list3.Add(SystemPrivilegeWrapper.FindById(Int32.Parse(s))); } Store2.DataSource = list3; Store2.DataBind(); }
public void SaveApplicationAssignedMenus(int app_id, string menu_ids) { try { int role_id = RoleID; SystemRoleWrapper obj = SystemRoleWrapper.FindById(role_id); SystemRoleWrapper.PatchAssignRoleMenusInApplication(obj, app_id, menu_ids.Split(',')); } catch (Exception ex) { ResourceManager.AjaxSuccess = false; ResourceManager.AjaxErrorMessage = string.Format(this.GetGlobalResourceObject("GlobalResource", "msgServerErrorMsg").ToString(), ex.Message); } }
public void btnSaveRole(int app_id, string menu_ids) { try { int role_id = RoleID; SystemRoleWrapper obj = SystemRoleWrapper.FindById(role_id); SystemRoleWrapper.PatchAssignRoleMenusInApplication(obj, app_id, menu_ids.Split(',')); } catch (Exception ex) { ResourceManager.AjaxSuccess = false; ResourceManager.AjaxErrorMessage = "Error Message:" + ex.Message; } }
private void InitStore1() { SystemRoleWrapper systemRoleWrapper = SystemRoleWrapper.FindById(RoleID); List <SystemApplicationWrapper> list1 = SystemApplicationWrapper.FindAll(); List <SystemApplicationWrapper> list2 = SystemRoleWrapper.GetRoleAssignedApplications(systemRoleWrapper); List <int> list = new List <int>(); foreach (SystemApplicationWrapper wrapper in list2) { list.Add(wrapper.SystemApplicationID); } IEnumerable <SystemApplicationWrapper> list3 = list1.FindAll(p => !list.Contains(p.SystemApplicationID)); Store1.DataSource = list3; Store1.DataBind(); }
public void Save_RolePermission(string json, int selectResourceID) { try { List <SystemPrivilegeWrapper> selectIDs = JSON.Deserialize <List <SystemPrivilegeWrapper> >(json); List <String> list = new List <string>(); foreach (SystemPrivilegeWrapper row in selectIDs) { list.Add(row.PrivilegeID.ToString()); } SystemRoleWrapper.PatchAssignRolePermissionsByResourcse(SystemRoleWrapper.FindById(RoleID), list, selectResourceID); } catch (Exception ex) { ResourceManager.AjaxSuccess = false; ResourceManager.AjaxErrorMessage = string.Format(this.GetGlobalResourceObject("GlobalResource", "msgServerErrorMsg").ToString(), ex.Message); } }
public void Save_RoleApplication(string json) { try { KeyValuePair <string, string>[] selectIDs = JSON.Deserialize <KeyValuePair <string, string>[]>(json); List <String> list = new List <string>(); foreach (KeyValuePair <string, string> row in selectIDs) { list.Add(row.Key); } SystemRoleWrapper.PatchAssignRoleApplications(SystemRoleWrapper.FindById(RoleID), list); } catch (Exception ex) { ResourceManager.AjaxSuccess = false; ResourceManager.AjaxErrorMessage = "Error Message:" + ex.Message; } }
protected void btnSaveSystemRole_Click(object sender, DirectEventArgs e) { try { SystemRoleWrapper obj = SystemRoleWrapper.FindById(int.Parse(hidSystemRoleID.Text.Trim())); obj.RoleName = this.txtRoleName.Text.Trim(); obj.RoleDescription = this.txtRoleDescription.Text.Trim(); obj.RoleIsSystemRole = this.chkRoleIsSystemRole.Checked; SystemRoleWrapper.Update(obj); winSystemRoleEdit.Hide(); ResourceManager.AjaxSuccess = true; } catch (Exception ex) { ResourceManager.AjaxSuccess = false; ResourceManager.AjaxErrorMessage = "错误信息:" + ex.Message; return; } }
public void Save_RoleApplication(string json) { try { List <SystemApplicationWrapper> applications = JSON.Deserialize <List <SystemApplicationWrapper> >(json); List <String> list = new List <string>(); foreach (SystemApplicationWrapper systemApplicationWrapper in applications) { list.Add(systemApplicationWrapper.SystemApplicationID.ToString()); } SystemRoleWrapper.PatchSetRoleApplications(SystemRoleWrapper.FindById(RoleID), list); } catch (Exception ex) { ResourceManager.AjaxSuccess = false; ResourceManager.AjaxErrorMessage = string.Format(this.GetGlobalResourceObject("GlobalResource", "msgServerErrorMsg").ToString(), ex.Message); } }
public void Save_RoleApplication(string json) { try { List <SystemApplicationWrapper> applications = JSON.Deserialize <List <SystemApplicationWrapper> >(json); List <String> list = new List <string>(); foreach (SystemApplicationWrapper systemApplicationWrapper in applications) { list.Add(systemApplicationWrapper.SystemApplicationID.ToString()); } SystemRoleWrapper.PatchAssignRoleApplications(SystemRoleWrapper.FindById(RoleID), list); } catch (Exception ex) { ResourceManager.AjaxSuccess = false; ResourceManager.AjaxErrorMessage = "Error Message:" + ex.Message; } }
protected void btnSaveSystemRole_Click(object sender, DirectEventArgs e) { try { SystemRoleWrapper obj = SystemRoleWrapper.FindById(int.Parse(hidSystemRoleID.Text.Trim())); obj.RoleName = this.txtRoleName.Text.Trim(); obj.RoleCode = this.txtRoleCode.Text.Trim(); obj.RoleDescription = this.txtRoleDescription.Text.Trim(); obj.RoleIsSystemRole = this.chkRoleIsSystemRole.Checked; SystemRoleWrapper.Update(obj); winSystemRoleEdit.Hide(); ResourceManager.AjaxSuccess = true; } catch (Exception ex) { ResourceManager.AjaxSuccess = false; ResourceManager.AjaxErrorMessage = string.Format(this.GetGlobalResourceObject("GlobalResource", "msgServerErrorMsg").ToString(), ex.Message); return; } }
protected void btnRemove_Click(object sender, DirectEventArgs e) { try { string json = e.ExtraParams["removeItem"]; List <SystemApplicationWrapper> companies = JSON.Deserialize <List <SystemApplicationWrapper> >(json); List <int> assignedAppIDs = new List <int>(); foreach (SystemApplicationWrapper systemApplicationWrapper in companies) { assignedAppIDs.Add(systemApplicationWrapper.SystemApplicationID); } SystemRoleWrapper systemRoleWrapper = SystemRoleWrapper.FindById(RoleID); SystemRoleWrapper.PatchRemoveRoleApplications(systemRoleWrapper, assignedAppIDs); } catch (Exception ex) { ResourceManager.AjaxSuccess = false; ResourceManager.AjaxErrorMessage = string.Format(this.GetGlobalResourceObject("GlobalResource", "msgServerErrorMsg").ToString(), ex.Message); } }
private void LinqTree(List <SystemMenuWrapper> list, Ext.Net.TreeNode tnd, int mid) { if (list == null) { list = SystemMenuWrapper.FindAll(); } IEnumerable <SystemMenuWrapper> result = null; if (mid == 0) { result = list.Where(menu => menu.ParentMenuID == null); } else { result = list.Where(delegate(SystemMenuWrapper menu) { if (menu.ParentMenuID == null) { return(false); } else { if (menu.ParentMenuID.MenuID == mid) { return(true); } else { return(false); } } }); } List <string> menuString = SystemMenuWrapper.GetRoleAssignedMenuIDs(SystemRoleWrapper.FindById(RoleID)); foreach (SystemMenuWrapper m in result) { Ext.Net.TreeNode tn = new Ext.Net.TreeNode(); tn.Qtip = m.MenuID.ToString();; tn.Text = m.MenuName; if (menuString.Count > 0) { tn.Checked = (menuString.Exists(id => id.ToString() == tn.Qtip)) ? ThreeStateBool.True : ThreeStateBool.False; } else { tn.Checked = ThreeStateBool.False; } tnd.Nodes.Add(tn); if (list.Exists(delegate(SystemMenuWrapper menu) { if (menu.ParentMenuID == null) { return(false); } else { if (menu.ParentMenuID.MenuID == m.MenuID) { return(true); } else { return(false); } } })) { LinqTree(list, tn, m.MenuID); } } }
private TreeNodeCollection BuildTree(List <NavMenu> menus, string rootName) { TreeNodeCollection nodes = new TreeNodeCollection(); TreeNode root = new TreeNode(); root.Text = rootName; root.Icon = Icon.Folder; nodes.Add(root); if (menus == null || menus.Count == 0) { return(nodes); } List <string> roleAssignedmenuIDs = SystemMenuWrapper.GetRoleAssignedMenuIDs(SystemRoleWrapper.FindById(RoleID)); foreach (var menu in menus) { TreeNode mainNode = new TreeNode(); mainNode.Text = menu.Name; mainNode.NodeID = menu.Id; WebUIHelper.SetIcon(menu.Icon, menu.IsCategory, mainNode); mainNode.CustomAttributes.Add(new ConfigItem("IsGroup", "1", ParameterMode.Value)); mainNode.CustomAttributes.Add(new ConfigItem("MenuID", menu.Id, ParameterMode.Value)); if (roleAssignedmenuIDs.Contains(menu.Id.ToString())) { mainNode.Checked = ThreeStateBool.True; } else { mainNode.Checked = ThreeStateBool.False; } GenerateSubTreeNode(mainNode, menu, roleAssignedmenuIDs); root.Nodes.Add(mainNode); } //foreach (TreeNodeBase treeNodeBase in nodes) //{ // treeNodeBase.Checked = ThreeStateBool.False; //} return(nodes); }