protected void Page_Load(object sender, EventArgs e) { try { if (!IsPostBack) { if (Request.QueryString["id"] != null) { int advertId = Convert.ToInt32(Request.QueryString["id"]); Advert objAdvert = AdvertAction.GetAdvertById(advertId); objAdvert.AdvertImage = AdvertAction.GetAdvertImageByAdvertId(advertId); objAdvert.AdvertDocuments = AdvertAction.GetAdvertDocuments(advertId); ctAdvert.GUID = System.Guid.NewGuid().ToString(); ctAdvert.ShowAdvertPreview(objAdvert); //update the advert.counter values AdvertAction.SetAdvertCounter(advertId); lblAdvertId.Text = "Advert ID : " + advertId.ToString(); lblCounter.Text = (objAdvert.Counter + 1).ToString(); //Constructing the page title // Master.Page.Title = objAdvert.Title + " - " + objAdvert.Category.Description + " - GSE-Mart.aero"; } } } catch (Exception ex) { ctlNotifier.intResponseCode = 1; ctlNotifier.strResponse = ex.ToString(); } }
/// <summary> /// Function to get and bind the top 5 advert listing /// </summary> private void GetTopListing() { List <Advert> lstAdverts = AdvertAction.GetTopAdvertListing(); dataTopListingImage.DataSource = lstAdverts; dataTopListingImage.DataBind(); dataTopListingTitle.DataSource = lstAdverts; dataTopListingTitle.DataBind(); }
/// <summary> /// Function to grab new total quantity from all the active adverts /// </summary> private void SetNewQuantityItemValue() { string quantity = AdvertAction.GetTotalAdvertQuantity(true).ToString("#,#"); lblNewQuantityItem.Text = quantity; Application["lblNewQuantityItemValue"] = quantity; quantity = AdvertAction.GetTotalAdvertQuantity(false).ToString("#,#"); lblUsedQuantityItem.Text = quantity; Application["lblUsedQuantityItemValue"] = quantity; quantity = AdvertAction.GetTotalAdvertCountries().ToString("#,#"); lblAdvertCountries.Text = quantity; Application["lblAdvertCountriesValue"] = quantity; Application["lblQuantityItemLastUpdate"] = DateTime.Now; }
protected void Search() { try { List <Advert> lstAdvert = new List <Advert>(); int rowPerPage = 1000; int rowStart = 0; int totalRecord = 0; //contruction the URL // todo:Jim //strQueryString = ResolveUrl(URLConstant.BuildAdsDetailURL(ddlCategoryId.SelectedValue.ToString(), ddlCountryId.SelectedValue.ToString(), Server.UrlEncode(strQuery), ddlSortById.SelectedValue.ToString(), Server.UrlEncode(strPageHeading), page, ddlGSEType.SelectedValue.ToString(), ddlASAMembersOnlyYN.Checked.ToString())); strSearchURL = ResolveUrl(URLConstant.BuildEmbeddedSearchURL( CountryId, GSETypeId, ASAMembersOnlyYN, SortBy, NewYN, UsedYN, ForRentYN, ForLeaseYN, ForSaleYN, QtyId1, QtyUnitId1, QtyValue1, QtyId2, QtyUnitId2, QtyValue2, SpecId1, SpecOptionId1, SpecId2, SpecOptionId2, SpecId3, SpecOptionId3, Manufacturer, AccountId, strPageHeading)); strQueryString = ResolveUrl(URLConstant.BuildEmbeddedAdsDetailURL( CountryId, GSETypeId, ASAMembersOnlyYN, SortBy, NewYN, UsedYN, ForRentYN, ForLeaseYN, ForSaleYN, QtyId1, QtyUnitId1, QtyValue1, QtyId2, QtyUnitId2, QtyValue2, SpecId1, SpecOptionId1, SpecId2, SpecOptionId2, SpecId3, SpecOptionId3, Manufacturer, AccountId, strPageHeading)); // Convert the selected value from the drop down into the parameteres required for the search switch (CountryId.Length) { case 2: RegionId = ""; break; case 3: RegionId = CountryId; CountryId = ""; break; default: CountryId = ""; RegionId = ""; break; } // If a GSEType has not been specified, don't do a search //if (GSETypeId != "0" && !String.IsNullOrEmpty(GSETypeId)) if (!String.IsNullOrEmpty(Request.QueryString.ToString())) { lstAdvert = AdvertAction.GetAdvertByFilterSearch( rowPerPage, rowStart, CountryId, RegionId, SortBy, GSETypeId, ASAMembersOnlyYN, NewYN, UsedYN, ForRentYN, ForLeaseYN, ForSaleYN, QtyId1, QtyUnitId1, QtyValue1, QtyId2, QtyUnitId2, QtyValue2, SpecId1, SpecOptionId1, SpecId2, SpecOptionId2, SpecId3, SpecOptionId3, Manufacturer, AccountId, out totalRecord); //Set Empty list message grdAdverts.EmptyDataText = "You search did not match any adverts. We would suggest to try with different criteria."; //Bind Grid plSearchResults.Visible = true; grdAdverts.Visible = true; grdAdverts.PageIndex = page; grdAdverts.DataSource = lstAdvert; grdAdverts.DataBind(); intTotalRec = totalRecord; // setting up the paging numbering // this.SetPaging(totalRecord, page, rowPerPage, strSearchURL); } } catch (Exception ex) { ctlNotifier.intResponseCode = 1; ctlNotifier.strResponse = "An error occured while retrieving search results." + ex.ToString(); } }