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> "); } if (_town.ToString().Length > 0) { _SearchCriteria.Append(" Town: <b>" + _town.ToString() + "</b> "); } if (_village.ToString().Length > 0) { _SearchCriteria.Append(" Village: <b>" + _village.ToString() + "</b> "); } if (_bedRooms > 0) { _SearchCriteria.Append(" Bedrooms: <b>" + _bedRooms.ToString() + "</b> "); } if (_bathRooms > 0) { _SearchCriteria.Append(" Bathrooms: <b>" + _bathRooms.ToString() + "</b> "); } if (_SearchWaterFront.ToString() == "YES") { _SearchCriteria.Append(" Waterfront: <b>" + _SearchWaterFront.ToString() + "</b> "); } if (_SearchWaterView.ToString() == "YES") { _SearchCriteria.Append(" Waterview: <b>" + _SearchWaterView.ToString() + "</b> "); } if (_priceLow > 0) { _SearchCriteria.Append(" Min. Price: <b>" + _priceLow.ToString() + "</b> "); } if (_priceHigh < 50000000) { _SearchCriteria.Append(" Max Price: <b>" + _priceHigh.ToString() + "</b> "); } if (_listingOfficeMLSID.ToString().Length > 0) { _SearchCriteria.Append(" Office: <b>" + _listingOfficeMLSID.ToString() + "</b> "); } //else //{ // _listingOfficeMLSID = ""; //} if (_dom.ToString().Trim().Length > 0) { _SearchCriteria.Append(" Days On Market: <b>" + _dom.ToString() + " day or less</b> "); } //else //{ // _dom = ""; //} if (_complex.ToString().Length > 0) { _SearchCriteria.Append(" Complex: <b>" + _complex.ToString() + "</b> "); } //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); } }
//public string GetStatusDesc(string Status) //{ // try // { // string myRetValue = ""; // switch (Status) // { // case "A": // myRetValue = "Active"; // break; // case "C": // myRetValue = "Pending with Contingencies"; // break; // case "R": // myRetValue = "Listing Removed. Call agent for details!"; // break; // default: // myRetValue = ""; // break; // } // return myRetValue.ToString(); // } // catch (Exception ex) // { // Exceptions.ProcessModuleLoadException(this, ex); // return "Error"; // } //} //public void GetFavoritesModule() //{ // try // { // DotNetNuke.Entities.Modules.ModuleController mc = new ModuleController(); // ArrayList existMods = mc.GetModulesByDefinition(this.PortalId, "GIBS - MLS Connect - Favorites"); // foreach (DotNetNuke.Entities.Modules.ModuleInfo mi in existMods) // { // if (!mi.IsDeleted) // { // linkButtonFavorites.Text = mi.ModuleID.ToString(); // // get module title // //mi.ModuleTitle; // // additionally, you can find out what tab it is on //mi.TabID; // //mi.ModuleID; // lblDebug.Text = mi.ModuleID.ToString(); // } // } // } // catch (Exception ex) // { // Exceptions.ProcessModuleLoadException(this, ex); // } //} public void SearchMLS() { 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; } //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 (_waterfrontYN.ToString() == "True") { _waterfrontYN = "Yes"; } if (_waterviewYN.ToString() == "True") { _waterviewYN = "Yes"; } StringBuilder _SearchCriteria = new StringBuilder(); _SearchCriteria.Capacity = 500; if (_type.ToString().Trim().Length > 0) { _SearchCriteria.Append("Listing Type: <b>" + GetPropertyTypeDesc(_type.ToString()) + "</b> "); } else { _type = ""; } if (_town.ToString().Trim().Length > 0) { _SearchCriteria.Append(" Town: <b>" + _town.ToString() + "</b> "); } else { _town = ""; } if (_village.ToString().Trim().Length > 0) { _SearchCriteria.Append(" Village: <b>" + _village.ToString() + "</b> "); } else { _village = ""; } if (_complex.ToString().Length > 0) { _SearchCriteria.Append(" Complex: <b>" + _complexName.ToString() + "</b> "); } else { _complex = ""; } if (Int32.Parse(_beds.ToString()) > 0) { _SearchCriteria.Append(" Bedrooms: <b>" + _beds.ToString() + "</b> "); } else { _beds = ""; } if (Int32.Parse(_baths.ToString()) > 0) { _SearchCriteria.Append(" Bathrooms: <b>" + _baths.ToString() + "</b> "); } else { _baths = ""; } if (_waterfrontYN.ToString() == "Yes") { _SearchCriteria.Append(" Waterfront: <b>" + _waterfrontYN.ToString() + "</b> "); } else { _waterfrontYN = ""; } if (_waterviewYN.ToString() == "Yes") { _SearchCriteria.Append(" Waterview: <b>" + _waterviewYN.ToString() + "</b> "); } else { _waterviewYN = ""; } if (_pricelow > 0) { _SearchCriteria.Append(" Min. Price: <b>" + _pricelow.ToString("C0") + "</b> "); } if (_pricehigh < 50000000) { _SearchCriteria.Append(" Max Price: <b>" + _pricehigh.ToString("C0") + "</b> "); } if (_listingOfficeMLSID.ToString().Length > 0) { _SearchCriteria.Append(" Office: <b>" + _listingOfficeMLSID.ToString() + "</b> "); } else { _listingOfficeMLSID = ""; } if (_dom.ToString().Trim().Length > 0) { _SearchCriteria.Append(" Days On Market: <b>" + _dom.ToString() + " day or less</b> "); } else { _dom = ""; } lblSearchCriteria.Text = _SearchCriteria.ToString(); // DEBUG //lblDebug.Visible = true; //lblDebug.Text += "<br /> type:" + _type.ToString() + " town:" + // _town.ToString() + " village:" + // _village.ToString() + " beds:" + // _beds.ToString() + " baths:" + // _baths.ToString() + " waterfront:" + // _waterfrontYN.ToString() + " waterview:" + // _waterviewYN.ToString() + " pricelow:" + // _pricelow.ToString() + " pricehigh:" + // _pricehigh + " listingOff:" + _listingOfficeMLSID.ToString(); List <FlexMLSInfo> items; FlexMLSController controller = new FlexMLSController(); if (_condoSearch == true) { items = controller.FlexMLS_Search_Condo(_type.ToString(), _town.ToString(), _village.ToString(), _beds.ToString(), _baths.ToString(), _waterfrontYN.ToString(), _waterviewYN.ToString(), _pricelow.ToString(), _pricehigh.ToString(), _listingOfficeMLSID, _dom.ToString(), _complexName.ToString().Replace("'", "''").ToString()); // lblDebug.Text = " Searching Condos"; GetSeoValues(_complexName.ToString() + " Condominium in " + _town.ToString(), _town.ToString() + ", " + _complexName.ToString() + ", condo, condominium"); string MyTitle = ""; MyTitle = _complexName.ToString() + " Condominium"; ModuleConfiguration.ModuleTitle = MyTitle.ToString(); } else if (_emailSearch == true) { // controller.FlexMLS_Search_LastModified items = controller.FlexMLS_Search_LastModified(_type.ToString(), _town.ToString(), _village.ToString(), _beds.ToString(), _baths.ToString(), _waterfrontYN.ToString(), _waterviewYN.ToString(), _pricelow.ToString(), _pricehigh.ToString(), _listingOfficeMLSID.ToString(), _dom.ToString(), _lastModified.ToString(), _complex.ToString()); } else { items = controller.FlexMLS_Search(_type.ToString(), _town.ToString(), _village.ToString(), _beds.ToString(), _baths.ToString(), _waterfrontYN.ToString(), _waterviewYN.ToString(), _pricelow.ToString(), _pricehigh.ToString(), _listingOfficeMLSID.ToString(), _dom.ToString()); } PagedDataSource objPagedDataSource = new PagedDataSource(); objPagedDataSource.DataSource = items; if (items.Count == 0) { //GMap1.Visible = false; } 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 (items.Count == 200) { lblSearchSummary.Text = "Over 200 Listing Found! Search results are limited to 200 records. Please refine your criteria."; lblSearchSummary.ForeColor = System.Drawing.Color.Red; } 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", "DOM", "e"); } } catch (Exception ex) { Exceptions.ProcessModuleLoadException(this, ex); } }