private void GenerateDomainChoicesProcess(string modCode, DomainRecursive rec, bool firstLevel = false) { while (true) { Dictionary <int, string> dic = new Dictionary <int, string>(); Dictionary <int, DomainRecursive> idDic = new Dictionary <int, DomainRecursive>(); int i = 1; dic[i++] = "All"; foreach (var l in rec.SubDomains) { var index = i++; dic[index] = l.Name; idDic[index] = l; } Console.WriteLine(); Console.WriteLine(GenerateChoices(dic)); int domainId = GetIntFromUser("Select Domain", 1, dic.Count); if (domainId == 0) { break; } if (domainId == 1) { if (firstLevel) { Moldster.ProcessTemplates(modCode); } else { Moldster.ProcessTemplates(modCode, rec.NameChain); } } else { var selectedDomain = idDic[domainId]; if (selectedDomain.SubDomains.Count == 0) { Moldster.ProcessTemplates(modCode, selectedDomain.NameChain); } else { GenerateDomainChoicesProcess(modCode, selectedDomain); } } } }
public IEnumerable <DomainRecursive> GetModuleDomains(string modCode) { Expression <Func <Domain, bool> > ex = null; if (modCode != null) { ex = d => d.Pages.Any(e => e.Tenant.Code == modCode); } var doms = _unit.DomainRepository.GetRooted(ex).Recurse(); List <DomainRecursive> lst = new List <DomainRecursive>(); foreach (var d in doms) { lst.Add(DomainRecursive.ToDomainRecursive(d)); } return(lst); }
private void GenerateDomainChoicesRender(string modCode, DomainRecursive rec, bool firstLevel = false) { while (true) { Dictionary <int, string> dic = new Dictionary <int, string>(); Dictionary <int, DomainRecursive> idDic = new Dictionary <int, DomainRecursive>(); int i = 1; dic[i++] = "All"; foreach (var l in rec.SubDomains) { var index = i++; dic[index] = l.Name; idDic[index] = l; } if (firstLevel) { dic[i++] = "Localization"; dic[i] = "BuildTenantModule"; } Console.WriteLine(); Console.WriteLine(GenerateChoices(dic)); int domainId = GetIntFromUser("Select Domain", 1, dic.Count); if (domainId == 0) { break; } if (firstLevel) { if (domainId == i - 1) { Localization.GenerateJsonFiles(modCode); continue; } else if (domainId == i) { //TODO:Module definition Moldster.RenderModuleDefinition(modCode); continue; } } if (domainId == 1) { if (firstLevel) { //TODO:Render All foreach (var mod in rec.SubDomains) { Moldster.RenderDomainModule(modCode, mod.NameChain, Lazy); } Moldster.RenderModuleDefinition(modCode); } else { Moldster.RenderDomainModule(modCode, rec.NameChain, Lazy); } } else { var selectedDomain = idDic[domainId]; if (selectedDomain.SubDomains.Count == 0) { Moldster.RenderDomainModule(modCode, selectedDomain.NameChain, Lazy); } else { GenerateDomainChoicesRender(modCode, selectedDomain); } } } }