public void PropertyFilterTest()
        {
            driver.Url = "https://www.redfin.com";

            //Use your city to perform the property search
            Home.Initialize(driver).txt_SearchBox_SendKeys("Huntingtion Beach").btn_Search_Click();

            //Use at least 3 filters to perform the search
            PropertySearch.Initialize(driver)
            .drpbx_MinPrice_Click("$50k")
            .drpbx_MaxPrice_Click("$4M")
            .btn_MoreFilters_Click()
            .drpbx_MinBeds_Click("1")
            .drpbx_MaxBeds_Click("6")
            .txt_Baths_SendKeys("3+")
            .btn_ApplyFilters_Click();

            //Verify that the results match the search criteria
            PropertySearch.Initialize(driver)
            .GetSearchResults()
            .Validate_MinPrice(50000)
            .Validate_MaxPrice(4000000)
            .Validate_MinBeds(1)
            .Validate_MaxBeds(6)
            .Validate_MinBaths(3);
        }
Exemple #2
0
        public IQueryable <Property> PropertySearch([FromUri] PropertySearch search)
        {
            IQueryable <Property> finalProperties = db.Properties;


            if (search.Bedrooms != null)
            {
                finalProperties = finalProperties.Where(p => p.Bedrooms == search.Bedrooms);
            }
            if (search.Bathrooms != null)
            {
                finalProperties = finalProperties.Where(p => p.Bathrooms == search.Bathrooms);
            }
            if (search.MinRent != null)
            {
                finalProperties = finalProperties.Where(p => p.RentMonth >= search.MinRent);
            }
            if (search.MaxRent != null)
            {
                finalProperties = finalProperties.Where(p => p.RentMonth <= search.MaxRent);
            }
            if (search.City != null)
            {
                finalProperties = finalProperties.Where(p => p.City == search.City);
            }

            return(finalProperties);
        }
Exemple #3
0
        public Status <PropertySearch> SearchForUserProperty(PropertySearch search)
        {
            var ident = CustomAuthentication.GetIdentity();

            if (!ident.IsAuthenticated)
            {
                return(Status.UnAuthorized <PropertySearch>());
            }

            // if it is null create a new one
            if (search == null)
            {
                search = new PropertySearch();
            }
            if (search.Page < 1)
            {
                search.Page = 1;
            }
            if (search.ResultsPerPage < 5)
            {
                search.ResultsPerPage = 25;
            }
            if (string.IsNullOrEmpty(search.OrderBy))
            {
                search.OrderBy = "CreateDate";
            }

            using (var data = this.service.Get())
            {
                var result = data.Building.SearchUserBuildings(ident.UserId, search);
                search.Results = result;
                return(Status.OK <PropertySearch>(search));
            }
        }
Exemple #4
0
        protected void BtnSearch_Click(object sender, EventArgs e)
        {
            List <String> streetAddresses = new List <String>(TxtStreetAddresses.Text.Split('\n'));
            //streetAddresses.Add("13 Royal Crest Dr, Pueblo, CO 81005");
            Dictionary <int, DTOs.PropertyInfo> properties = PropertySearch.SearchForProperties(streetAddresses);

            GridViewResults.DataSource = properties.Values.ToList();
            GridViewResults.DataBind();
        }
Exemple #5
0
        /// <summary>
        /// Controller action for searching one's properties.
        /// </summary>
        /// <param name="search">The property search parameters.</param>
        /// <returns>The search results as a property search.</returns>
        public ActionResult Search(PropertySearch search)
        {
            var result = this.searchAdapter.SearchUserProperties(User.Identity.Name, search);

            if (Request.IsAjaxRequest())
            {
                return(PartialView("SearchResults", result.Result));
            }

            return(View(result.Result));
        }
Exemple #6
0
        //nothing passed - run a search with default values (will bring back all properties) - no PriceRange object
        public ActionResult SearchProperties(string PropertyType = "", string VacationType = "", int page = 1, string propertyResultsSort = "", int propertyResultsAmount = 25)
        {
            ViewBag.IdentifyPage = "Property Search";

            Session["CurrentSearchResultsAmount"] = propertyResultsAmount;
            Session["CurrentSearchResultsSort"]   = propertyResultsSort;

            ViewBag.propertyResultsSort   = propertyResultsSort;
            ViewBag.propertyResultsAmount = propertyResultsAmount;


            PropertySearch newSearch = new PropertySearch()
            {
                MaxSleeps      = 0,
                NoOfAdults     = 0,
                NoOfChildren   = 0,
                NoOfInfants    = 0,
                PoolType       = null,
                PropertyTypeID = 0,
                VacationTypeID = 0
            };

            if (VacationType != "")
            {
                newSearch.VacationTypeID = Convert.ToInt16(VacationType);
            }
            if (PropertyType != "")
            {
                newSearch.PropertyTypeID = Convert.ToInt16(PropertyType);
            }

            //run the search - then need to display it in the view
            var MatchingProperties = newSearch.SearchForMatchingProperties();

            //before limiting results
            Session["LastSearchResults"] = MatchingProperties;

            //paging here - then pass to viewbag
            Session["LastPropertyPagerPage"] = page;

            //after sort
            Session["currentPagedPropertySearch"] = MatchingProperties;

            ViewBag.MatchingProperties            = PagedList.PagedListExtensions.ToPagedList(MatchingProperties, page, propertyResultsAmount);
            Session["currentPagedPropertySearch"] = PagedList.PagedListExtensions.ToPagedList(MatchingProperties, page, 50000000);

            ViewBag.Title    = "Book your villa in Obidos, Nazare, Foz do Arelho or A-dos-Negros for a seaside holiday or rural townhouse with swimming pool and Internet. All types of villa, apartment are catered for in regions like Foz do Arelho, Obidos, Alfeizerao - Sao Martinho and Reguengo Grande. Stay in the lovely Salir do Porto and visit the Mafra Palace & Obidos during your vacation. With Portugal Rental Cottages, you can be up directly from the airport with our rental extras. While you stay, go on wine tasting tours to the beautiful Sanguinhal Estate and get picked up from the airport with our airport to villa transfer and return.";
            ViewBag.Keywords = "villa rental portugal, portugal silver coast, portugal cheap holidays, cheap holidays to portugal,silver coast portugal, portugal rental cottages, cheap all inclusive holidays to portugal";
            return(View());
        }
Exemple #7
0
 public List <PropertyTile> Search(PropertySearch s)
 {
     try
     {
         List <PropertyTile>     tiles = new List <PropertyTile>();
         dbzBest.Data.Properties db    = new dbzBest.Data.Properties();
         tiles = db.Search(s);
         return(tiles);
     }
     catch (System.Exception ex)
     {
         PropertyTile e = new PropertyTile();
         e.Description = ex.Message;
         List <PropertyTile> error = new List <PropertyTile>();
         error.Add(e);
         return(error);
     }
 }
        public ActionResult Search(PropertySearch search, Guid?token)
        {
            if (!User.Identity.IsAuthenticated && token.HasValue)
            {
                var user = authAdapter.ValidateAuthToken(token.Value);
                if (user.StatusCode == 200)
                {
                    CustomAuthentication.SetAuthCookie(user.Result.Username, user.Result.UserId, true);
                }
                return(Redirect("/property/search"));
            }

            var result = this.propertyFacade.SearchForUserProperty(search);

            if (Request.IsAjaxRequest())
            {
                return(PartialView("SearchResults", result.Result));
            }
            return(View(result.Result));
        }
        /// <summary>
        /// Controller action for searching one's properties.
        /// </summary>
        /// <param name="search">The property search parameters.</param>
        /// <returns>The search results as a property search.</returns>
        public ActionResult Search(PropertySearch search)
        {
            var result = this.searchAdapter.SearchUserProperties(User.Identity.Name, search);

            if (Request.IsAjaxRequest())
                return PartialView("SearchResults", result.Result);

            return View(result.Result);
        }
Exemple #10
0
        public ActionResult SearchProperties(FormCollection formCollection, int page = 1, string propertyResultsSort = "", int propertyResultsAmount = 25)
        {
            ViewBag.IdentifyPage = "Property Search";

            Session["CurrentSearchResultsAmount"] = propertyResultsAmount;
            Session["CurrentSearchResultsSort"]   = propertyResultsSort;

            //stick values into viewback for DDL update
            ViewBag.propertyResultsSort   = propertyResultsSort;
            ViewBag.propertyResultsAmount = propertyResultsAmount;

            //retrive values from post
            //based on whether there are dates create either a booking search or property search
            //create new object and populate - then run dynamic instance query on that object

            int    propertyTypeID = 0;
            int    vacationTypeID = 0;
            string poolType       = null;
            int    maxSleeps      = 0;
            int    noOfAdults     = 0;
            int    noOfChildren   = 0;
            int    noOfInfants    = 0;

            DateTime?startDate = null;
            DateTime?endDate   = null;;

            try
            {
                //parse dates
                if (formCollection["StartDate"] != "" && formCollection["StartDate"] != null)
                {
                    startDate = DateTime.ParseExact(formCollection["StartDate"], "dd/MM/yyyy", CultureInfo.InvariantCulture);
                }
                if (formCollection["EndDate"] != "" && formCollection["EndDate"] != null)
                {
                    endDate = DateTime.ParseExact(formCollection["EndDate"], "dd/MM/yyyy", CultureInfo.InvariantCulture);
                }
                if (formCollection["StartDate1"] != "" && formCollection["StartDate1"] != null)
                {
                    startDate = DateTime.ParseExact(formCollection["StartDate1"], "dd/MM/yyyy", CultureInfo.InvariantCulture);
                }
                if (formCollection["EndDate1"] != "" && formCollection["EndDate1"] != null)
                {
                    endDate = DateTime.ParseExact(formCollection["EndDate1"], "dd/MM/yyyy", CultureInfo.InvariantCulture);
                }

                //parse property Type ID
                if (Int32.Parse(formCollection["PropertyType"]) != 0)
                {
                    propertyTypeID = Int32.Parse(formCollection["PropertyType"]);
                }
                //parse region type
                if (Int32.Parse(formCollection["RegionType"]) != 0)
                {
                    vacationTypeID = Int32.Parse(formCollection["RegionType"]);
                }
                //parse poolType
                if (formCollection["PoolType"] != "" && formCollection["PoolType"] != null && poolType != "0")
                {
                    poolType = formCollection["PoolType"];
                }
                //parse max sleeps
                if (Int32.Parse(formCollection["MaxSleeps"]) != 0)
                {
                    maxSleeps = Int32.Parse(formCollection["MaxSleeps"]);
                }
                //parse no of adults
                if (Int32.Parse(formCollection["NoOfAdults"]) != 0)
                {
                    maxSleeps = Int32.Parse(formCollection["NoOfAdults"]);
                }
                //parse no of children
                if (Int32.Parse(formCollection["NoOfChildren"]) != 0)
                {
                    maxSleeps = Int32.Parse(formCollection["NoOfChildren"]);
                }
                //parse no of infants
                if (Int32.Parse(formCollection["NoOfInfants"]) != 0)
                {
                    maxSleeps = Int32.Parse(formCollection["NoOfInfants"]);
                }
                //parse price range

                //jsut to account for if we haven't be passed a price
                String[] splitPrice = "1-5000".Split('-');

                if (formCollection["PriceRange"] != "" && formCollection["PriceRange"] != null)
                {
                    splitPrice = null;
                    splitPrice = formCollection["PriceRange"].Split('-');
                }

                LinkedList <decimal> thePrices = new LinkedList <decimal>();



                foreach (var thePrice in splitPrice)
                {
                    int TryParseResult = 0;
                    //try parse to check it's a number
                    Int32.TryParse(thePrice.Trim().Replace("£", "").Replace("$", "").ToString(), out TryParseResult);


                    var cash = (decimal)TryParseResult;
                    if (TryParseResult != 0)
                    {
                        //IF SYSTEM IS US DOLLARS, NEED TO CONVERT THE NUMBER INTO POUNDS
                        if ((string)ConfigurationManager.AppSettings["defaultCurrency"] != "GBP")
                        {
                            var cc = new CurrencyConverterController();
                            cash = cc.ConvertCurrency((string)ConfigurationManager.AppSettings["defaultCurrency"], "GBP", (decimal)cash);
                        }
                        thePrices.AddLast(cash);
                    }
                }
                //end parse price range


                PriceRange customerQueryPriceRange = null;

                if (thePrices.Count > 0)
                {
                    customerQueryPriceRange = new PriceRange(thePrices.Min(), thePrices.Max());
                }
                else //pass the max range ever
                {
                    customerQueryPriceRange = new PriceRange(0, 100000);
                }

                //END FORM PARSE

                //Now test if there are dates - if yes - create a booking query. If no, create a property query


                //create property query
                PropertySearch newSearch = new PropertySearch()
                {
                    MaxSleeps           = maxSleeps,
                    NoOfAdults          = noOfAdults,
                    NoOfChildren        = noOfChildren,
                    NoOfInfants         = noOfInfants,
                    PoolType            = poolType,
                    PropertyTypeID      = propertyTypeID,
                    TheSearchPriceRange = customerQueryPriceRange,
                    VacationTypeID      = vacationTypeID
                };

                //do the search

                var searchResults = newSearch.SearchForMatchingProperties();
                //if there are dates, pass the search results into the BookingSearch

                if (startDate.HasValue && endDate.HasValue)
                {
                    //create booking query
                    searchResults = SearchBookingResultsAndReturnPropetiesWithoutAnOverlappingBooking(searchResults, (DateTime)startDate, (DateTime)endDate);
                }



                //for each sort / pager
                Session["LastSearchResults"] = PagedList.PagedListExtensions.ToPagedList(searchResults, page, searchResults.Count);
                //for fresh canvas for 'amount' sort
                Session["InitalCustomerSearchResults"] = PagedList.PagedListExtensions.ToPagedList(searchResults, page, searchResults.Count);
                //which page are we on of the results
                Session["LastPropertyPagerPage"] = page;


                ViewBag.MatchingProperties = PagedList.PagedListExtensions.ToPagedList(searchResults, page, propertyResultsAmount);

                Session["currentPagedPropertySearch"] = PagedList.PagedListExtensions.ToPagedList(searchResults, page, 500000);


                //store the last results set in the viewbag, so we can page it if necessary
            }

            catch (Exception ex)
            {
                Response.Write("Something is wrong in the SearchProperties in the Home Controller when trying to assing the variables " +
                               "from the POST from the search form");
            }



            //return results
            //create a new enquiry
            ViewBag.Keywords = "villa rental portugal, portugal silver coast, portugal cheap holidays, cheap holidays to portugal,silver coast portugal, portugal rental cottages, cheap all inclusive holidays to portugal";
            ViewBag.Title    = "Book your villa in Obidos, Nazare, Foz do Arelho or A-dos-Negros for a seaside holiday or rural townhouse with swimming pool and Internet. All types of villa, apartment are catered for in regions like Foz do Arelho, Obidos, Alfeizerao - Sao Martinho and Reguengo Grande. Stay in the lovely Salir do Porto and visit the Mafra Palace & Obidos during your vacation. With Portugal Rental Cottages, you can be up directly from the airport with our rental extras. While you stay, go on wine tasting tours to the beautiful Sanguinhal Estate and get picked up from the airport with our airport to villa transfer and return.";
            return(View());
        }