Пример #1
0
        static MainWindow()
        {
            GetDescription(Orientation.Vertical);

            cet2006EntityTypes    = Cet2006.CetFactory.CreateEntityTypes();
            cet2006AggregateTypes = Cet2006.CetFactory.CreateAggregateTypes();
            cet2010EntityTypes    = Cet2010.CetFactory.CreateEntityTypes();
            cet2010AggregateTypes = Cet2010.CetFactory.CreateAggregateTypes();

            cet2006EntityTypesList = Cet2006.CetFactory.Transform(cet2006EntityTypes);
            cet2010EntityTypesList = Cet2010.CetFactory.Transform(cet2010EntityTypes);

            cet2006View = new ListCollectionView(cet2006EntityTypesList);
            cet2006View.GroupDescriptions.Add(new PropertyGroupDescription("Country"));

            cet2010View = new ListCollectionView(cet2010EntityTypesList);
            cet2010View.GroupDescriptions.Add(new PropertyGroupDescription("Country"));

            var types = from a in Assembly.GetAssembly(typeof(IPdu)).GetTypes()
                        where a.IsEnum && a.Namespace.Contains("Enumerations")
                        select a;

            enumerations =
                from n in (from m in types select m.Namespace).Distinct()
                select new
            {
                Namespace = n,
                Enums     = from t in types
                            select new
                {
                    t.Name,
                    Values = from r in Enum.GetNames(t) select new { Name = r, Value = Convert.ChangeType(Enum.Parse(t, r), Enum.GetUnderlyingType(t)) }
                }
            };
        }
Пример #2
0
        /// <summary>
        /// Creates the comprehensive entity-type instance.
        /// </summary>
        /// <param name="resource">The resource from which the CET is extracted.</param>
        /// <returns>Comprehensive entity-type instance</returns>
        private static Cet CreateCet(string resource)
        {
            XmlSerializer serializer = new XmlSerializer(typeof(Cet));

            Stream s  = Assembly.GetExecutingAssembly().GetManifestResourceStream(resource);
            Cet    et = (Cet)serializer.Deserialize(s);

            return(et);
        }
Пример #3
0
        public static List <ICetItem> Transform(Cet c)
        {
            List <ICetItem> items = new List <ICetItem>();

            IEnumerable <ICetItem> extras =
                from e in c.Entities
                from j in e.Categories
                from k in j.Subcategories
                from l in k.Specifices
                from m in l.Extras
                select new CetItem()
            {
                Category    = j.Id,
                Country     = e.Country,
                Description = m.Description,
                Domain      = e.Domain,
                Extra       = m.Id != 0 ? (byte?)m.Id : null,
                Kind        = e.Kind,
                Specific    = l.Id != 0 ? (byte?)l.Id : null,
                Subcategory = k.Id != 0 ? (byte?)k.Id : null
            };

            IEnumerable <ICetItem> specifices =
                from e in c.Entities
                from j in e.Categories
                from k in j.Subcategories
                from l in k.Specifices
                select new CetItem()
            {
                Category    = j.Id,
                Country     = e.Country,
                Description = l.Description,
                Domain      = e.Domain,
                Kind        = e.Kind,
                Specific    = l.Id != 0 ? (byte?)l.Id : null,
                Maximum     = l.Id2 != 0 ? (byte?)l.Id2 : null,
                Subcategory = k.Id != 0 ? (byte?)k.Id : null
            };

            IEnumerable <ICetItem> subcategories =
                from e in c.Entities
                from j in e.Categories
                from k in j.Subcategories
                select new CetItem()
            {
                Category    = j.Id,
                Country     = e.Country,
                Description = k.Description,
                Domain      = e.Domain,
                Kind        = e.Kind,
                Subcategory = k.Id != 0 ? (byte?)k.Id : null,
                Maximum     = k.Id2 != 0 ? (byte?)k.Id2 : null
            };

            IEnumerable <ICetItem> categories =
                from e in c.Entities
                from j in e.Categories
                select new CetItem()
            {
                Category    = j.Id,
                Country     = e.Country,
                Description = j.Description,
                Domain      = e.Domain,
                Kind        = e.Kind
            };

            items = items.Concat <ICetItem>(extras).Concat <ICetItem>(specifices).Concat <ICetItem>(subcategories).Concat <ICetItem>(categories).ToList <ICetItem>();
            items.Sort();

            return(items);
        }
Пример #4
0
        public static List<ICetItem> Transform(Cet c)
        {
            List<ICetItem> items = new List<ICetItem>();

            IEnumerable<ICetItem> extras =
                from e in c.Entities
                from j in e.Categories
                from k in j.Subcategories
                from l in k.Specifices
                from m in l.Extras
                select new CetItem()
                {
                    Category = j.Id,
                    Country = e.Country,
                    Description = m.Description,
                    Domain = e.Domain,
                    Extra = m.Id != 0 ? (byte?)m.Id : null,
                    Kind = e.Kind,
                    Specific = l.Id != 0 ? (byte?)l.Id : null,
                    Subcategory = k.Id != 0 ? (byte?)k.Id : null
                };

            IEnumerable<ICetItem> specifices =
                from e in c.Entities
                from j in e.Categories
                from k in j.Subcategories
                from l in k.Specifices
                select new CetItem()
                {
                    Category = j.Id,
                    Country = e.Country,
                    Description = l.Description,
                    Domain = e.Domain,
                    Kind = e.Kind,
                    Specific = l.Id != 0 ? (byte?)l.Id : null,
                    Maximum = l.Id2 != 0 ? (byte?)l.Id2 : null,
                    Subcategory = k.Id != 0 ? (byte?)k.Id : null
                };

            IEnumerable<ICetItem> subcategories =
                from e in c.Entities
                from j in e.Categories
                from k in j.Subcategories
                select new CetItem()
                {
                    Category = j.Id,
                    Country = e.Country,
                    Description = k.Description,
                    Domain = e.Domain,
                    Kind = e.Kind,
                    Subcategory = k.Id != 0 ? (byte?)k.Id : null,
                    Maximum = k.Id2 != 0 ? (byte?)k.Id2 : null
                };

            IEnumerable<ICetItem> categories =
                from e in c.Entities
                from j in e.Categories
                select new CetItem()
                {
                    Category = j.Id,
                    Country = e.Country,
                    Description = j.Description,
                    Domain = e.Domain,
                    Kind = e.Kind
                };

            items = items.Concat<ICetItem>(extras).Concat<ICetItem>(specifices).Concat<ICetItem>(subcategories).Concat<ICetItem>(categories).ToList<ICetItem>();
            items.Sort();

            return items;
        }
Пример #5
0
        public static List <ICetItem> Transform(Cet c)
        {
            List <ICetItem> items = new List <ICetItem>();

            /*IEnumerable<ICetItem> extras =
             *  from e in c.Entities
             *  from j in e.Categories
             *  from k in j.Subcategories
             *  from l in k.Specifices
             *  from m in l.Extras
             *  select new CetItem()
             *  {
             *      Category = j.Id,
             *      Country = e.Country,
             *      Description = m.Description,
             *      Domain = e.Domain,
             *      Extra = m.Id != 0 ? (byte?)m.Id : null,
             *      Kind = e.Kind,
             *      Specific = l.Id != 0 ? (byte?)l.Id : null,
             *      Subcategory = k.Id != 0 ? (byte?)k.Id : null
             *  };
             *
             * IEnumerable<ICetItem> specifices =
             *  from e in c.Entities
             *  from j in e.Categories
             *  from k in j.Subcategories
             *  from l in k.Specifices
             *  select new CetItem()
             *  {
             *      Category = j.Id,
             *      Country = e.Country,
             *      Description = l.Description,
             *      Domain = e.Domain,
             *      Kind = e.Kind,
             *      Specific = l.Id != 0 ? (byte?)l.Id : null,
             *      Maximum = l.Id2 != 0 ? (byte?)l.Id2 : null,
             *      Subcategory = k.Id != 0 ? (byte?)k.Id : null
             *  };
             *
             * IEnumerable<ICetItem> subcategories =
             *  from e in c.Entities
             *  from j in e.Categories
             *  from k in j.Subcategories
             *  select new CetItem()
             *  {
             *      Category = j.Id,
             *      Country = e.Country,
             *      Description = k.Description,
             *      Domain = e.Domain,
             *      Kind = e.Kind,
             *      Subcategory = k.Id != 0 ? (byte?)k.Id : null,
             *      Maximum = k.Id2 != 0 ? (byte?)k.Id2 : null
             *  };
             *
             * IEnumerable<ICetItem> categories =
             *  from e in c.Entities
             *  from j in e.Categories
             *  select new CetItem()
             *  {
             *      Category = j.Id,
             *      Country = e.Country,
             *      Description = j.Description,
             *      Domain = e.Domain,
             *      Kind = e.Kind
             *  };
             *
             * items = items.Concat<ICetItem>(extras).Concat<ICetItem>(specifices).Concat<ICetItem>(subcategories).Concat<ICetItem>(categories).ToList<ICetItem>();
             * items.Sort();*/

            return(items);
        }