예제 #1
0
        private void RebindHotelsFromSession()
        {
            var userHotelses = (List <CustomerInfosHotels>)Session["UserHotel"];

            RptHotelListings.DataSource = userHotelses;
            RptHotelListings.DataBind();
        }
예제 #2
0
        protected void Next_OnClick(object sender, EventArgs e)
        {
            int currentPage = int.Parse(Session["CurrentPage"].ToString());
            var hotels      = _marketRepositoty.GetAll().Skip(currentPage * Constant.ItemPerPage).Take(Constant.ItemPerPage).ToList();

            if (hotels.Any())
            {
                Session["CurrentPage"]      = currentPage + 1;
                RptHotelListings.DataSource = hotels;
                RptHotelListings.DataBind();
            }
        }
        protected void Previous_OnClick(object sender, EventArgs e)
        {
            int currentPage = int.Parse(Session["CurrentPage"].ToString());
            var hotels      = _hotelRepository.SearchHotelsByUser(PublicCustomerInfos.EmailAddress)
                              .Skip((currentPage - 2) * Constant.ItemPerPage)
                              .Take(Constant.ItemPerPage)
                              .ToList();

            if (hotels.Any() && currentPage - 2 >= 0)
            {
                Session["CurrentPage"]      = currentPage - 1;
                RptHotelListings.DataSource = hotels;
                RptHotelListings.DataBind();
            }
        }
        protected void Next_OnClick(object sender, EventArgs e)
        {
            int currentPage = int.Parse(Session["CurrentPage"].ToString());
            var hotels      = _hotelRepository.SearchHotelsByUser(PublicCustomerInfos.EmailAddress)
                              .Skip(currentPage * Constant.ItemPerPage)
                              .Take(Constant.ItemPerPage)
                              .ToList();

            if (hotels.Any())
            {
                //UpdateHotelTimeZone(hotels);
                Session["CurrentPage"]      = currentPage + 1;
                RptHotelListings.DataSource = hotels;
                RptHotelListings.DataBind();
            }
        }
예제 #5
0
        private void RebindHotelsByMarket()
        {
            var allHotels = _hotelRepository.SearchHotelsByCode();

            var allHotelsMarkets     = _marketHotelRepository.GetAll();
            var hotelExistsInMarkets = allHotels
                                       .Where(x => allHotelsMarkets.Select(y => y.HotelId).Contains(x.HotelId))
                                       .ToList();
            int id = int.Parse(Request.Params["id"]);

            var marketHotels = _hotelRepository.SearchHotelsByMarketId(id);

            DdlHotels.DataSource     = allHotels.Except(marketHotels).Except(hotelExistsInMarkets);
            DdlHotels.DataTextField  = "HotelInfo";
            DdlHotels.DataValueField = "HotelId";
            DdlHotels.DataBind();

            RptHotelListings.DataSource = marketHotels;
            RptHotelListings.DataBind();
        }
예제 #6
0
        protected void RebindDiscount(int discountId, bool isReload = false)
        {
            if (isReload)
            {
                _discountRepository = new DiscountRepository();
            }

            // Discount Products
            var products = _productRepository.SearchProductsByCode();

            var productDiscount = _discountRepository.SearchProductsByDiscountId(discountId);

            DdlHotels.DataSource     = products.Except(productDiscount, new ProductComparer());
            DdlHotels.DataTextField  = "HotelAndProductName";
            DdlHotels.DataValueField = "ProductId";
            DdlHotels.DataBind();

            List <DiscountProducts> discountHotels = _discountRepository.GetDiscountsProductsById(discountId);

            RptHotelListings.DataSource = discountHotels;
            RptHotelListings.DataBind();

            // Discount Subscriptions
            var subscriptions = _discountRepository.SubscriptionsList.Where(s => !s.IsDelete && s.IsActive).ToList();

            var subscriptionDiscount = _discountRepository.SearchSubscriptionsByDiscountId(discountId);

            DdlSubscription.DataSource     = subscriptions.Except(subscriptionDiscount, new SubscriptionComparer());
            DdlSubscription.DataTextField  = "Name";
            DdlSubscription.DataValueField = "Id";
            DdlSubscription.DataBind();

            List <DiscountSubscriptions> discountSubscriptionses = _discountRepository.GetDiscountSubscriptionsById(discountId);

            RptSubscriptionListings.DataSource = discountSubscriptionses;
            RptSubscriptionListings.DataBind();
        }
예제 #7
0
        private void RebindHotelsByuser(bool isReload = false)
        {
            if (isReload)
            {
                _hotelRepository     = new HotelRepository();
                _userHotelRepository = new CustomerInfoHotelRepository();
            }
            var allHotel = _hotelRepository.SearchHotelsByCode();
            int userId   = int.Parse(Request.Params["userId"]);

            var userHotel = _hotelRepository.SearchHotelsByUserId(userId);

            DdlHotels.DataSource     = allHotel.Except(userHotel);
            DdlHotels.DataTextField  = "HotelName";
            DdlHotels.DataValueField = "HotelId";
            DdlHotels.DataBind();

            var userses = _userHotelRepository.GetByUserId(userId);

            RptHotelListings.DataSource = userses;
            RptHotelListings.DataBind();

            DdlRole.SelectedIndex = _users.IsAdmin && _users.IsCheckInOnly ? 1 : 0;
        }
        protected void Page_Init(object sender, EventArgs e)
        {
            Session["Active"] = "HotelListing";
            IsAdmin           = PublicCustomerInfos != null && PublicCustomerInfos.IsSuperAdmin;
            if (PublicCustomerInfos != null && PublicCustomerInfos.IsSuperAdmin)
            {
                AddNewRow.Visible = true;
            }
            if (!IsPostBack)
            {
                Session["Hotel"]       = null;
                Session["CurrentPage"] = 1;
                List <Hotels> hotels = _hotelRepository.SearchHotelsByUser(PublicCustomerInfos != null ? PublicCustomerInfos.EmailAddress : string.Empty)
                                       .Take(Constant.ItemPerPage)
                                       .ToList();

                //UpdateHotelTimeZone(hotels);
                RptHotelListings.DataSource = hotels;
                RptHotelListings.DataBind();

                CacheLayer.Clear(CacheKeys.BookingsCacheKey);
                CacheLayer.Clear(CacheKeys.CustomerInfosCacheKey);
                CacheLayer.Clear(CacheKeys.DiscountsCacheKey);
                CacheLayer.Clear(CacheKeys.DiscountBookingsCacheKey);
                CacheLayer.Clear(CacheKeys.SurveysCacheKey);
                CacheLayer.Clear(CacheKeys.CustomerCreditsCacheKey);
                CacheLayer.Clear(CacheKeys.CustomerCreditLogsCacheKey);
                CacheLayer.Clear(CacheKeys.InvoicesCacheKey);
                CacheLayer.Clear(CacheKeys.GiftCardCacheKey);
                CacheLayer.Clear(CacheKeys.BookingHistoriesCacheKey);

                CacheLayer.Clear(CacheKeys.SubscriptionBookingsCacheKey);
                CacheLayer.Clear(CacheKeys.SubsciptionDiscountUsedCacheKey);
                CacheLayer.Clear(CacheKeys.SubscriptionDiscountsCacheKey);
            }
        }