using System; using System.Collections.Generic; using System.Data; using Ease.Core; namespace HRM.BO { public class Role : BasicBaseObject { #region Constructor public Role() { Code = string.Empty; Name = string.Empty; ApproveBy = 0; ApproveDate = DateTime.MinValue; RoleStatus = EnumAuthStatus.Approved; ModifiedBy = 0; ModifiedDate = DateTime.MinValue; RolePermissions = new List(); _RoleActionPermission = new List(); } #endregion #region Properties public string Name { get; set; } public string Code { get; set; } public string Description { get; set; } public int? ApproveBy { get; set; } public DateTime? ApproveDate { get; set; } public EnumRoleType RoleType { get; set; } public EnumAuthStatus RoleStatus { get; set; } public List RolePermissions { get; set; } public List _RoleActionPermission { get; set; } #region Child Objects public class RoleActionPermission : AuditTrailBase { public RoleActionPermission() { RoleID = 0; Name = string.Empty; Status = EnumAuthStatus.NewNotYetApprove; ApproveBy = 0; ApproveDate = DateTime.MinValue; ModifiedBy = 0; ModifiedDate = DateTime.MinValue; } public int RoleID { get; set; } public int RolePermissionID { get; set; } public string ActionCode { get; set; } public string Name { get; set; } public string Url { get; set; } public EnumAuthStatus Status { get; set; } public int? ApproveBy { get; set; } public DateTime? ApproveDate { get; set; } } public class RolePermission : AuditTrailBase { #region Constructor public RolePermission() { RoleID = 0; PermissionCode = string.Empty; Name = string.Empty; Link = string.Empty; Status = EnumAuthStatus.None; ApproveBy = 0; ApproveDate = DateTime.MinValue; ModifiedBy = 0; ModifiedDate = DateTime.MinValue; _RoleActionPermission = new List(); } #endregion #region Properties public int RoleID { get; set; } public string PermissionCode { get; set; } public string Name { get; set; } public string Link { get; set; } public EnumAuthStatus Status { get; set; } public int? ApproveBy { get; set; } public DateTime? ApproveDate { get; set; } public int? parentID {get;set;} public List _RoleActionPermission { get; set; } public List Roles { get; set; } public EnumRoleType RoleType { get; set; } public bool isBookmarked { get; set; } public static EnumRoleType GetRoletype(string sroleType) { EnumRoleType roltype = EnumRoleType.Admin; switch (sroleType.ToLower()) { case "admin": roltype = EnumRoleType.Admin; break; case "ess": case "web": roltype = EnumRoleType.Self_Service; break; case "mobile": roltype = EnumRoleType.Mobile; break; default: roltype = EnumRoleType.Admin; break; } return roltype; } #endregion } #endregion #endregion } public class WebMenuHead { public WebMenuHead() { } public WebMenuHead(string smenuCode, string Level) { this.menuCode = smenuCode; this.label = Level; this.items = null; this.icon = "pi pi-fw pi-sitemap"; } public WebMenuHead(string smenuCode, string Level, string RouterLink) { this.menuCode = smenuCode; this.label = Level; this.routerLink = RouterLink; this.items = null; this.icon = "pi pi-fw pi-th-large"; } public string menuCode { get; set; } public string label { get; set; } public string icon { get; set; } public List items { get; set; } public string routerLink { get; set; } } public class WebMenuGroup { public WebMenuGroup() { } public WebMenuGroup(string smenuCode, string Level, string RouterLink) { this.menuCode = smenuCode; this.label = Level; this.routerLink = RouterLink; this.items = null; this.icon = "pi pi-fw pi-sign-in"; } public WebMenuGroup(string smenuCode, string Level) { this.menuCode = smenuCode; this.label = Level; this.items = null; this.icon = "pi pi-fw pi-sign-in"; } public string uniqueName { get; set; } public string label { get; set; } public string routerLink { get; set; } public string icon { get; set; } public List items { get; set; } public string menuCode { get; set; } } public class WebMenuItem { public WebMenuItem() { } public WebMenuItem(string smenuCode, string Level, string RouterLink) { this.menuCode = smenuCode; this.label = Level; this.routerLink = RouterLink; this.icon = "pi pi-fw pi-th-large"; } public string uniqueName { get; set; } public string label { get; set; } public string routerLink { get; set; } public string icon { get; set; } public string menuCode { get; set; } public List items { get; set; } } public class WebMenuItemDetail { public WebMenuItemDetail() { } public WebMenuItemDetail(string Level, string RouterLink) { this.label = Level; this.routerLink = RouterLink; this.icon = "pi pi-fw pi-th-large"; } public WebMenuItemDetail(string smenuCode, string Level, string RouterLink) { this.menuCode = smenuCode; this.label = Level; this.routerLink = RouterLink; this.icon = "pi pi-fw pi-th-large"; } public string uniqueName { get; set; } public string label { get; set; } public string routerLink { get; set; } public string icon { get; set; } public string menuCode { get; set; } } public class WebMenu { //private static List _menus; //public static List Menus => _menus ?? (_menus = CreateMenu()); private List _AdminMenus; public List AdminMenus => _AdminMenus ?? (_AdminMenus = AdminCreateMenu()); private static List AdminCreateMenu() { return new List() { new WebMenuHead() { label = "Menu-Head", items = new List() { new WebMenuGroup() { uniqueName = "Dashboard.01", label = "Home", items = null }, new WebMenuGroup() { uniqueName = "WEB.01", label = "Administration", items = new List() { new WebMenuItem() { uniqueName = "WEB.01.01", label = "Configuration", routerLink = "/authentication/configuration", }, new WebMenuItem() { uniqueName = "WEB.01.02", label = "Role", routerLink = "/authentication/role", }, new WebMenuItem() { uniqueName = "WEB.01.03", label = "User", routerLink = "/authentication/user", }, new WebMenuItem() { uniqueName = "WEB.01.04", label = "User Role Permission", routerLink = "/authentication/user-role", }, new WebMenuItem() { uniqueName = "WEB.01.05", label = "User Access Type", routerLink = "/authentication/user-access-type", }, //new WebMenuItem() //{ // uniqueName = "WEB.01.06", // label = "Hard Password Setup", // routerLink = "/authentication/hard-password", //}, new WebMenuItem() { uniqueName = "WEB.01.07", label = "Change Password", routerLink = "/authentication/change-password", } , new WebMenuItem() { uniqueName = "WEB.01.08", label = "Data Permission", routerLink = "/authentication/data-permssion", }, } }, } } }; } } public interface IRoleService { Role Get(int id); List GetAllRole(); int Save(Role item); void Delete(int id); List GetRolePermissionbyUserID(int Userid); } }