Esempio n. 1
0
 public DomainFacade(IUnitOfWork unitOfWork)
     : base(unitOfWork)
 {
     DomainSystem    = new DomainSystem(unitOfWork);
     MainMenuSystem  = new MainMenuSystem(unitOfWork);
     SetupMenuSystem = new SetupMenuSystem(unitOfWork);
 }
Esempio n. 2
0
 public MainMenuFacade(IUnitOfWork unitOfWork)
     : base(unitOfWork)
 {
     MainMenuSystem = new MainMenuSystem(unitOfWork);
 }
Esempio n. 3
0
        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);
        }