public static System.Collections.Generic.List <CatalogFilterItem> BuildFilterLanguages(System.Collections.Generic.List <CatalogExcursionMinPrice> catalog, int[] marks)
 {
     ExcursionProvider.CatalogFilterItemsCounterBuilder <Language> builder = new ExcursionProvider.CatalogFilterItemsCounterBuilder <Language>();
     if (catalog != null)
     {
         foreach (CatalogExcursionMinPrice item in catalog)
         {
             if (item.excursion != null && item.excursion.languages != null)
             {
                 foreach (Language i in item.excursion.languages)
                 {
                     builder.Add(i.id, i);
                 }
             }
         }
     }
     return((
                from m in builder.ToList()
                select new CatalogFilterItem
     {
         id = m.item.id,
         name = m.item.name,
         count = m.count
     } into m
                orderby m.name
                select m).ToList <CatalogFilterItem>());
 }
 public static System.Collections.Generic.List <CatalogFilterLocationItem> BuildFilterDestinations(System.Collections.Generic.List <CatalogExcursionMinPrice> catalog, int[] marks)
 {
     ExcursionProvider.CatalogFilterItemsCounterBuilder <GeoArea> builder = new ExcursionProvider.CatalogFilterItemsCounterBuilder <GeoArea>();
     if (catalog != null)
     {
         foreach (CatalogExcursionMinPrice item in catalog)
         {
             if (item.excursion != null && item.excursion.destinations != null)
             {
                 foreach (GeoArea d in item.excursion.destinations)
                 {
                     builder.Add(d.id, d);
                 }
             }
         }
     }
     return((
                from m in builder.ToList()
                select new CatalogFilterLocationItem
     {
         id = m.item.id,
         name = m.item.name,
         location = m.item.location,
         count = m.count
     } into m
                orderby m.name
                select m).ToList <CatalogFilterLocationItem>());
 }
 public static System.Collections.Generic.List <CatalogFilterCategoryGroup> BuildDescriptionCategories(CatalogExcursion catalog)
 {
     ExcursionProvider.CatalogFilterItemsCounterBuilder <ExcursionCategory> builder = new ExcursionProvider.CatalogFilterItemsCounterBuilder <ExcursionCategory>();
     if (catalog != null && catalog.categories != null)
     {
         foreach (ExcursionCategory c in catalog.categories)
         {
             builder.Add(c.id, c);
         }
     }
     return((
                from m in (
                    from m in builder.ToList()
                    group m by(m.item.categorygroup != null) ? m.item.categorygroup.name : null).Select(delegate(IGrouping <string, ExcursionProvider.CatalogFilterItemsCounterBuilder <ExcursionCategory> .CatalogFilterCounterItem <ExcursionCategory> > m)
     {
         CatalogFilterCategoryGroup catalogFilterCategoryGroup = new CatalogFilterCategoryGroup();
         catalogFilterCategoryGroup.name = m.Key;
         catalogFilterCategoryGroup.items = (
             from n in m
             orderby n.item.sort
             select new CatalogFilterItem
         {
             id = n.item.id,
             name = n.item.name,
             count = 0
         }).ToList <CatalogFilterItem>();
         return catalogFilterCategoryGroup;
     })
                orderby(m.name == null) ? 0 : 1, m.name
                select m).ToList <CatalogFilterCategoryGroup>());
 }
 public void Add(int id, T item)
 {
     ExcursionProvider.CatalogFilterItemsCounterBuilder <T> .CatalogFilterCounterItem <T> counterItem = null;
     if (this.list.TryGetValue(id, out counterItem))
     {
         counterItem.count++;
     }
     else
     {
         this.list.Add(id, new ExcursionProvider.CatalogFilterItemsCounterBuilder <T> .CatalogFilterCounterItem <T>
         {
             count = 1,
             item  = item
         });
     }
 }