public List <int> GetDimensionDomains(Taxonomy Taxonomy) { var result = new List <int>(); foreach (var dim in Dimensions) { result.Add(dim.DomMapID); if (Taxonomy.DomainAliases.ContainsKey(dim.Domain)) { var domalias = Taxonomy.DomainAliases[dim.Domain]; var dimdomalias = String.Format("[{0}]{1}", dim.DimensionItem, domalias); var domaliasid = Taxonomy.FactParts[dimdomalias]; result.Add(domaliasid); } } result = result.Distinct().ToList(); //var domains = Dimensions.Where(i => !i.IsDefaultMember).Select(i => // String.Format("[{0}]{1}",i.DimensionItem, // Taxonomy.DomainAliases.ContainsKey(i.Domain) ? Taxonomy.DomainAliases[i.Domain] : i.Domain)).Distinct().ToList(); //var domainids = domains.Select(i => Taxonomy.FactParts[i]).ToList(); //result.AddRange(domainids); //result.AddRange(Dimensions.Where(i => !i.IsDefaultMember).Select(i => i.DomMapID)); return(result); }
public List <InstanceFact> GetFactsByInstKey(string stringkey) { var facts = new List <InstanceFact>(); var intkey = Taxonomy.GetFactIntKey(stringkey).ToArray(); return(GetFactsByInstKey(intkey)); }
public List <string> GetCells(InstanceFact fact) { var taxfactkey = fact.TaxonomyKey; var cells = Taxonomy.GetCellsOfFact(taxfactkey); var result = new List <string>(); foreach (var cell in cells) { String instancecell = ""; if (fact != null) { instancecell = GetDynamicCellID(cell, fact); } if (!String.IsNullOrEmpty(instancecell)) { result.Add(instancecell); } else { result.Add(cell); } } return(result); }
public static FactsPartsDictionary GetFactsOfParts(Taxonomy taxonomy) { var instance = new FactsPartsDictionary(); instance.DeSerializeItems = (lines) => { var values = new IntervalList(); foreach (var line in lines) { values.AddInterval(Interval.GetInstanceFromString(line)); } values.TrimExcess(); return(values); }; instance.SerializeItem = (itemcontainer) => { var sb = new StringBuilder(); foreach (var item in itemcontainer.Intervals) { sb.AppendLine(item.Content()); } return(sb); }; instance.Folder = () => taxonomy.TaxonomyFactsFolder; instance.FileSearchPattern = "FactsOfParts_*.dat"; instance.GetKey = (file) => { return(Utilities.Converters.FastParse(Utilities.Strings.TextBetween(file, "FactsOfParts_", ".dat"))); }; return(instance); }
public void LoadLabel(Taxonomy Taxonomy) { var folder = _Table.FolderName; var key = Label.GetKey(folder, this.LabelID); this.Label = Taxonomy.FindLabel(key); //this.Label = Taxonomy.TaxonomyLabels.FirstOrDefault(i => i.LocalID == this.LabelID); }
public static List <LayoutItem> GetAspectItems(Hierarchy <LayoutItem> hli, Table table) { var results = new List <LayoutItem>(); if (hli.Item.Category == LayoutItemCategory.Aspect) { var dimension = hli.Item.Dimensions.FirstOrDefault(); var hypercubes = table.HyperCubes.Where(i => i.DimensionItems.Any(j => j.FullName == dimension.DimensionItemFullName)).ToList(); var domains = hypercubes.SelectMany(i => i.DimensionItems.Where(j => j.FullName == dimension.DimensionItemFullName)).SelectMany(k => k.Domains).ToList(); var distinctdomains = domains.Distinct().ToList(); if (distinctdomains.Count == 1) { foreach (var dm in distinctdomains.FirstOrDefault().DomainMembers) { var li = new LayoutItem(); li.Table = table; li.Category = LayoutItemCategory.Rule; var dim = new Dimension(); dim.DimensionItem = dimension.DimensionItemFullName; if (Taxonomy.IsTyped(dm.Domain.Namespace)) { dim.Domain = dm.Domain.ToString(); dim.DomainMember = ""; li.Dimensions.Add(dim); li.LabelID = dm.ID; li.LabelCode = dim.Domain; li.Category = LayoutItemCategory.Dynamic; } else { dim.Domain = dm.Domain.ID; dim.DomainMember = dm.Name; li.Dimensions.Add(dim); li.LabelID = dm.ID; } var domainfolder = dim.Domain.IndexOf("_") > -1 ? dim.Domain.Substring(dim.Domain.LastIndexOf("_") + 1) : dim.Domain; var labelkey = Label.GetKey(domainfolder, dm.ID); li.Label = table.Taxonomy.FindLabel(labelkey); if (String.IsNullOrEmpty(li.LabelCode)) { li.LabelCode = li.LabelID; } results.Add(li); } } } return(results); }
public void SetTyped() { if (this.IsTyped) { return; } var ix = this.Domain.IndexOf(":", StringComparison.Ordinal); if (ix > -1) { this.IsTyped = Taxonomy.IsTyped(this.Domain); return; } if (ix > -1 && !String.IsNullOrEmpty(this.DomainMember)) { this.IsTyped = true; } }
public FactBase GetFactBaseByIndexString(string factstring) { if (factstring.StartsWith("I:")) { var id = Utilities.Converters.FastParse(factstring.Substring(2)); if (id > -1 && id < this.Facts.Count) { return(this.Facts[id]); } } if (factstring.StartsWith("T:")) { var id = Utilities.Converters.FastParse(factstring.Substring(2)); if (Taxonomy.FactsManager.Count > id) { var fact = new FactBase(); var key = Taxonomy.FactsManager.GetFactKey(id); var stringkey = Taxonomy.GetFactStringKey(key); fact.SetFromString(stringkey); return(fact); } } return(null); }
public void Set(string itemtype, Taxonomy taxonomy) { ItemType = itemtype; if (ItemType.In("integerItemType")) { Type = TypeEnum.Integer; } if (ItemType.In("monetaryItemType", "percentItemType")) { Type = TypeEnum.Numeric; } if (ItemType.In("stringItemType", "QNameItemType")) { Type = TypeEnum.String; } if (ItemType.In("booleanItemType")) { Type = TypeEnum.Boolean; } if (ItemType.In("dateItemType")) { Type = TypeEnum.Date; } if (Type == TypeEnum.Numeric) { Decimals = 0; if (ItemType == "percentItemType") { Decimals = 4; } } // } }
public List <string> GetCellsByTaxFactIndex(int[] taxfactkey) { var cells = Taxonomy.GetCellsOfFact(taxfactkey); return(cells); }
public virtual void SetTaxonomy(Taxonomy xbrlTaxonomy) { this.Taxonomy = xbrlTaxonomy; this.TaxonomyModuleReference = String.IsNullOrEmpty(this.TaxonomyModuleReference) ? xbrlTaxonomy.TaxonomyModulePath : this.TaxonomyModuleReference; this.ModulePath = Utilities.Strings.GetLocalPath(TaxonomyEngine.LocalFolder, this.TaxonomyModuleReference); }