private static void CustomArea(CustomAreaOfLaw aol, Term AOLTerm) { foreach (CustomSubAreaOfLaw asol in aol.Saol) { Console.WriteLine("\t\tCreating sub area of law " + asol.name); Term ASOLTerm = AOLTerm.CreateTerm(asol.name, 1033, Guid.NewGuid()); if (asol.properties.ContainsKey("SAOLFolders") && !string.IsNullOrWhiteSpace(asol.properties["SAOLFolders"])) { ASOLTerm.SetCustomProperty("FolderNames", asol.properties["SAOLFolders"]); } if (asol.properties.ContainsKey("SAOLContentType") && !string.IsNullOrWhiteSpace(asol.properties["SAOLContentType"])) { ASOLTerm.SetCustomProperty("ContentTypeName", asol.properties["SAOLContentType"]); } if (asol.properties.ContainsKey("SAOLDocumentTemplate") && !string.IsNullOrWhiteSpace(asol.properties["SAOLDocumentTemplate"])) { ASOLTerm.SetCustomProperty("DocumentTemplates", asol.properties["SAOLDocumentTemplate"]); } if (asol.properties.ContainsKey("SAOLIsFolder") && !string.IsNullOrWhiteSpace(asol.properties["SAOLIsFolder"])) { ASOLTerm.SetCustomProperty("isNoFolderStructurePresent", asol.properties["SAOLIsFolder"]); } } }
/// <summary> /// Create Term store structure /// </summary> /// <param name="listval">List of Clients from configuration Excel</param> /// <param name="termList">Terms list</param> public static void CreateTermStructure(Dictionary <string, string> listval, List <DataStorage> termList) { try { List <CustomTermGroup> groups = new List <CustomTermGroup>(); foreach (DataStorage item in termList) { string termName = item.TermName; CustomTermGroup termCurrent = (from termGroup in groups where termGroup.name == termName select termGroup).FirstOrDefault(); if (null == termCurrent) { groups.Add(new CustomTermGroup() { name = termName, Pg = new List <CustomPracticeGroup>() }); } termCurrent = (from termGroup in groups where termGroup.name == termName select termGroup).FirstOrDefault(); termName = item.PracticeGroup; CustomPracticeGroup pgCurrent = (from termGroup in termCurrent.Pg where termGroup.name == termName select termGroup).FirstOrDefault(); if (null == pgCurrent) { Dictionary <string, string> customPGConfig = new Dictionary <string, string>(); if (!string.IsNullOrWhiteSpace(item.PGFolders)) { customPGConfig.Add("PGFolders", item.PGFolders); } termCurrent.Pg.Add(new CustomPracticeGroup() { name = termName, Aol = new List <CustomAreaOfLaw>(), properties = customPGConfig }); } pgCurrent = (from termGroup in termCurrent.Pg where termGroup.name == termName select termGroup).FirstOrDefault(); termName = item.AreaofLaw; CustomAreaOfLaw aolCurrent = (from termGroup in pgCurrent.Aol where termGroup.name == termName select termGroup).FirstOrDefault(); if (null == aolCurrent) { Dictionary <string, string> customAOLConfig = new Dictionary <string, string>(); if (!string.IsNullOrWhiteSpace(item.AOLFolders)) { customAOLConfig.Add("AOLFolders", item.AOLFolders); } pgCurrent.Aol.Add(new CustomAreaOfLaw() { name = termName, Saol = new List <CustomSubAreaOfLaw>(), properties = customAOLConfig }); } aolCurrent = (from termGroup in pgCurrent.Aol where termGroup.name == termName select termGroup).FirstOrDefault(); termName = item.SubAreaofLaw; CustomSubAreaOfLaw saolCurrent = (from term in aolCurrent.Saol where term.name == termName select term).FirstOrDefault(); if (null == saolCurrent) { Dictionary <string, string> customSAOLConfig = new Dictionary <string, string>(); if (!string.IsNullOrWhiteSpace(item.SAOLFolders)) { customSAOLConfig.Add("SAOLFolders", item.SAOLFolders); } if (!string.IsNullOrWhiteSpace(item.SAOLContentType)) { customSAOLConfig.Add("SAOLContentType", item.SAOLContentType); } if (!string.IsNullOrWhiteSpace(item.SAOLDocumentTemplates)) { customSAOLConfig.Add("SAOLDocumentTemplate", item.SAOLDocumentTemplates); } if (!string.IsNullOrWhiteSpace(item.SAOLIsFolderStructurePresent)) { customSAOLConfig.Add("SAOLIsFolder", item.SAOLIsFolderStructurePresent); } aolCurrent.Saol.Add(new CustomSubAreaOfLaw() { name = termName, properties = customSAOLConfig }); } saolCurrent = (from a in aolCurrent.Saol where a.name == termName select a).FirstOrDefault(); } CreateTerms(listval, groups); } catch (Exception exception) { ErrorLogger.LogErrorToTextFile(errorFilePath, "Message: " + exception.Message + "\nStacktrace: " + exception.StackTrace); } }