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(); } }