public IEnumerable <DomainDto> RetrieveAllDomain() { IEnumerable <DomainDto> instances = DomainSystem.RetrieveAllDomain(new DomainConverter()); if (instances == null) { instances = new List <DomainDto>(); } return(instances); }
public Dictionary <object, DomainSetting> GetDomainSettingList() { Dictionary <object, DomainSetting> domainList = new Dictionary <object, DomainSetting>(); IEnumerable <DomainDto> domains = DomainSystem.RetrieveAllDomain(new DomainConverter()); // Prepare Id ordered menu list for looking up Dictionary <object, MainMenuDto> mainMenuDic = new Dictionary <object, MainMenuDto>(); IEnumerable <MainMenuDto> allMainMenus = MainMenuSystem.RetrieveAllMainMenu(new MainMenuConverter()); foreach (MainMenuDto item in allMainMenus) { mainMenuDic.Add(item.Id, item); } Dictionary <object, SetupMenuDto> setupMenuDic = new Dictionary <object, SetupMenuDto>(); IEnumerable <SetupMenuDto> allSetupMenus = SetupMenuSystem.RetrieveAllSetupMenu(new SetupMenuConverter()); foreach (SetupMenuDto item in allSetupMenus) { setupMenuDic.Add(item.Id, item); } foreach (DomainDto domain in domains) { DomainSetting domainSetting = new DomainSetting(); domainList.Add(domain.Id, domainSetting); domainSetting.DomainId = domain.Id; domainSetting.Name = domain.Name; domainSetting.DefaultUrl = domain.DefaultUrl; domainSetting.RelatedSubjectIdField = domain.RelatedSubjectIdField; IList <MainMenuDto> mainMenus = new List <MainMenuDto>(); foreach (DomainMainMenuDto item in domain.DomainMainMenus) { mainMenus.Add(mainMenuDic[item.MainMenuId]); } if (domainSetting.DefaultUrl.Trim().Length == 0 && mainMenus.Count > 0) { domainSetting.DefaultUrl = mainMenus[0].NavigateUrl; } domainSetting.MainMenus = mainMenus; IList <SetupMenuDto> setupMenus = new List <SetupMenuDto>(); foreach (DomainSetupMenuDto item in domain.DomainSetupMenus) { setupMenus.Add(setupMenuDic[item.SetupMenuId]); } domainSetting.SetupMenus = setupMenus; } // Add SuperAdmin items DomainSetting superSetting = new DomainSetting(); superSetting.DomainId = (int)UserDomains.SuperAdmin; superSetting.MainMenus = allMainMenus; superSetting.SetupMenus = allSetupMenus; if (allMainMenus.Count <MainMenuDto>() > 0) { superSetting.DefaultUrl = allMainMenus.First().NavigateUrl; } domainList.Add(superSetting.DomainId, superSetting); return(domainList); }