Пример #1
0
        public void SearchMLS(string MlNumbers)
        {
            try
            {
                int PageSize = 20;
                //Display 20 items per page
                //Get the currentpage index from the url parameter
                if (Request.QueryString["currentpage"] != null)
                {
                    _CurrentPage = Convert.ToInt32(Request.QueryString["currentpage"].ToString());
                }
                else
                {
                    _CurrentPage = 1;
                }

                List <FlexMLSInfo> items;
                FlexMLSController  controller = new FlexMLSController();

                items = controller.FlexMLS_Search_MLS_Numbers(MlNumbers.ToString());

                //    lblDebug.Text = MlNumbers.ToString();

                PagedDataSource objPagedDataSource = new PagedDataSource();
                objPagedDataSource.DataSource = items;

                if (items.Count < 1)
                {
                    //    GMap1.Visible = false;
                    lblErrorMessage.Text = Localization.GetString("DefaultContent", LocalResourceFile);
                }

                if (objPagedDataSource.PageCount > 0)
                {
                    objPagedDataSource.PageSize         = PageSize;
                    objPagedDataSource.CurrentPageIndex = _CurrentPage - 1;
                    objPagedDataSource.AllowPaging      = true;
                }


                lstSearchResults.DataSource = objPagedDataSource;
                lstSearchResults.DataBind();

                lblSearchSummary.Text = "Total Listings Found: " + items.Count.ToString();

                if (PageSize == 0 || items.Count <= PageSize)
                {
                    PagingControl1.Visible = false;
                }
                else
                {
                    PagingControl1.Visible           = true;
                    PagingControl1.TotalRecords      = items.Count;
                    PagingControl1.PageSize          = PageSize;
                    PagingControl1.CurrentPage       = _CurrentPage;
                    PagingControl1.TabID             = TabId;
                    PagingControl1.QuerystringParams = "pg=List&" + GenerateQueryStringParameters(this.Request, "Town", "Village", "Beds", "Baths", "WaterFront", "WaterView", "Type", "Low", "High", "LOID");
                }
            }
            catch (Exception ex)
            {
                Exceptions.ProcessModuleLoadException(this, ex);
            }
        }
Пример #2
0
        public void SearchMLS()
        {
            try
            {
                int    _bedRooms         = Convert.ToInt32(_beds.ToString());
                int    _bathRooms        = Convert.ToInt32(_baths.ToString());
                string _SearchWaterFront = "";
                string _SearchWaterView  = "";
                int    _priceLow         = Convert.ToInt32(_pricelow.ToString());
                int    _priceHigh        = Convert.ToInt32(_pricehigh.ToString());

                if (_waterfront.ToString() == "True")
                {
                    _SearchWaterFront = "YES";
                }
                if (_waterview.ToString() == "True")
                {
                    _SearchWaterView = "YES";
                }


                StringBuilder _SearchCriteria = new StringBuilder();
                _SearchCriteria.Capacity = 500;

                if (_propertyType.ToString().Length > 0)
                {
                    _SearchCriteria.Append("Listing Type: <b>" + _propertyType.ToString() + "</b> &nbsp;");
                }
                if (_town.ToString().Length > 0)
                {
                    _SearchCriteria.Append(" Town: <b>" + _town.ToString() + "</b> &nbsp;");
                }
                if (_village.ToString().Length > 0)
                {
                    _SearchCriteria.Append(" Village: <b>" + _village.ToString() + "</b> &nbsp;");
                }
                if (_bedRooms > 0)
                {
                    _SearchCriteria.Append(" Bedrooms: <b>" + _bedRooms.ToString() + "</b> &nbsp;");
                }
                if (_bathRooms > 0)
                {
                    _SearchCriteria.Append(" Bathrooms: <b>" + _bathRooms.ToString() + "</b> &nbsp;");
                }
                if (_SearchWaterFront.ToString() == "YES")
                {
                    _SearchCriteria.Append(" Waterfront: <b>" + _SearchWaterFront.ToString() + "</b> &nbsp;");
                }
                if (_SearchWaterView.ToString() == "YES")
                {
                    _SearchCriteria.Append(" Waterview: <b>" + _SearchWaterView.ToString() + "</b> &nbsp;");
                }
                if (_priceLow > 0)
                {
                    _SearchCriteria.Append(" Min. Price: <b>" + _priceLow.ToString() + "</b> &nbsp;");
                }
                if (_priceHigh < 50000000)
                {
                    _SearchCriteria.Append(" Max Price: <b>" + _priceHigh.ToString() + "</b> &nbsp;");
                }
                if (_listingOfficeMLSID.ToString().Length > 0)
                {
                    _SearchCriteria.Append(" Office: <b>" + _listingOfficeMLSID.ToString() + "</b> &nbsp;");
                }
                //else
                //{
                //    _listingOfficeMLSID = "";
                //}

                if (_dom.ToString().Trim().Length > 0)
                {
                    _SearchCriteria.Append(" Days On Market: <b>" + _dom.ToString() + " day or less</b> &nbsp;");
                }
                //else
                //{
                //    _dom = "";
                //}

                if (_complex.ToString().Length > 0)
                {
                    _SearchCriteria.Append(" Complex: <b>" + _complex.ToString() + "</b> &nbsp;");
                }
                //else
                //{
                //    _complex = "";
                //}


                lblSearchCriteria.Text = _SearchCriteria.ToString();

                List <FlexMLSInfo> items;
                FlexMLSController  controller = new FlexMLSController();


                if (_condoSearch == true)
                {
                    items = controller.FlexMLS_Search_Condo(_propertyType.ToString(),
                                                            _town.ToString(), _village.ToString(),
                                                            _bedRooms.ToString(), _bathRooms.ToString(),
                                                            _SearchWaterFront.ToString(),
                                                            _SearchWaterView.ToString(),
                                                            _priceLow.ToString(),
                                                            _priceHigh.ToString(),
                                                            _listingOfficeMLSID, _dom.ToString(), _complex.ToString());
                    //      lblDebug.Text = " Searching Condos";
                }
                else if (_searchMlsNumber == true)
                {
                    items = controller.FlexMLS_Search_MLS_Numbers(_MlsNumbers.ToString());
                    //     lblDebug.Text = " Searching MLS Numbers";
                }
                else
                {
                    items = controller.FlexMLS_Search(_propertyType.ToString(),
                                                      _town.ToString(), _village.ToString(),
                                                      _bedRooms.ToString(), _bathRooms.ToString(),
                                                      _SearchWaterFront.ToString(),
                                                      _SearchWaterView.ToString(),
                                                      _priceLow.ToString(),
                                                      _priceHigh.ToString(),
                                                      _listingOfficeMLSID, _dom.ToString());
                    //   lblDebug.Text = " Searching Search Criteria";
                    //lblDebug.Text += "<br />_propertyType: " + _propertyType.ToString() +
                    //               "<br />_town: " + _town.ToString() +
                    //               "<br />_village: " + _village.ToString() +
                    //               "<br />_bedRooms: " + _bedRooms.ToString() +
                    //               "<br />_bathRooms: " + _bathRooms.ToString() +
                    //               "<br />_SearchWaterFront: " + _SearchWaterFront.ToString() +
                    //               "<br />_SearchWaterView: " + _SearchWaterView.ToString() +
                    //               "<br />_priceLow: " + _priceLow.ToString() +
                    //               "<br />_priceHigh: " + _priceHigh.ToString() +
                    //               "<br />_listingOfficeMLSID: " + _listingOfficeMLSID.ToString() +
                    //               "<br />_dom: " + _dom.ToString();
                }

                //      items.Sort("ListingPrice desc",1);
                PagedDataSource pg = new PagedDataSource();
                pg.DataSource  = items;
                pg.AllowPaging = true;

                pg.PageSize = Int32.Parse(_numberOfRecords.ToString());

                pg.CurrentPageIndex = CurrentPage;

                lblCurrentPage.Text = "Page: " + (CurrentPage + 1).ToString() + " of " + pg.PageCount.ToString();

                // Disable Prev or Next buttons if necessary

                lbPrev.Enabled = !pg.IsFirstPage;
                lbNext.Enabled = !pg.IsLastPage;


                //bind the data
                lstContent.DataSource = pg;
                lstContent.DataBind();

                lblSearchSummary.Text = "Total Listings Found: " + items.Count.ToString();
            }
            catch (Exception ex)
            {
                Exceptions.ProcessModuleLoadException(this, ex);
            }
        }