protected void Page_Load(object sender, EventArgs e) { long id = Convert.ToInt64(Request.QueryString["id"]); if (id == 0) { Response.Redirect("/"); } if (!IsPostBack) { AdvertItem = AdvertsDataHelper.GetAdvert(id); if (User != null) { WatchedDataHelper.AddWatched(User.UserId, id); } else { if (Request.Cookies["uid"] != null) { string value = Request.Cookies["uid"].Value; WatchedDataHelper.AddWatchedByCookies(value, id); } } } string tempId = Page.RouteData.Values["id"] as string; }
protected void ButtonAddItem_Click(object sender, EventArgs e) { string category = Request.QueryString["cat"]; string name = String.Format("{0}", Request.Form["ctl00$MainContent$input_name"]); string description = String.Format("{0}", Request.Form["ctl00$MainContent$input_text"]); string price = String.Format("{0}", Request.Form["ctl00$MainContent$price_value"]); string video = String.Format("{0}", Request.Form["ctl00$MainContent$input_video"]); string place = String.Format("{0}", Request.Form["ctl00$MainContent$additem_place"]); string phone = String.Format("{0}", Request.Form["ctl00$MainContent$phonenum"]); string messageType = String.Format("{0}", Request.Form["ctl00$MainContent$contact"]); var objPhotos = Request.Form["AdvertPhotos"]; Rentoolo.Model.Adverts advert = new Model.Adverts(); if (objPhotos != null) { String[] listPhotos = objPhotos.Split(','); var jsonPhotos = JsonConvert.SerializeObject(listPhotos); advert.ImgUrls = jsonPhotos; } else { advert.ImgUrls = "[\"/img/a/noPhoto.png\"]"; } try { advert.Category = Int32.Parse(category); } catch { } advert.Name = name; advert.Description = description; try { advert.Price = double.Parse(price); } catch { } //advert.video = video; advert.Address = place; advert.Phone = phone; advert.YouTubeUrl = video; advert.CreatedUserId = User.UserId; advert.Created = DateTime.Now; AdvertsDataHelper.AddAdvert(advert); Response.Redirect("MyAdverts.aspx"); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ListItems = AdvertsDataHelper.GetUserAdverts(User.UserId);//.OrderBy(x => x.Created).ToList(); } }
protected void Page_Load(object sender, EventArgs e) { string id = Request.QueryString["id"]; ExchangeItem = DataHelper.GetExchangeItem(Convert.ToInt64(id)); ExchangeAdvert = AdvertsDataHelper.GetAdvert(ExchangeItem.AdvertId); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { //ListNews = DataHelper.GetActiveNewsLast5(); string search = Request.QueryString["s"]; ListAdverts = AdvertsDataHelper.GetAdvertsForMainPage(); AdvertsCount = AdvertsDataHelper.GetAdvertsActiveCount().ToString("N0"); //Random rnd = new Random(); //RandomInt = rnd.Next(-2, 2); //UsercCount = DataHelper.GetSettingByName("UsersCount").Value; //UsersCountRegisteredToday = DataHelper.GetSettingByName("UsersCountRegisteredToday").Value; //UsersCountOnline = DataHelper.GetSettingByName("UsersCountOnline").Value; //UsersCountOnline = (Convert.ToInt32(UsersCountOnline) + RandomInt).ToString(); } }
protected void Page_Load(object sender, EventArgs e) { string id = Request.QueryString["id"]; string advertId = Request.QueryString["advertId"]; ItemRequests = DataHelper.GetExchangeItemRequests(Convert.ToInt64(id)); Advert = AdvertsDataHelper.GetAdvert(Convert.ToInt64(advertId)); }
protected void Page_Load(object sender, EventArgs e) { long id = Convert.ToInt64(Request.QueryString["id"]); advId = (int)id; ItemLikes = DataHelper.GetItemLikes(0, advId); ItemDislikes = DataHelper.GetItemDisLikes(0, advId); if (id == 0) { Response.Redirect("/"); } AdvertItem = AdvertsDataHelper.GetAdvert(id); AnotherUser = DataHelper.GetUser(AdvertItem.CreatedUserId); if (!IsPostBack) { ViewsCount = DataHelper.GetUserViewsCount((int)id, StructsHelper.ViewedType["product"]); if (User != null) { // if user didnt authorised, it will be null UserViews userViews = new UserViews() { Date = DateTime.Now, UserId = User.UserId, Type = StructsHelper.ViewedType["product"], ObjectId = (int)id }; DataHelper.TryAddUserView(userViews); } if (User != null) { WatchedDataHelper.AddWatched(User.UserId, id); } else { if (Request.Cookies["uid"] != null) { string value = Request.Cookies["uid"].Value; WatchedDataHelper.AddWatchedByCookies(value, id); } } } }
protected void Page_Load(object sender, EventArgs e) { string id = Request.QueryString["id"]; itemRequest = DataHelper.GetExchangeItemRequest(Convert.ToInt64(id)); ExchangeProducts exchangeItem = DataHelper.GetExchangeItem(itemRequest.ExchangeItemId); wantedExchangeItem = DataHelper.GetExchangeItem(itemRequest.WantedExchangeItemId); ExchangeAdvert = AdvertsDataHelper.GetAdvert(exchangeItem.AdvertId); WantedAdvert = AdvertsDataHelper.GetAdvert(wantedExchangeItem.AdvertId); }
protected void Page_Load(object sender, EventArgs e) { long id = Convert.ToInt64(Request.QueryString["id"]); if (id == 0) { Response.Redirect("/"); } if (!IsPostBack) { AdvertItem = AdvertsDataHelper.GetAdvert(id); } string tempId = Page.RouteData.Values["id"] as string; }
protected void Page_Load(object sender, EventArgs e) { CategoryId = Request.QueryString["cat"]; if (string.IsNullOrEmpty(CategoryId)) { Response.Redirect("/Account/Category"); } bool isRedacting = Request.QueryString["redact"] == null ? false : true; if (isRedacting) { long advId = Convert.ToInt64(Request.QueryString["advId"]); Advert = AdvertsDataHelper.GetAdvert(advId); } var a = 5; //CategoryName = CategoryHelper.GetCategoryName(CategoryId); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { //ListNews = DataHelper.GetActiveNewsLast5(); DateTime startDate, endDate; DateTime?startDate2 = null, endDate2 = null; bool onlyInName = Request.QueryString["onlyInName"] == "on" ? true : false; decimal?startPrice = null, endPrice = null; decimal startPrice2, endPrice2; string city = Request.QueryString["city"]; string sortBy = Request.QueryString["sort"]; SellFilter filter = new SellFilter { Search = Request.QueryString["s"] }; if (DateTime.TryParse(Request.QueryString["startDate"], out startDate) || DateTime.TryParse(Request.QueryString["endDate"], out endDate)) { filter.Search = ""; DateTime.TryParse(Request.QueryString["endDate"], out endDate); if (startDate != SellFilter.DefaultDate) { startDate2 = startDate; } if (endDate != SellFilter.DefaultDate) { endDate2 = endDate; } } if (decimal.TryParse(Request.QueryString["startPrice"], out startPrice2) || decimal.TryParse(Request.QueryString["endPrice"], out endPrice2)) { decimal.TryParse(Request.QueryString["endPrice"], out endPrice2); if (startPrice2 != null) { startPrice = startPrice2; } if (endPrice2 != null) { endPrice = endPrice2; } } // test string userIP = Request.RequestContext.HttpContext.Request.UserHostAddress; SellFilter sellFilter = new SellFilter() { Search = Request.QueryString["s"], StartDate = startDate2, EndDate = endDate2, City = city, StartPrice = startPrice, EndPrice = endPrice, OnlyInName = onlyInName, SortBy = sortBy }; ListAdverts = AdvertsDataHelper.GetAdvertsForMainPage(sellFilter); AdvertsCount = AdvertsDataHelper.GetAdvertsActiveCount(filter).ToString("N0"); //Random rnd = new Random(); //RandomInt = rnd.Next(-2, 2); //UsercCount = DataHelper.GetSettingByName("UsersCount").Value; //UsersCountRegisteredToday = DataHelper.GetSettingByName("UsersCountRegisteredToday").Value; //UsersCountOnline = DataHelper.GetSettingByName("UsersCountOnline").Value; //UsersCountOnline = (Convert.ToInt32(UsersCountOnline) + RandomInt).ToString(); } }
protected void Page_Load(object sender, EventArgs e) { string id = Request.QueryString["id"]; AdvertItem = AdvertsDataHelper.GetAdvert(Convert.ToInt64(id)); }
protected void Page_Load(object sender, EventArgs e) { UserAdverts = AdvertsDataHelper.GetAdverts(User.UserId); }