private void BindPrice(ActualPriceObject price = null, DateTime?selectedCheckInDate = null) { double actualPrice = PublicProduct.LowestPrice; double msrpPrice = PublicProduct.LowestPrice; double discountPrice = PublicProduct.LowestUpgradeDiscount; if (price != null) { actualPrice = price.Price; msrpPrice = price.Price; discountPrice = price.DiscountPrice; } RegularPrice = msrpPrice; var maxGuest = (PublicProduct.MaxGuest <= 0 ? Constant.DefaultMaxGuest : PublicProduct.MaxGuest); bool isShowMsrp = false; // Upgrade ? if (Session[Constant.UpgradeKey] != null) { int bookingTempId = int.Parse(Session[Constant.UpgradeKey].ToString()); var bookingsTemps = _productRepository.GetBookingsTempById(bookingTempId).Item1; actualPrice = actualPrice - discountPrice - bookingsTemps.HotelPrice; if (actualPrice <= 0) { actualPrice = 0; } msrp.Visible = true; msrp2.Visible = true; isShowMsrp = true; AnchorButton.InnerText = "Upgrade Now"; } else { var discounts = _productRepository.GetAutoPromosByProductId(PublicProduct.ProductId, selectedCheckInDate).FirstOrDefault(); if (discounts != null) { if (PublicCustomerInfos != null) { discounts = _discountRepository.VerifyDiscounts(discounts, PublicCustomerInfos.CustomerId); } if (discounts != null) { actualPrice = Helper.CalculateDiscount(discounts, actualPrice, 1); if (!actualPrice.Equals(msrpPrice)) { msrp.Visible = true; msrp2.Visible = true; isShowMsrp = true; } } } } int index = 0; if (PublicDiscounts != null && !IsHaveBookingWithSelectedDate && TotalActiveBookingWithSubscription < AppConfiguration.MaxReserveSubscriptionPass && _selectedCheckInDate.Date <= DateTime.UtcNow.AddHours(AppConfiguration.ReserveSubscriptionPassInHours).ToLosAngerlesTimeWithTimeZone(PublicHotel.TimeZoneId).Date&& PublicProduct.ProductType == (int)Enums.ProductType.DayPass && TotalBookingInCurrentRecycle < PublicDiscounts.MaxPurchases) { index = 1; if (!RegularPrice.Equals(actualPrice)) { msrp.Visible = true; msrp2.Visible = true; isShowMsrp = true; } } if (isShowMsrp) { priceMobile.Attributes["class"] += " has-promo"; priceDesktop.Attributes["class"] += " has-promo"; DiscountPrice = actualPrice; PerGuestLitMobile.Text = string.Format("<span class=\"price\">{0}</span><span class=\"upto-guest\">{1}</span>", Helper.FormatPrice(actualPrice * (TotalTickets - index)), Helper.GetStringMaxGuest(maxGuest * TotalTickets)); PerGuestLit2.Text = string.Format("<div>{0} <span>per guest</span></div>", Helper.FormatPrice(actualPrice / maxGuest)); TotalLit.Text = string.Format("<div class=\"total-price\">{0} <span>{1}</span></div>", Helper.FormatPrice(actualPrice * (TotalTickets - index)), Helper.GetStringMaxGuest(maxGuest * TotalTickets)); PerGuestMsrpLitMobile.Text = string.Format("was <i>{0}</i>", Helper.FormatPrice(msrpPrice * TotalTickets)); PerGuestMsrpLit2.Text = string.Format("was <i>{0}</i>", Helper.FormatPrice(msrpPrice / maxGuest)); } else { PerGuestLitMobile.Text = string.Format("<span class=\"price\">{0}</span><span class=\"upto-guest\">{1}</span>", Helper.FormatPrice(actualPrice * (TotalTickets - index)), Helper.GetStringMaxGuest(maxGuest * TotalTickets)); PerGuestLit2.Text = string.Format("<div>{0} <span>per guest</span></div>", Helper.FormatPrice(actualPrice / maxGuest)); TotalLit.Text = string.Format("<div class=\"total-price\">{0} <span>{1}</span></div>", Helper.FormatPrice(actualPrice * (TotalTickets - index)), Helper.GetStringMaxGuest(maxGuest * TotalTickets)); PerGuestMsrpLit2.Text = "per guest"; } GuestLit.Text = string.Format("{0} Guests", maxGuest * TotalTickets == 1 ? "" : (maxGuest * TotalTickets).ToString()); if (selectedCheckInDate.HasValue) { _searchParams.StartDate = selectedCheckInDate.Value; PublicProduct = PublicProduct = _productRepository.GetById(_productId, _searchParams); LvRelatedProductsRepeater.DataSource = PublicProduct.RelatedProducts; LvRelatedProductsRepeater.DataBind(); SimilarProductLv.DataSource = PublicProduct.Similarproduct; SimilarProductLv.DataBind(); } }
private void BindProductInfo() { PublicImages = PublicProduct.PhotoUrls; if (!PublicImages.Any()) { PublicImages = new [] { Constant.ImageDefault }; } streetname.Text = PublicHotel.StreetAddress; // Related Product With Price on Check-In date selectecd LvRelatedProductsRepeater.DataSource = PublicProduct.RelatedProducts; LvRelatedProductsRepeater.DataBind(); SimilarProductLv.DataSource = PublicProduct.Similarproduct; SimilarProductLv.DataBind(); if (PublicProduct.FinePrint.Any()) { RptFinePrint.DataSource = PublicProduct.FinePrint; RptFinePrint.DataBind(); } if (PublicProduct.RelatedProducts.Any()) { moreAtHotelRow.Visible = true; afterMoreAtRow.Visible = true; } if (!IsPostBack) { try { // Get FAQs from services var faqContent = Helper.Get(Constant.FaqUrl); var faqs = JsonConvert.DeserializeObject <FaqResultObject>(faqContent); if (faqs.Count > 0) { RptFaqs.DataSource = faqs.Articles.Take(10); RptFaqs.DataBind(); } } catch (Exception) { } CityStateZip.Text = string.Format("{0}, {1} {2}", PublicHotel.City, PublicHotel.State, PublicHotel.ZipCode); WhyWeLikeIt.Text = PublicHotel.Recommendation; if (!string.IsNullOrEmpty(PublicProduct.WhatYouGet)) { wrapWhatYouGet.Visible = true; WhatYouGetLit.Text = PublicProduct.WhatYouGet; } if (!string.IsNullOrEmpty(PublicProduct.Service)) { wrapYourService.Visible = true; YourServiceLit.Text = PublicProduct.Service; } HotelNameLit.Text = Helper.GetHotelName(PublicProduct); if (PublicHotel.IsComingSoon.HasValue && PublicHotel.IsComingSoon.Value) { priceMobile.Visible = false; //priceDesktop.Visible = false; msrp.Visible = false; msrp2.Visible = false; PerGuestLit2.Visible = true; PerGuestLit2.Text = "<div>Coming Soon</div>"; book.Attributes["class"] += " coming-soon"; passleftDiv.Visible = true; LitPassleft.Text = Constant.CommingSoonString; AnchorButton.Visible = false; ComingSoonAnchorButton.Visible = true; } else { AnchorButton.Visible = true; ComingSoonAnchorButton.Visible = false; } var blockedDates = _productRepository.BlockedDatesCustomPriceList .Where(bd => bd.ProductId == PublicProduct.ProductId && bd.Capacity == 0 && bd.Date.Date >= DateTime.UtcNow.ToLosAngerlesTimeWithTimeZone(PublicHotel.TimeZoneId).Date) .Select(b => "'" + b.Date.ToString("MM/dd/yyyy") + "'") .ToList(); var date = DateTime.UtcNow.ToLosAngerlesTimeWithTimeZone(PublicHotel.TimeZoneId); if (date.Hour > 19) { blockedDates.Add(string.Format("'{0}'", date.ToString("MM/dd/yyyy"))); } ProductBlockoutDate = string.Format("[{0}]", String.Join(",", blockedDates)); KidAllowLabel.Text = PublicProduct.ProductKidAllowedString.ToUpper(); } var listProducts = PublicProduct.RelatedProducts ?? new List <Products>(); if (PublicProduct.Similarproduct != null) { listProducts.AddRange(PublicProduct.Similarproduct); } listProducts = listProducts.DistinctBy(x => x.ProductId).ToList(); const string mixpanelscript = "MixpanelScript"; string strScript = string.Empty; listProducts.ForEach(item => { strScript += Helper.GetMixpanelScriptRedirect(item.ProductId, string.Format("/{0}/{1}/{2}/{3}/{4}", Page.RouteData.Values["market"] ?? "socal", Helper.ReplaceSpecialCharacter(item.Hotels.City), Helper.ReplaceSpecialCharacter(item.Hotels.HotelName), Helper.ReplaceSpecialCharacter(item.ProductName), item.ProductId)); }); if (!string.IsNullOrEmpty(strScript)) { ClientScript.RegisterClientScriptBlock(GetType(), mixpanelscript, strScript, true); } }