private string GetTn(TaxonomyInfo taxonomy, string columnName) { if (!_rxCol.IsMatch(columnName)) { return(string.Empty); } var col = _rxCol.Match(columnName).Value; var resultInt = int.Parse(col); var taxParts = taxonomy.ToStringParts().ToList(); if (Args.IgnoreT1Taxonomy) { taxParts.RemoveAt(0); } return(taxParts.Count >= resultInt ? taxParts[resultInt - 1] : string.Empty); //int resultInt; //if (int.TryParse(columnName.Substring(columnName.Length - 1, 1), out resultInt)) //comupute n //{ // var taxParts = taxonomy.ToString().Split(TaxonomyInfo.DELIMITER[0]); // if (taxParts.Count() >= resultInt) // return taxParts[resultInt - 1]; //} //return string.Empty; }
private string GetTn(TaxonomyInfo taxonomy, string columnName) { if (!_rxCol.IsMatch(columnName)) { return(string.Empty); } var col = _rxCol.Match(columnName).Value; var resultInt = int.Parse(col); var taxParts = taxonomy.ToStringParts().ToList(); if (Args.IgnoreT1Taxonomy) { taxParts.RemoveAt(0); } return(taxParts.Count >= resultInt ? taxParts[resultInt - 1] : string.Empty); }
private void ProcessTaxonomySchemas(TaxonomyInfo ti) { //try //{ var taxonomyPaths = new List <string>(); var parts = ti.ToStringParts().ToList(); if (((AdvancedExportArgs)Arguments).IgnoreT1Taxonomy) { parts.RemoveAt(0); } for (var level = 1; level <= parts.Count; level++) { var taxPath = level.ToString(); for (var path = 0; path < level; path++) { taxPath += "/" + parts[path]; } taxonomyPaths.Add(taxPath); } var node = Node.FromValues(ti.ID, ti.ProjectID, ti.TaxonomyData.ParentTaxonomyID ?? Guid.Empty, ti.ToString(((AdvancedExportArgs)Arguments).IgnoreT1Taxonomy), taxonomyPaths.ToArray(), ti.NodeName); var taxonomyMetaDatas = from tmi in ti.TaxonomyMetaInfos from tmd in tmi.TaxonomyMetaDatas where tmd.Active select tmd; foreach (var tmd in taxonomyMetaDatas) { switch (tmd.TaxonomyMetaInfo.Attribute.AttributeName) { case "Taxonomy Enrichment Copy": if (node.Enrichment == null) { node.Enrichment = new Enrichment { lang = EnUs } } ; node.Enrichment.EnrichmentCopy = tmd.Value; break; case "Taxonomy Enrichment Image": if (node.Enrichment == null) { node.Enrichment = new Enrichment { lang = EnUs } } ; node.Enrichment.EnrichmentPrimaryImage = new EnrichmentFileResourceType { Filename = tmd.Value }; break; } } var schemas = from sch in ti.SchemaInfos where sch.SchemaDatas.Any(sd => sd.Active) orderby sch.Attribute.AttributeName select sch; node.SchemaAttribute = schemas.Select(ProcessSchema).ToArray(); node.SerializeObject(GetSaveFilePath("Node", ti.ID.ToString())); //} //catch (Exception ex) //{ // if (Summary.Warnings == null) // Summary.Warnings = new List<WorkerWarning>(); // Summary.Warnings.Add(new WorkerWarning // { // ErrorMessage = ex.Message, // ErrorDetails = ex.StackTrace, // LineData = ti.ToString() // }); //} }