Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        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;
            }
        }