Beispiel #1
0
        private void RebindProductUpgrades(bool isNew = false)
        {
            if (_products != null && _products.ProductType != (int)Enums.ProductType.AddOns)
            {
                if (isNew)
                {
                    _productRepository = new ProductRepository();
                }
                List <Products> allProducts = _productRepository.SearchProductsByHotelId(_products.HotelId)
                                              .Where(p => p.ProductType != (int)Enums.ProductType.AddOns)
                                              .ToList();

                int id = int.Parse(Request.Params["id"]);

                IEnumerable <Products> upgradeHotels = _productRepository.GetProductsUpgradeByProductId(id);
                ProductAvailableUpgradesDdl.DataSource = allProducts.Where(x => x.ProductId != _products.ProductId)
                                                         .Except(upgradeHotels);
                ProductAvailableUpgradesDdl.DataTextField  = "ProductName";
                ProductAvailableUpgradesDdl.DataValueField = "ProductId";
                ProductAvailableUpgradesDdl.DataBind();

                RptProductListings.DataSource = upgradeHotels
                                                .Where(x => x.ProductId != id &&
                                                       x.ProductType != (int)Enums.ProductType.DayPass &&
                                                       x.ProductType != (int)Enums.ProductType.AddOns);
                RptProductListings.DataBind();
            }
        }
        protected void Next_OnClick(object sender, EventArgs e)
        {
            int currentPage = int.Parse(Session["CurrentPageProduct"].ToString());
            var hotels      = _productRepository.SearchProductsByHotelId(PublicHotel.HotelId).Skip(currentPage * Constant.ItemPerPage).Take(Constant.ItemPerPage).ToList();

            if (hotels.Any())
            {
                Session["CurrentPageProduct"] = currentPage + 1;
                RptProductListings.DataSource = hotels;
                RptProductListings.DataBind();
            }
        }
        protected void Page_Init(object sender, EventArgs e)
        {
            Session["Active"] = "ProductListing";

            if (PublicCustomerInfos != null && PublicCustomerInfos.IsSuperAdmin)
            {
                AddNewRow.Visible = true;
            }

            if (PublicHotel == null)
            {
                Response.Redirect(string.Format(Constant.HotelList + "?ReturnUrl={0}", HttpUtility.UrlEncode(Request.Url.PathAndQuery)));
            }

            if (!IsPostBack)
            {
                Session["CurrentPageProduct"] = 1;
                List <Products> products = _productRepository.SearchProductsByHotelId(PublicHotel.HotelId).Take(Constant.ItemPerPage).ToList();
                RptProductListings.DataSource = products;
                RptProductListings.DataBind();
            }
        }