private RoleComponentVM BuildOneTreeViewItem(string nodeName, LayoutComponentType type, List <RoleComponentVM> childList) { RoleComponentVM item1 = new RoleComponentVM(); item1.RoleComponentChildVMList = childList; if (childList == null) { Component realCompt = GetRealComponent(type); RoleComponentPermission roleComptPermission = GetRoleComponentPermission(type); item1.Name = realCompt.Name; item1.RoleId = this.RoleId; item1.ComponentId = (int)type; if (roleComptPermission != null) { item1.RoleComponentPermissionId = roleComptPermission.RoleComponentPermissionId; item1.HasAccess = true; item1.HasWriteRight = roleComptPermission.WriteRight == true; } } else { item1.Name = nodeName; } item1.IsEnabled = !this.IsReadonly; _flatTreeViewItemSource.Add(item1); return(item1); }
private RoleComponentVM BuildSaleModuleNode() { List <RoleComponentVM> saleChildList = new List <RoleComponentVM>(); saleChildList.Add(BuildOneTreeViewItem(null, LayoutComponentType.BookingAdmin, null)); RoleComponentVM result = BuildOneTreeViewItem(ModuleNames.Sales, LayoutComponentType.None, saleChildList); return(result); }
private RoleComponentVM BuildCustomerdModuleNode() { List <RoleComponentVM> customerChildList = new List <RoleComponentVM>(); customerChildList.Add(BuildOneTreeViewItem(null, LayoutComponentType.CustomerAdmin, null)); customerChildList.Add(BuildOneTreeViewItem(null, LayoutComponentType.MonthlyPayment, null)); RoleComponentVM result = BuildOneTreeViewItem(ModuleNames.Customer, LayoutComponentType.None, customerChildList); return(result); }
private void ChildTreeViewItem_CheckChanged(object sender, RoutedEventArgs e) { CheckBox checkItem = sender as CheckBox; if (checkItem != null && checkItem.Tag != null && !string.IsNullOrEmpty(checkItem.Tag.ToString())) { string[] roleIdCompIdString = checkItem.Tag.ToString().Split(','); if (roleIdCompIdString.Length == 2) { Guid roleId = new Guid(roleIdCompIdString[0]); int compId = Convert.ToInt32(roleIdCompIdString[1]); RoleComponentVM treeItem = _flatTreeViewItemSource.FirstOrDefault(i => i.RoleId == roleId && i.ComponentId == compId); if (treeItem != null) { if (checkItem.IsChecked != true) { treeItem.HasWriteRight = false; } } } } }
private RoleComponentVM BuildHomeModuleNode() { List <RoleComponentVM> homeChildList = new List <RoleComponentVM>(); List <RoleComponentVM> securityNodeList = new List <RoleComponentVM>(); securityNodeList.Add(BuildOneTreeViewItem(null, LayoutComponentType.RoleAdmin, null)); securityNodeList.Add(BuildOneTreeViewItem(null, LayoutComponentType.RoleComponentPermission, null)); securityNodeList.Add(BuildOneTreeViewItem(null, LayoutComponentType.UserRoleAuthorisation, null)); List <RoleComponentVM> administrationNodeList = new List <RoleComponentVM>(); administrationNodeList.Add(BuildOneTreeViewItem(null, LayoutComponentType.SiteAdmin, null)); administrationNodeList.Add(BuildOneTreeViewItem(null, LayoutComponentType.SiteGroupAdmin, null)); administrationNodeList.Add(BuildOneTreeViewItem(null, LayoutComponentType.EquipmentAdmin, null)); administrationNodeList.Add(BuildOneTreeViewItem(null, LayoutComponentType.ServiceAdmin, null)); administrationNodeList.Add(BuildOneTreeViewItem(null, LayoutComponentType.RoomAdmin, null)); homeChildList.Add(BuildOneTreeViewItem(ModuleNames.HomeAdministration, LayoutComponentType.None, administrationNodeList)); RoleComponentVM result = BuildOneTreeViewItem(ModuleNames.Home, LayoutComponentType.None, homeChildList); return(result); }
private RoleComponentVM BuildOneTreeViewItem(string nodeName, LayoutComponentType type, List<RoleComponentVM> childList) { RoleComponentVM item1 = new RoleComponentVM(); item1.RoleComponentChildVMList = childList; if (childList == null) { Component realCompt = GetRealComponent(type); RoleComponentPermission roleComptPermission = GetRoleComponentPermission(type); item1.Name = realCompt.Name; item1.RoleId = this.RoleId; item1.ComponentId = (int)type; if (roleComptPermission != null) { item1.RoleComponentPermissionId = roleComptPermission.RoleComponentPermissionId; item1.HasAccess = true; item1.HasWriteRight = roleComptPermission.WriteRight == true; } } else { item1.Name = nodeName; } item1.IsEnabled = !this.IsReadonly; _flatTreeViewItemSource.Add(item1); return item1; }