public ExcursionExtendedDescriptionList ExtendedDescription([FromUri] ExtendedDescriptionParam param)
        {
            if (param == null)
            {
                throw new ArgumentNullException("param");
            }
            if (param.Excursions == null)
            {
                throw new ArgumentNullExceptionWithCode(0x69, "ex");
            }
            WebPartner partner = UserToolsProvider.GetPartner(param);

            if (!param.FirstDate.HasValue)
            {
                param.fd = new DateTime?(DateTime.Now.Date);
            }
            if (!param.LastDate.HasValue)
            {
                param.ld = new DateTime?(param.FirstDate.Value.AddDays((double)Settings.ExcursionCheckAvailabilityDays));
            }
            ExcursionExtendedDescriptionList list = new ExcursionExtendedDescriptionList();

            List <ExcursionDescription> list2 = ExcursionProvider.GetDescription(param.Language, param.Excursions);

            foreach (ExcursionDescription description in list2)
            {
                ExcursionExtendedDescription item = new ExcursionExtendedDescription(description);
                if ((description != null) && (description.excursion != null))
                {
                    item.categorygroups = ExcursionProvider.BuildDescriptionCategories(description.excursion);
                    item.excursiondates = ExcursionProvider.GetDates(partner.id, description.excursion.id, param.FirstDate.Value, param.LastDate.Value);
                    item.ranking        = CatalogDescriptionExcursionRanking.Create(SurveyProvider.GetExcursionRanking(description.excursion.id, param.Language), param.Language);
                    item.surveynotes    = ExcursionSurveyNote.Create(SurveyProvider.GetExcursionNotes(description.excursion.id));
                }

                int maxCheckCount = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["max_dates_check_places"]);

                foreach (ExcursionDate ed in item.excursiondates)
                {
                    if (ed.isprice)
                    {
                        if (--maxCheckCount < 0)
                        {
                            break;
                        }

                        var price = ExcursionProvider.GetPrice(param.Language, partner.id, description.excursion.id, ed.date, null);

                        if ((price.Count > 0) && (price[0].totalseats >= 0) && (!price[0].freeseats.HasValue))
                        {
                            ed.isstopsale = true;
                        }
                    }
                }


                list.Add(item);
            }
            return(list);
        }
        public ExcursionExtendedDescriptionList ExtendedDescription([FromUri] ExtendedDescriptionParam param)
        {
            if (param == null)
            {
                throw new ArgumentNullException("param");
            }
            if (param.Excursions == null)
            {
                throw new ArgumentNullExceptionWithCode(0x69, "ex");
            }
            WebPartner partner = UserToolsProvider.GetPartner(param);

            if (!param.FirstDate.HasValue)
            {
                param.fd = new DateTime?(DateTime.Now.Date);
            }
            if (!param.LastDate.HasValue)
            {
                param.ld = new DateTime?(param.FirstDate.Value.AddDays((double)Settings.ExcursionCheckAvailabilityDays));
            }
            ExcursionExtendedDescriptionList list  = new ExcursionExtendedDescriptionList();
            List <ExcursionDescription>      list2 = ExcursionProvider.GetDescription(param.Language, param.Excursions);

            foreach (ExcursionDescription description in list2)
            {
                ExcursionExtendedDescription item = new ExcursionExtendedDescription(description);
                if ((description != null) && (description.excursion != null))
                {
                    item.categorygroups = ExcursionProvider.BuildDescriptionCategories(description.excursion);
                    item.excursiondates = ExcursionProvider.GetDates(partner.id, description.excursion.id, param.FirstDate.Value, param.LastDate.Value);
                    item.ranking        = CatalogDescriptionExcursionRanking.Create(SurveyProvider.GetExcursionRanking(description.excursion.id, param.Language), param.Language);
                    item.surveynotes    = ExcursionSurveyNote.Create(SurveyProvider.GetExcursionNotes(description.excursion.id));
                }
                list.Add(item);
            }
            return(list);
        }