public ExcursionPriceList Price(int id, [FromUri] PriceParam param) { if (param == null) { throw new System.ArgumentNullException("param"); } WebPartner partner = UserToolsProvider.GetPartner(param); if (!param.Date.HasValue) { throw new ArgumentNullExceptionWithCode(202, "date"); } if (!param.StartPoint.HasValue && param.StartPointAlias != null) { param.sp = new int?(CatalogProvider.GetGeoPointIdByAlias(param.StartPointAlias)); } ExcursionPriceList result; if (param.Date.Value.Date < System.DateTime.Today) { result = new ExcursionPriceList(new System.Collections.Generic.List <ExcursionPrice>()); } else { System.Collections.Generic.List <ExcursionPrice> prices = ExcursionProvider.GetPrice(param.Language, partner.id, id, param.Date.Value, param.StartPoint); result = new ExcursionPriceList(( from m in prices where !m.issaleclosed && !m.isstopsale && m.price != null && !(m.totalseats >= 0 && !m.freeseats.HasValue) select m).ToList <ExcursionPrice>()); } return(result); }
public ReservationState Book([FromUri] BookingCartParam param, [FromBody] BookingClaim claim) { if (param == null) { throw new ArgumentNullException("param"); } if (claim == null) { throw new ArgumentNullException("claim"); } WebPartner partner = UserToolsProvider.GetPartner(param); if (claim.customer != null) { foreach (BookingOrder order in claim.orders) { if (order.excursion != null) { if (order.excursion.contact == null) { order.excursion.contact = new ExcursionContact(); } if (order.excursion.contact.name == null) { order.excursion.contact.name = claim.customer.name; } if (order.excursion.contact.mobile == null) { order.excursion.contact.mobile = claim.customer.mobile; } } } } return(BookingProvider.DoBooking(param.Language, partner.id, partner.passId, claim)); }
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); }
private void SendRegistrationConfirmMail(ConfirmMailOperation action, string userName, string confirmationToken, string role = "client") { if (string.IsNullOrEmpty(userName)) { throw new ArgumentNullException("userName"); } if (string.IsNullOrEmpty(confirmationToken)) { throw new ArgumentNullException("confirmationToken"); } if (action == ConfirmMailOperation.confirm) { new SimpleEmailService().SendEmail <AccountConfirmationTemplate>(userName, "send_registration_confirm", "en", new AccountConfirmationTemplate() { Role = role, Token = confirmationToken, ConfirmUrl = new Uri(base.Request.BaseServerAddress(), base.Url.Action("confirm", new { email = userName, token = confirmationToken })).ToString() }); } else if (action == ConfirmMailOperation.recovery) { string content = new Uri(base.Request.BaseServerAddress(), base.Url.Action("resetpassword", new { token = confirmationToken })).ToString(); UserToolsProvider.UmgRaiseMessage(UrlLanguage.CurrentLanguage, "Guest Service Registration", userName, "GS_REGCONFIRM", new XElement("guestServiceRegistration", new object[] { new XAttribute("action", action.ToString()), new XElement("confirmUrl", content), new XElement("email", userName) }).ToString()); } /* * if (string.IsNullOrEmpty(userName)) * { * throw new ArgumentNullException("userName"); * } * if (string.IsNullOrEmpty(confirmationToken)) * { * throw new ArgumentNullException("confirmationToken"); * } * string content = null; * switch (action) * { * case ConfirmMailOperation.confirm: * content = new Uri(base.Request.BaseServerAddress(), base.Url.Action("confirm", new { email = userName, token = confirmationToken })).ToString(); * break; * * case ConfirmMailOperation.recovery: * content = new Uri(base.Request.BaseServerAddress(), base.Url.Action("resetpassword", new { token = confirmationToken })).ToString(); * break; * } * UserToolsProvider.UmgRaiseMessage(UrlLanguage.CurrentLanguage, "Guest Service Registration", userName, "GS_REGCONFIRM", new XElement("guestServiceRegistration", new object[] { new XAttribute("action", action.ToString()), new XElement("confirmUrl", content), new XElement("email", userName) }).ToString()); */ }
public JsonResult AddCart(ExcursionAddWebParam param) { if (param == null) { throw new ArgumentNullException("param"); } List <string> list = new List <string>(); if (param.excursion != null) { if ((param.excursion.pax != null) && ((param.excursion.pax.adult + param.excursion.pax.child) > 0)) { if (param.cid == null) { int?nullable = null; using (ShoppingCart cart = ShoppingCart.CreateFromSession(base.Session)) { cart.PartnerAlias = param.PartnerAlias; cart.PartnerSessionID = param.psid; BookingOrder item = new BookingOrder { orderid = Guid.NewGuid().ToString(), excursion = param.excursion }; cart.Orders.Add(item); nullable = new int?(cart.Orders.Count); } return(base.Json(new { ok = true, ordercount = nullable })); } WebPartner partner = UserToolsProvider.GetPartner(param); BookingOrder order2 = new BookingOrder { orderid = Guid.NewGuid().ToString(), excursion = param.excursion }; ExternalCartAddOrderResult result = BookingProvider.ExternalCart_AddOrder(UrlLanguage.CurrentLanguage, partner, param.cid, order2); if (result.errorcode == 0) { return(base.Json(new { ok = true, ordercount = result.ordercount })); } list.Add(result.errormessage); } else { list.Add(ExcursionStrings.ResourceManager.Get("ErrorGuestCount")); } } else { list.Add(ExcursionStrings.ResourceManager.Get("ErrorInvalidParams")); } return(base.Json(new { errormessages = list.ToArray() })); }
public FilterDetailsResult FilterDetails([FromUri] FiltersParam param) { if (param == null) { throw new ArgumentNullException("param"); } WebPartner partner = UserToolsProvider.GetPartner(param); if (!(param.StartPoint.HasValue || (param.StartPointAlias == null))) { param.sp = new int?(CatalogProvider.GetGeoPointIdByAlias(param.StartPointAlias)); } return(GetCachedFilterDetails(param, partner)); }
public ReservationState Calculate([FromUri] BookingCartParam param, [FromBody] BookingClaim claim) { if (param == null) { throw new ArgumentNullException("param"); } if (claim == null) { throw new ArgumentNullException("claim"); } WebPartner partner = UserToolsProvider.GetPartner(param); return(BookingProvider.DoCalculation(param.Language, partner.id, claim)); }
public ExcursionDateList Dates(int id, [FromUri] DatesParam param) { if (param == null) { throw new ArgumentNullException("param"); } WebPartner partner = UserToolsProvider.GetPartner(param); if (!param.FirstDate.HasValue) { throw new ArgumentNullExceptionWithCode(0x67, "firstadate"); } if (!param.LastDate.HasValue) { throw new ArgumentNullExceptionWithCode(0x68, "lastdate"); } return(new ExcursionDateList(ExcursionProvider.GetDates(partner.id, id, param.FirstDate.Value, param.LastDate.Value))); }
public CheckPromoCodeResult CheckPromoCode([FromUri] BookingCartParam param, [FromBody] BookingClaim claim, [FromUri] string promocode) { if (param == null) { throw new ArgumentNullException("param"); } if (claim == null) { throw new ArgumentNullException("claim"); } if (string.IsNullOrEmpty(promocode)) { throw new ArgumentNullException("promocode"); } WebPartner partner = UserToolsProvider.GetPartner(param); return(BookingProvider.CheckExcursionPromoCode(param.Language, partner.id, claim, promocode)); }
public CatalogResult Catalog([FromUri] CatalogParam param) { if (param == null) { throw new System.ArgumentNullException("param"); } if (param.dp != null) { param.d = null; } WebPartner partner = UserToolsProvider.GetPartner(param); if (!param.StartPoint.HasValue && param.StartPointAlias != null) { param.sp = new int?(CatalogProvider.GetGeoPointIdByAlias(param.StartPointAlias)); } ExcursionProvider.ExcursionSorting sorting = (!string.IsNullOrEmpty(param.SortOrder)) ? ((ExcursionProvider.ExcursionSorting)System.Enum.Parse(typeof(ExcursionProvider.ExcursionSorting), param.SortOrder)) : ExcursionProvider.ExcursionSorting.name; //получить id экскурсий в регионе //фильтровать по id CatalogResult result = new CatalogResult(); result.excursions = ExcursionProvider.FindExcursions(param.Language, partner.id, param.FirstDate, param.LastDate, param.SearchLimit, param.StartPoint, param.SearchText, param.Categories, param.Departures, (param.Destinations != null && param.Destinations.Length > 0) ? param.Destinations : (param.DestinationState.HasValue ? new int[] { param.DestinationState.Value } : null), param.ExcursionLanguages, param.MinDuration, param.MaxDuration, new ExcursionProvider.ExcursionSorting?(sorting), param.WithoutPrice); System.Collections.Generic.Dictionary <int, ExcursionRank> rankings = SurveyProvider.GetExcursionsRanking(( from m in result.excursions select m.excursion.id).ToList <int>(), param.Language); foreach (CatalogExcursionMinPrice excursion in result.excursions) { ExcursionRank rank = null; if (rankings.TryGetValue(excursion.excursion.id, out rank)) { excursion.ranking = CatalogExcursionRanking.Create(rank, param.Language); } } return(result); }
public ReservationState State(int?id, [FromUri] StatusParams param) { Func <GuestClaim, bool> func = null; if (!id.HasValue) { throw new ArgumentNullExceptionWithCode(110, "id"); } if (param == null) { throw new ArgumentNullException("param"); } WebPartner partner = UserToolsProvider.GetPartner(param); ReservationState result = BookingProvider.GetReservationState(param.Language, id.Value); ReservationState result2; if (result != null && result.claimId.HasValue) { if (param.PartnerSessionID != null && result.partner != null && result.partner.id == partner.id) { result2 = result; return(result2); } if (WebSecurity.CurrentUserId > 0) { System.Collections.Generic.List <GuestClaim> claims = GuestProvider.GetLinkedClaims(param.Language, WebSecurity.CurrentUserId); bool arg_10E_0; if (claims != null) { arg_10E_0 = (claims.FirstOrDefault((GuestClaim m) => m.claim == result.claimId.Value) == null); } else { arg_10E_0 = true; } if (!arg_10E_0) { result2 = result; return(result2); } } } return(null); }
public DestinationsAndCategoryGroupsResult DestinationsAndCategoryGroups([FromUri] DestinationAndCategoryParam param) { if (param == null) { throw new ArgumentNullException("param"); } WebPartner partner = UserToolsProvider.GetPartner(param); if (!(param.StartPoint.HasValue || (param.StartPointAlias == null))) { param.sp = new int?(CatalogProvider.GetGeoPointIdByAlias(param.StartPointAlias)); } DestinationsAndCategoryGroupsResult result = new DestinationsAndCategoryGroupsResult(); FilterDetailsResult cachedFilterDetails = GetCachedFilterDetails(param, partner); result.destinationstates = cachedFilterDetails.destinationstates; result.categorygroups = ExcursionProvider.GetCategoriesByGroup(param.Language, param.StartPoint); return(result); }
public FiltersResult Filters([FromUri] FiltersParam param) { if (param == null) { throw new ArgumentNullException("param"); } WebPartner partner = UserToolsProvider.GetPartner(param); if (!(param.StartPoint.HasValue || (param.StartPointAlias == null))) { param.sp = new int?(CatalogProvider.GetGeoPointIdByAlias(param.StartPointAlias)); } object[] args = new object[5]; args[0] = param.Language; args[1] = partner.id; args[2] = param.StartPoint.HasValue ? param.StartPoint.ToString() : "-"; int?destinationState = param.DestinationState; args[3] = destinationState.HasValue ? (destinationState = param.DestinationState).ToString() : "-"; args[4] = param.WithoutPrice; string key = string.Format("cache_filterResult[ln:{0}][p:{1}][sp:{2}][st:{3}][wp:{4}]", args); FiltersResult result = HttpContext.Current.Cache[key] as FiltersResult; if ((result == null) || Settings.IsCacheDisabled) { result = new FiltersResult(); DateTime?startDate = null; TimeSpan?minDuration = null; List <CatalogExcursionMinPrice> catalog = ExcursionProvider.FindExcursions(param.Language, partner.id, startDate, null, null, param.StartPoint, null, null, null, param.DestinationState.HasValue ? new int[] { param.DestinationState.Value } : null, null, minDuration, null, null, param.WithoutPrice); result.categorygroups = ExcursionProvider.BuildFilterCategories(catalog, null); result.destinations = ExcursionProvider.BuildFilterDestinations(catalog, null); result.languages = ExcursionProvider.BuildFilterLanguages(catalog, null); result.durations = ExcursionProvider.BuildFilterDurations(catalog); HttpContext.Current.Cache.Add(key, result, null, DateTime.Now.AddMinutes(10.0), Cache.NoSlidingExpiration, CacheItemPriority.Normal, null); } return(result); }
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); }
private void SendRegistrationConfirmMail(ConfirmMailOperation action, string userName, string confirmationToken) { if (string.IsNullOrEmpty(userName)) { throw new ArgumentNullException("userName"); } if (string.IsNullOrEmpty(confirmationToken)) { throw new ArgumentNullException("confirmationToken"); } string content = null; switch (action) { case ConfirmMailOperation.confirm: content = new Uri(base.Request.BaseServerAddress(), base.Url.Action("confirm", new { email = userName, token = confirmationToken })).ToString(); break; case ConfirmMailOperation.recovery: content = new Uri(base.Request.BaseServerAddress(), base.Url.Action("resetpassword", new { token = confirmationToken })).ToString(); break; } UserToolsProvider.UmgRaiseMessage(UrlLanguage.CurrentLanguage, "Guest Service Registration", userName, "GS_REGCONFIRM", new XElement("guestServiceRegistration", new object[] { new XAttribute("action", action.ToString()), new XElement("confirmUrl", content), new XElement("email", userName) }).ToString()); }