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