public dtoPermission(ModuleProviderManagement module, BaseStatusDeleted deleted, long usedBy, Boolean isEnabled) { Edit = (deleted == BaseStatusDeleted.None && module.EditProvider); Enable = !isEnabled && (deleted == BaseStatusDeleted.None && module.EditProvider); Disable = isEnabled && (deleted == BaseStatusDeleted.None && module.EditProvider); Info = (module.ViewProviders || module.Administration); if (module.DeleteProvider || module.Administration) { //if (usedBy > 0 && deleted != BaseStatusDeleted.None) { if (usedBy > 0) { if (deleted != BaseStatusDeleted.None) { VirtualUndelete = true; } } else if (usedBy == 0) { if (deleted == BaseStatusDeleted.None) { VirtualDelete = true; } else { VirtualUndelete = true; Delete = true; } } } }
public static ModuleProviderManagement CreatePortalmodule(int UserTypeID) { ModuleProviderManagement module = new ModuleProviderManagement(); module.ViewProviders = (UserTypeID == (int)UserTypeStandard.SysAdmin || UserTypeID == (int)UserTypeStandard.Administrator || UserTypeID == (int)UserTypeStandard.Administrative); module.AddProvider = (UserTypeID == (int)UserTypeStandard.SysAdmin || UserTypeID == (int)UserTypeStandard.Administrator); module.EditProvider = (UserTypeID == (int)UserTypeStandard.SysAdmin || UserTypeID == (int)UserTypeStandard.Administrator); module.DeleteProvider = (UserTypeID == (int)UserTypeStandard.SysAdmin); module.VirtualDeleteProvider = (UserTypeID == (int)UserTypeStandard.SysAdmin); module.VirtualUndeleteProvider = (UserTypeID == (int)UserTypeStandard.SysAdmin); module.Administration = (UserTypeID == (int)UserTypeStandard.SysAdmin); return(module); }