protected void Previous_OnClick(object sender, EventArgs e) { int currentPage = int.Parse(Session["CurrentPage"].ToString()); var hotels = _marketRepositoty.GetAll().Skip((currentPage - 2) * Constant.ItemPerPage).Take(Constant.ItemPerPage).ToList(); if (hotels.Any() && currentPage - 2 >= 0) { Session["CurrentPage"] = currentPage - 1; ContentPageRpt.DataSource = hotels; ContentPageRpt.DataBind(); } }
public List <Market> GetAll() { return(MarketRepository.GetAll()); }
protected void Page_Init(object sender, EventArgs e) { Account account = new Account( "vietluyen", "385557456569739", "Si2Q2D3dxjqgya-Rl7-lZ0cy99Q"); Cloudinary = new Cloudinary(account); Session["Active"] = "Markets"; if (!IsPostBack) { Session["UserHotel"] = null; Session["CurrentPage"] = 1; if (Request.Params["id"] == null) { MarketMultiView.ActiveViewIndex = 0; MarketRepeater.DataSource = _marketRepositoty.GetAll(); MarketRepeater.DataBind(); } else { MarketMultiView.ActiveViewIndex = 1; int id = int.Parse(Request.Params["id"]); if (id == 0) // Add new { DdlHotels.Visible = false; AddHotelMarketButton.Visible = false; Deactivebutton.Visible = false; ActiveButton.Visible = false; MarketImage.Visible = false; UploadImage.Visible = false; } else { _markets = _marketRepositoty.GetById(id); if (_markets != null) { LocationNameText.Text = _markets.LocationName; MarketText.Text = _markets.MarketCode; PermalinkText.Text = _markets.Permalink; DdlState.SelectedValue = _markets.State; LatitudeText.Text = _markets.Latitude; LongtitudeText.Text = _markets.Longitude; IsCollectTax.Checked = _markets.IsCalculateTax; if (_markets.IsActive) { Deactivebutton.Visible = true; ActiveButton.Visible = false; } else { Deactivebutton.Visible = false; ActiveButton.Visible = true; } if (!string.IsNullOrEmpty(_markets.PublicId) && !string.IsNullOrEmpty(_markets.Format)) { var url = Cloudinary.Api.UrlImgUp.Secure() .Transform(new Transformation().Width(500).Height(500).Crop("fill")) .BuildUrl(string.Format("{0}.{1}", _markets.PublicId, _markets.Format)); MarketImageControl.ImageUrl = url; } } RebindHotelsByMarket(); } } } }
public IEnumerable <Market> GetAll() { return(repository.GetAll()); }