コード例 #1
0
        protected void Page_Init(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                var multiView = (MultiView)AuthControl.FindControl("AuthMultiView");
                if (Request.Params["sp"] != null &&
                    (Session["UserSession"] == null || (Session["UserSession"] != null && string.Equals(Request.Params["sp"], (string)Session["UserSession"], StringComparison.OrdinalIgnoreCase))) &&
                    multiView != null)
                {
                    ShowAuth = true;
                    multiView.ActiveViewIndex = 3;
                }

                if (Request.Params["reg"] != null &&
                    string.Equals(Request.Params["reg"], "true", StringComparison.OrdinalIgnoreCase) &&
                    Session["UserSession"] == null &&
                    multiView != null)
                {
                    multiView.ActiveViewIndex = 0;
                    ShowAuth = true;
                }
            }

            if (PublicCustomerInfos != null)
            {
                PublicCustomerCredits = _customerCreditRepository.GetById(PublicCustomerInfos.CustomerId);
            }
        }
コード例 #2
0
        private void CheckShowAuth()
        {
            var multiView = (MultiView)AuthControl.FindControl("AuthMultiView");

            if (Request.Params["sp"] != null &&
                (Session["UserSession"] == null || (Session["UserSession"] != null && string.Equals(Request.Params["sp"], (string)Session["UserSession"], StringComparison.OrdinalIgnoreCase))) &&
                multiView != null)
            {
                ShowAuth = true;
                multiView.ActiveViewIndex = 3;
            }
            if (Request.Params["reg"] != null &&
                string.Equals(Request.Params["reg"], "true", StringComparison.OrdinalIgnoreCase) &&
                Session["UserSession"] == null && multiView != null)
            {
                multiView.ActiveViewIndex = 0;
                ShowAuth = true;
            }
        }
コード例 #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var multiView = (MultiView)AuthControl.FindControl("AuthMultiView");

            if (Request.Params["sp"] != null &&
                (Session["UserSession"] == null || (Session["UserSession"] != null && string.Equals(Request.Params["sp"], (string)Session["UserSession"], StringComparison.OrdinalIgnoreCase))) &&
                multiView != null)
            {
                ShowAuth = true;
                multiView.ActiveViewIndex = 3;
            }

            if (Request.Params["reg"] != null &&
                string.Equals(Request.Params["reg"], "true", StringComparison.OrdinalIgnoreCase) &&
                Session["UserSession"] == null && multiView != null)
            {
                multiView.ActiveViewIndex = 0;
                ShowAuth = true;
            }
        }
コード例 #4
0
        protected void Page_Init(object sender, EventArgs e)
        {
            if (Page.RouteData.Values["SubscriptionId"] != null)
            {
                int id;
                int.TryParse((string)Page.RouteData.Values["SubscriptionId"], out id);
                PublicSubscription = _subscriptionRepository.GetById(id);
            }

            //goBack.HRef = AppConfiguration.LandingPageSubscription;

            if (!IsPostBack)
            {
                hotelname.Text    = PublicSubscription.Name;
                Neighborhood.Text = PublicSubscription.ProductHighlight;

                var multiView = (MultiView)AuthControl.FindControl("AuthMultiView");
                if (Request.Params["sp"] != null &&
                    (Session["UserSession"] == null || (Session["UserSession"] != null && string.Equals(Request.Params["sp"], (string)Session["UserSession"], StringComparison.OrdinalIgnoreCase))) &&
                    multiView != null)
                {
                    ShowAuth = true;
                    multiView.ActiveViewIndex = 3;
                }

                if (Request.Params["reg"] != null &&
                    string.Equals(Request.Params["reg"], "true", StringComparison.OrdinalIgnoreCase) &&
                    Session["UserSession"] == null &&
                    multiView != null)
                {
                    multiView.ActiveViewIndex = 0;
                    ShowAuth = true;
                }
            }

            if (PublicCustomerInfos != null)
            {
                PublicCustomerCredits = _customerCreditRepository.GetById(PublicCustomerInfos.CustomerId);
            }
        }
コード例 #5
0
        protected void Page_Init(object sender, EventArgs e)
        {
            if (Master == null)
            {
                throw new HttpException(404, ErrorMessage.MasterNotFound);
            }
            HtmlGenericControl body = (HtmlGenericControl)Master.FindControl("body");

            body.Attributes["class"] += " product-page";

            // Search Production with same reason
            var markets = _productRepository.MarketList.FirstOrDefault(m => m.Permalink == (string)Page.RouteData.Values["market"] && m.IsActive) ??
                          _productRepository.MarketList.First(m => m.IsDefault);
            int totalGuest = 2;

            if (Session["Guest"] != null)
            {
                int.TryParse(Session["Guest"].ToString(), out totalGuest);
            }

            DateTime selectedDate = DateTime.UtcNow.ToLosAngerlesTimeWithTimeZone(PublicHotel != null ? PublicHotel.TimeZoneId : string.Empty);

            if (Session["CheckInDateSearch"] != null)
            {
                DateTime.TryParseExact((string)Session["CheckInDateSearch"], "MM/dd/yyyy", null,
                                       DateTimeStyles.None, out selectedDate);
            }

            _searchParams = new SearchParams
            {
                CustomerId    = PublicCustomerInfos != null ? PublicCustomerInfos.CustomerId : 0,
                SearchMarkets = markets,
                ProductType   = new List <Enums.ProductType> {
                    Enums.ProductType.DayPass
                },
                AvailableTickets = totalGuest,
                StartDate        = selectedDate
            };

            if (Page.RouteData.Values["hotelName"] != null)
            {
                if (Page.RouteData.Values["id"] != null)
                {
                    if (int.TryParse(Page.RouteData.Values["id"].ToString(), out _productId))
                    {
                        PublicProduct = _productRepository.GetById(_productId, _searchParams);
                    }
                }

                if (PublicProduct == null)
                {
                    PublicProduct = _productRepository.GetProductsByName((string)Page.RouteData.Values["hotelName"],
                                                                         (string)Page.RouteData.Values["productName"],
                                                                         (string)Session["UserSession"]);

                    if (IsPostBack && PublicProduct != null && PublicProduct.Similarproduct == null)
                    {
                        PublicProduct = _productRepository.GetById(PublicProduct.ProductId, _searchParams);
                        HotelRatingPanel.Update();
                    }
                }

                if (!IsPostBack)
                {
                    // Maintain old Url of Survey
                    if (PublicProduct == null && Page.RouteData.Values["id"] != null && _productId <= 0)
                    {
                        var reviews = _surveyRepository.GetSurveysByCode(Page.RouteData.Values["id"].ToString());
                        if (reviews != null)
                        {
                            var bookings = _surveyRepository.BookingList
                                           .FirstOrDefault(b => b.BookingId == reviews.BookingId);
                            if (bookings != null)
                            {
                                PublicProduct = _productRepository.GetById(bookings.ProductId);
                                var newProductUrl = string.Format("/{0}/{1}/{2}/{3}/{4}",
                                                                  Page.RouteData.Values["market"],
                                                                  PublicProduct.Hotels.CityUrl,
                                                                  PublicProduct.Hotels.HotelNameUrl,
                                                                  PublicProduct.ProductNameUrl,
                                                                  reviews.Code);
                                Response.Redirect(Helper.ResolveRelativeToAbsoluteUrl(Request.Url, newProductUrl), true);
                            }
                        }
                    }

                    // Maintain old Url of Product
                    if (PublicProduct == null && Page.RouteData.Values["id"] == null)
                    {
                        PublicProduct = _productRepository.GetProductByHotelName((string)Page.RouteData.Values["hotelName"]);
                        var newProductUrl = string.Format("/{0}/{1}/{2}/{3}/{4}",
                                                          Page.RouteData.Values["market"],
                                                          PublicProduct.Hotels.CityUrl,
                                                          PublicProduct.Hotels.HotelNameUrl,
                                                          PublicProduct.ProductNameUrl,
                                                          PublicProduct.ProductId);
                        Response.Redirect(Helper.ResolveRelativeToAbsoluteUrl(Request.Url, newProductUrl), true);
                    }

                    PublicHotel = _productRepository.HotelList.First(h => h.HotelId == PublicProduct.HotelId);

                    // Do not have permission to view this page
                    if (PublicHotel != null &&
                        !PublicHotel.IsPublished &&
                        (PublicCustomerInfos == null || !PublicCustomerInfos.IsAdmin))
                    {
                        Response.Redirect(Constant.SearchPageDefault);
                    }

                    if (Session["CheckInDateSearch"] == null && PublicProduct != null && PublicProduct.ProductType == (int)Enums.ProductType.AddOns)
                    {
                        var productHaveBooking = (from p in _productRepository.ProductList
                                                  join ap in _productRepository.ProductAddOnList on p.ProductId equals ap.AddOnId
                                                  where ap.AddOnId == PublicProduct.ProductId
                                                  select ap.ProductId).FirstOrDefault();
                        var bookings =
                            _productRepository.BookingList.FirstOrDefault(
                                b => b.ProductId == productHaveBooking && b.CheckinDate.HasValue &&
                                b.CheckinDate.Value.ToLosAngerlesTimeWithTimeZone(PublicHotel.TimeZoneId).Date >= DateTime.UtcNow.ToLosAngerlesTimeWithTimeZone(PublicHotel.TimeZoneId).Date);

                        if (bookings != null && bookings.CheckinDate.HasValue)
                        {
                            Session["CheckInDateSearch"] = bookings.CheckinDate.Value.ToLosAngerlesTimeWithTimeZone(PublicHotel.TimeZoneId).Date
                                                           .ToString("MM/dd/yyyy");
                        }
                    }

                    var sessionCheckInDate = Session["CheckInDateSearch"];
                    if (sessionCheckInDate != null || PublicProduct.IsOnBlackOutDay)
                    {
                        // On Blackout Day
                        if (sessionCheckInDate != null && !string.IsNullOrEmpty(sessionCheckInDate.ToString()))
                        {
                            DateTime.TryParseExact(sessionCheckInDate.ToString(), "MM/dd/yyyy", null, DateTimeStyles.None, out _selectedCheckInDate);
                        }
                        if (!IsPostBack && PublicProduct.IsOnBlackOutDay)
                        {
                            _selectedCheckInDate = PublicProduct.NextAvailableDate;
                        }
                    }
                    else if (PublicCustomerInfos != null && PublicProduct.ProductType == (int)Enums.ProductType.AddOns)
                    {
                        _selectedCheckInDate = _productRepository.GetMostRecentDate(PublicCustomerInfos.CustomerId);
                    }
                    else
                    {
                        _selectedCheckInDate = DateTime.UtcNow.ToLosAngerlesTime();
                    }

                    if (Session["TotalTickets"] != null)
                    {
                        TotalTicketsText.Text = Session["TotalTickets"].ToString();
                    }
                    else
                    {
                        TotalTicketsText.Text = PublicProduct.ProductType == (int)Enums.ProductType.DayPass ? "2" : "1";
                    }

                    TotalTickets = int.Parse(TotalTicketsText.Text);

                    CheckInDateTextMobile.Text   = _selectedCheckInDate.ToString(Constant.DiscountDateFormat);
                    CheckInDateTextDesktop.Text  = _selectedCheckInDate.ToString(Constant.DiscountDateFormat);
                    HidSelectedDateBefore.Value  = _selectedCheckInDate.ToString(Constant.DiscountDateFormat);
                    Session["CheckInDateSearch"] = _selectedCheckInDate.ToString(Constant.DiscountDateFormat);
                    _searchParams.StartDate      = _selectedCheckInDate;
                    CheckHaveBookingOnSelectedDate(_selectedCheckInDate);
                    var price = _productRepository.GetById(PublicProduct.ProductId, _searchParams).ActualPriceWithDate;
                    BindPrice(price);

                    HidSelectedDate.Value = "1";
                    BindSurvey();

                    var multiView = (MultiView)AuthControl.FindControl("AuthMultiView");

                    if (Request.Params["sp"] != null &&
                        (Session["UserSession"] == null || (Session["UserSession"] != null && string.Equals(Request.Params["sp"], (string)Session["UserSession"], StringComparison.OrdinalIgnoreCase))) &&
                        multiView != null)
                    {
                        ShowAuth = true;
                        multiView.ActiveViewIndex = 3;
                    }

                    if (Request.Params["reg"] != null &&
                        string.Equals(Request.Params["reg"], "true", StringComparison.OrdinalIgnoreCase) &&
                        Session["UserSession"] == null &&
                        multiView != null)
                    {
                        multiView.ActiveViewIndex = 0;
                        ShowAuth = true;
                    }

                    if (Request.Browser["IsMobileDevice"] == "true")
                    {
                        CheckInDateTextMobile.Visible = false;
                    }

                    // Reviews
                    if (Page.RouteData.Values["id"] == null && _productId == 0)
                    {
                        Survey.Visible = false;
                    }

                    if (PublicCustomerInfos != null)
                    {
                        EmailAddressText.Text = PublicCustomerInfos.EmailAddress;
                    }

                    CheckInDateRequestText.Text = _productRepository.GetFirstSoldOutDate(PublicProduct.ProductId)
                                                  .ToString("MMMM dd, yyyy");
                }
            }

            if (PublicProduct == null)
            {
                if (PublicCustomerInfos != null && !string.IsNullOrEmpty(PublicCustomerInfos.BrowsePassUrl))
                {
                    Response.Redirect(PublicCustomerInfos.BrowsePassUrl);
                }
                Response.Redirect(!string.IsNullOrEmpty((string)Session["SearchPage"])
                    ? Session["SearchPage"].ToString()
                    : Constant.SearchPageDefault);
            }

            PublicHotel = _productRepository.HotelList.First(h => h.HotelId == PublicProduct.HotelId);

            PublicMarkets = _productRepository.GetMarketsByHotelId(PublicProduct.HotelId);

            goBack.HRef = GetUrlSearchPage();

            BindProductInfo();

            SetMetaHeaderInfo();

            BindAmenties();

            var    tickets = _productRepository.GetTicketsFuture(PublicProduct.ProductId);
            string json    = JsonConvert.SerializeObject(tickets, CustomSettings.SerializerSettings());

            PublicTickets = json;
        }