Beispiel #1
0
        protected override void OnInit(EventArgs e)
        {
            if (!Request.IsLocal && !Request.IsSecureConnection)
            {
                string redirectUrl = Request.Url.ToString().Replace("http:", "https:");
                Response.Redirect(redirectUrl, false);
                HttpContext.Current.ApplicationInstance.CompleteRequest();
            }
            if (Context.Session != null)
            {
                string sessionUser  = Session["CurrentUser"] != null ? Session["CurrentUser"].ToString() : string.Empty;
                string sessionHotel = Session["Hotel"] != null ? Session["Hotel"].ToString() : string.Empty;
                if (!string.IsNullOrEmpty(sessionUser))
                {
                    PublicCustomerInfos = JsonConvert.DeserializeObject <CustomerInfos>(sessionUser);
                }
                if (!string.IsNullOrEmpty(sessionHotel) && !Request.Url.AbsoluteUri.Contains(Constant.HotelList))
                {
                    int hotelId = JsonConvert.DeserializeObject <int>(sessionHotel);
                    PublicHotel = _hotelRepository.GetById(hotelId);
                }
            }

            if (PublicCustomerInfos == null || !PublicCustomerInfos.IsActive)
            {
                Response.Redirect(string.Format(Constant.SignIpPageAdmin, HttpUtility.UrlEncode(Request.Url.PathAndQuery)));
            }
            base.OnInit(e);
        }
Beispiel #2
0
        public void BookHotel(BookingSpecification bookingSpecification)
        {
            Hotel    hotel    = HotelRepository.GetById(bookingSpecification.HotelId);
            Customer costumer = CostumerRepository.GetById(bookingSpecification.CostumerId);

            hotel.Book(costumer, bookingSpecification.Dates);
        }
        protected void Page_Init(object sender, EventArgs e)
        {
            try
            {
                string sessionUser = Session["CurrentUser"] != null ? Session["CurrentUser"].ToString() : string.Empty;
                PublicUser        = JsonConvert.DeserializeObject <CustomerInfos>(sessionUser);
                Session["Active"] = "Booking";
                if (PublicUser == null)
                {
                    Response.Redirect(Constant.DefaultPage);
                }

                string sessionHotel = Session["Hotel"] != null ? Session["Hotel"].ToString() : string.Empty;
                _hotels = _hotelRepository.GetById(int.Parse(sessionHotel));

                if (!IsPostBack)
                {
                    InitSearch();
                }
            }
            catch (Exception ex)
            {
                var logs = new Logs
                {
                    LogKey         = "Admin_BookingPage_Error",
                    UpdatedBy      = PublicUser != null ? PublicUser.CustomerId : 1,
                    UpdatedDate    = DateTime.UtcNow,
                    UpdatedContent = string.Format("{0} - {1} - {2}", ex.Message, ex.StackTrace, ex.Source)
                };
                _bookingRepository.AddLog(logs);
            }
        }
Beispiel #4
0
        public Mutation(HotelRepository hotelRepository)
        {
            Field <HotelType>("createHotel",
                              arguments: new QueryArguments(new QueryArgument <NonNullGraphType <CreateHotelCommandType> >
            {
                Name = "command"
            }),
                              resolve: context =>
            {
                var command = context.GetArgument <CreateHotelCommand>("command");
                return(hotelRepository.AddHotel(command));
            });

            Field <HotelType>("addRoom",
                              arguments: new QueryArguments(
                                  new QueryArgument <NonNullGraphType <AddRoomCommandType> > {
                Name = "command"
            }),
                              resolve: context =>
            {
                var command = context.GetArgument <AddRoomCommand>("command");

                var hotel    = hotelRepository.GetById(command.HotelId);
                var newHotel = new Hotel(hotel.Id, hotel.Name, new List <Room>(hotel.Rooms)
                {
                    command.Room
                });
                return(hotelRepository.UpdateHotel(newHotel));
            });
        }
        protected void Page_Init(object sender, EventArgs e)
        {
            string sessionHotel = Session["Hotel"] != null ? Session["Hotel"].ToString() : string.Empty;

            _hotels = _hotelRepository.GetById(int.Parse(sessionHotel));
            if (_hotels == null)
            {
                Response.Redirect(Constant.HotelList);
            }
            Session["Active"] = "Iventory";

            // Add item 1 to 70
            Helper.CreateControl(DailyCapacity);
            Helper.CreateControl(CabanaDailyLimit);
            Helper.CreateControl(SpaPassDailyLimit);
            Helper.CreateControl(DayBedDailyLimit);

            if (!IsPostBack)
            {
                ReloadPass();
            }
            if (_hotels != null)
            {
                var addOns = _productRepository.GetByHotelId(_hotels.HotelId, (int)Enums.ProductType.AddOns);
                RptAddOns.DataSource = addOns;
                RptAddOns.DataBind();
            }
        }
        public IActionResult Delete(int id)
        {
            try
            {
                var hotel = hotelRepository.GetById(id);

                if (hotel == null)
                {
                    return(NotFound());
                }

                hotelRepository.DeleteById(id);

                return(Ok());
            }
            catch (Exception e)
            {
                return(StatusCode(500, e.Message));
            }
        }
Beispiel #7
0
        protected void Page_Init(object sender, EventArgs e)
        {
            try
            {
                Session["Active"] = "Revenue";
                if (Request.Params["id"] != null)
                {
                    int hotelId;
                    int.TryParse(Request.Params["id"], out hotelId);
                    _hotels          = _hotelRepository.GetHotel(hotelId, PublicCustomerInfos != null ? PublicCustomerInfos.EmailAddress : string.Empty);
                    Session["Hotel"] = _hotels.HotelId;
                }
                else
                {
                    string sessionHotel = Session["Hotel"] != null ? Session["Hotel"].ToString() : string.Empty;
                    _hotels = _hotelRepository.GetById(int.Parse(sessionHotel));
                }
                if (_hotels == null)
                {
                    Response.Redirect(Constant.HotelList);
                }

                DateFrom.Visible   = false;
                DateTo.Visible     = false;
                Search.Visible     = false;
                CustomForm.Visible = false;
                if (!IsPostBack)
                {
                    SelectedFilterBy.Text = SelectedFilterDdl.Text;
                    ProductTypeLabel.Text = ProductTypeDdl.Text;
                    var searchAllParam = new SearchAllBookingsParams
                    {
                        HotelId      = _hotels.HotelId,
                        IsForRevenue = true
                    };
                    var bookings = _bookingRepository.GetAllBookingsOfHotel(searchAllParam);
                    FilterBookingByProductType(ref bookings);
                    BindRevenue(bookings);
                }
            }
            catch (Exception ex)
            {
                var logs = new Logs
                {
                    LogKey         = "Admin_RevenuesPage_Error",
                    UpdatedBy      = PublicCustomerInfos != null ? PublicCustomerInfos.CustomerId : 1,
                    UpdatedDate    = DateTime.UtcNow,
                    UpdatedContent = string.Format("{0} - {1} - {2}", ex.Message, ex.StackTrace, ex.Source)
                };
                _bookingRepository.AddLog(logs);
            }
        }
Beispiel #8
0
        public Query(HotelRepository hotelRepository)
        {
            Field <HotelType>("Hotel",
                              arguments: new QueryArguments(new QueryArgument <NonNullGraphType <IdGraphType> >
            {
                Name = "id", Description = "The ID of the Hotel"
            }),
                              resolve: context =>
            {
                var id = context.GetArgument <int>("id");
                return(hotelRepository.GetById(id));
            });

            Field <NonNullGraphType <ListGraphType <NonNullGraphType <HotelType> > > >("Hotels",
                                                                                       resolve: context => hotelRepository.GetAllHotels());
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            var active = Session["Active"];

            if (active != null)
            {
                switch (active.ToString())
                {
                case "Calendar":
                    Calendar.Attributes.Add("class", "active");
                    break;

                case "Booking":
                    Booking.Attributes.Add("class", "active");
                    break;

                case "SalesReport":
                    SalesReport.Attributes.Add("class", "active");
                    break;

                case "Revenue":
                    Revenue.Attributes.Add("class", "active");
                    break;

                case "CustomerInsight":
                    CustomerInsight.Attributes.Add("class", "active");
                    break;

                case "Iventory":
                    Iventory.Attributes.Add("class", "active");
                    break;

                case "TargetAudienceObject":
                    TargetAudience.Attributes.Add("class", "active");
                    break;

                case "HotelListing":
                    HotelListing.Attributes.Add("class", "active");
                    break;

                case "Settings":
                    Settings.Attributes.Add("class", "active");
                    break;

                case "ProductListing":
                    ProductPage.Attributes.Add("class", "active");
                    break;

                case "SearchBookingsList":
                    SearchBookingsList.Attributes.Add("class", "active");
                    break;

                case "GiftCardList":
                    GiftCardList.Attributes.Add("class", "active");
                    break;

                case "SubscriptionList":
                    SubscriptionList.Attributes.Add("class", "active");
                    break;

                case "LogList":
                    LogList.Attributes.Add("class", "active");
                    break;

                case "EditPolicy":
                    EditPolicy.Attributes.Add("class", "active");
                    break;
                }
            }
            string sessionHotel = Session["Hotel"] != null ? Session["Hotel"].ToString() : string.Empty;

            _hotel = _hotelRepository.GetById(int.Parse(sessionHotel));
            if (sessionHotel != "0" && _hotel == null)
            {
                Response.Redirect(Constant.DefaultPage);
            }

            if (_hotel != null)
            {
                hotelName.InnerText = _hotel.HotelName;
                if (_hotel.IsMenuVisible)
                {
                    AnalyticsMenu.Visible = true;
                    ControlMenu.Visible   = true;
                }
            }
            if (_users != null)
            {
                if (_users.IsSuperAdmin)
                {
                    UserHotel.Visible          = true;
                    Markets.Visible            = true;
                    ContentsPage.Visible       = true;
                    PromoList.Visible          = true;
                    ProductPage.Visible        = true;
                    SearchBookingsList.Visible = true;
                    GiftCardList.Visible       = true;
                    SubscriptionList.Visible   = true;
                    EditPolicy.Visible         = true;
                }
                if (_users.IsCheckInOnly)
                {
                    Revenue.Visible         = false;
                    SalesReport.Visible     = false;
                    CustomerInsight.Visible = false;
                    ControlMenu.Visible     = false;
                }
            }
        }
        protected void Page_Init(object sender, EventArgs e)
        {
            if (Page.RouteData.Values["bookingId"] != null)
            {
                int bookingId;
                if (int.TryParse(Page.RouteData.Values["bookingId"].ToString(), out bookingId))
                {
                    PublicBooking = _bookingRepository.GetById(bookingId);
                }
            }

            if (PublicCustomerInfos == null)
            {
                Response.Redirect(string.Format(Constant.SignIpPage, HttpUtility.UrlEncode(Request.Url.PathAndQuery)));
            }
            else if (PublicBooking != null &&
                     PublicCustomerInfos.CustomerId != PublicBooking.CustomerId)
            {
                Response.Redirect(Constant.InvalidTicketPage);
            }

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

            PublicProduct          = _productRepository.GetById(PublicBooking != null ? PublicBooking.ProductId : 0);
            PublicHotel            = _hotelRepository.GetById(PublicProduct.HotelId);
            PublicMarkets          = _productRepository.GetMarketsByHotelId(PublicProduct.HotelId);
            ProductTypeTrackString = Helper.GetStringPassByProductType(PublicProduct.ProductType);

            if (!string.IsNullOrEmpty(PublicHotel.HotelDiscountCode) && PublicHotel.HotelDiscountPercent > 0)
            {
                DiscountRow.Visible = true;
            }
            if (Request.Browser["IsMobileDevice"] == "true")
            {
                containerDesktop.Visible = false;
                ContainerMobile.Visible  = true;
            }
            else
            {
                containerDesktop.Visible = true;
                ContainerMobile.Visible  = false;
            }

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

            PublicTickets = json;

            string tab       = string.Empty;
            var    amenties  = PublicHotel.AmentiesHotels;
            double item      = amenties.ActiveFeatures > 0 ? 12 / amenties.ActiveFeatures : 0;
            var    itemClass = item.ToString(CultureInfo.InvariantCulture);

            if (12 % amenties.ActiveFeatures != 0)
            {
                itemClass = "2-5";
            }
            string activeClass = "active";

            if (amenties.PoolActive)
            {
                tab += "<li role=\"presentation\" class=\"col-xs-" + itemClass + " " + activeClass + "\">"
                       + "<a href=\"#restaurant\" aria-controls=\"restaurant\" role=\"tab\" data-toggle=\"tab\" aria-expanded=\"true\">"
                       + "<img src=\"/images/pool-icon-white.png\" class=\"img-responsive\" />"
                       + "</a>"
                       + "<div class='tab-mask'></div></li>";
                activeClass = string.Empty;
            }
            if (amenties.GymActive)
            {
                tab += "<li role=\"presentation\" class=\"col-xs-" + itemClass + " " + activeClass + "\">"
                       + "<a href=\"#sports-club\" aria-controls=\"sports-club\" role=\"tab\" data-toggle=\"tab\" aria-expanded=\"false\">"
                       + "<img src=\"/images/gym-white.png\" alt=\"\" class=\"img-responsive\" />"
                       + "</a>"
                       + "<div class='tab-mask'></div></li>";
                activeClass = string.Empty;
            }
            if (amenties.SpaActive)
            {
                tab += "<li role=\"presentation\" class=\"col-xs-" + itemClass + " " + activeClass + "\">"
                       + "<a href=\"#spa-club\" aria-controls=\"spa-club\" role=\"tab\" data-toggle=\"tab\" aria-expanded=\"false\">"
                       + "<img src=\"/images/spa-white.png\" alt=\"\" class=\"img-responsive\" />"
                       + "</a>"
                       + "<div class='tab-mask'></div></li>";
                activeClass = string.Empty;
            }
            if (amenties.BusinessActive)
            {
                tab += "<li role=\"presentation\" class=\"col-xs-" + itemClass + " " + activeClass + "\">"
                       + "<a href=\"#pick-up\" class=\"pick-up\" aria-controls=\"pick-up\" role=\"tab\" data-toggle=\"tab\" aria-expanded=\"false\">"
                       + "<img src=\"/images/handshake-white.png\" alt=\"\" class=\"img-responsive\" />"
                       + "</a>"
                       + "<div class='tab-mask'></div></li>";
            }
            if (amenties.DinningActive)
            {
                tab += "<li role=\"presentation\" class=\"col-xs-" + itemClass + " " + activeClass + "\">"
                       + "<a href=\"#dining\" class=\"dining\" aria-controls=\"dining\" role=\"tab\" data-toggle=\"tab\" aria-expanded=\"false\">"
                       + "<img src=\"/images/icon_dinning.png\" alt=\"\" class=\"img-responsive\" />"
                       + "</a>"
                       + "<div class='tab-mask'></div></li>";
            }
            if (amenties.EventActive)
            {
                tab += "<li role=\"presentation\" class=\"col-xs-" + itemClass + " " + activeClass + "\">"
                       + "<a href=\"#event\" class=\"event\" aria-controls=\"event\" role=\"tab\" data-toggle=\"tab\" aria-expanded=\"false\">"
                       + "<img src=\"/images/icon_event.png\" alt=\"\" class=\"img-responsive\" />"
                       + "</a>"
                       + "<div class='tab-mask'></div></li>";
            }
            LiMainTab.Text = tab;

            KidAllowLabel.Text   = PublicProduct.KidAllowedString;
            CheckInPlaceLit.Text = string.Format("AT {0}",
                                                 string.IsNullOrEmpty(PublicHotel.CheckInPlace) ? Constant.FrontDeskString : PublicHotel.CheckInPlace);

            if (!IsPostBack)
            {
                CheckInDateText.Text = PublicBooking.CheckinDate.HasValue && PublicBooking.CheckinDate.Value.Date != DateTime.MinValue ?
                                       PublicBooking.CheckinDate.Value.ToLosAngerlesTimeWithTimeZone(PublicHotel.TimeZoneId).ToString(Constant.DateFormat) : "Not Selected";
            }

            BindExpiredDate();
        }