public static string GetListingTypeAsString(this ListingType listingType)
        {
            switch (listingType)
            {
            case ListingType.free:
                return("free");

                break;

            case ListingType.commercial:
                return("commercial");

                break;

            case ListingType.promoted:
                return("promoted");

                break;

            default:
                return("free");

                break;
            }
        }
        public static bool TryToListingType(this SearchType searchTypeType, out ListingType type)
        {
            switch (searchTypeType)
            {
            case SearchType.SeniorHousingAndCare:
            {
                type = ListingType.SeniorHousingAndCare;
                break;
            }

            case SearchType.ActiveAdultCommunities:
            {
                type = ListingType.ActiveAdultCommunities;
                break;
            }

            case SearchType.ActiveAdultHomes:
            {
                type = ListingType.ActiveAdultHomes;
                break;
            }

            default:
            {
                type = (ListingType)0;
                return(false);
            }
            }
            return(true);
        }
 public ChangeListingTypeStateCommand(long communityId, ListingType listingType, bool value)
 {
     base.StoredProcedureName = AdminStoredProcedures.SpPutCommunityListingType;
     this._communityId        = communityId;
     this._listingType        = listingType;
     this._value = value;
 }
Exemple #4
0
        public ParsePage VerifyMethodPageSourceNextAmp(ListingType mode)
        {
            if (mode != ListingType.Share)
            {
                VerifyRobotsPresentWithNoIndexFollow();
                VerifyCanonicalNotPresent();
            }
            else
            {
                VerifyCanonicalPresent();
                VerifyRobotsPresentWithNoIndexNoFollow();
            }
            if (Url.Contains("&"))
            {
                var url1 = Url.Replace("&", "&");
                PageSource.ShouldContain("<link rel=\"next\" href=\"" + url1 + "&amp;page=2\"");
                //RB: Checking next link
            }
            else
            {
                VerifyNextAmp();
            }

            return(this);
        }
        public List <ListingType> GetListingLoanTypes()
        {
            List <ListingType> lstListingtype = new List <ListingType>();
            DBUtility          objUtility     = new DBUtility();

            _cmd = new SqlCommand();

            _cmd.CommandType = CommandType.StoredProcedure;
            _cmd.CommandText = "GP_SP_GetListingLoanTypes";

            var _dt = new DataTable();

            _dt = objUtility.FillDataTable(_cmd, _dt);
            if (_dt.Rows.Count > 0)
            {
                foreach (DataRow dr in _dt.Rows)
                {
                    ListingType objListing = new ListingType();
                    objListing.ID   = Convert.ToInt32(dr["LoanTypeID"]);
                    objListing.Name = Convert.ToString(dr["LoanTypeName"]);
                    lstListingtype.Add(objListing);
                }
            }
            return(lstListingtype);
        }
        private void InsertData()
        {
            CityStateZip csz = new CityStateZip();
            csz.City = facCity.Text;
            csz.State = facState.Text;
            csz.ZipCode = facZipCode.Text;
            CityStateZipLogic cszLogic = new CityStateZipLogic();
            csz = cszLogic.InsertCityStateZip(csz);

            ListingType listingType = new ListingType();
            listingType.ListingTypeName = facListingType.Text;
            ListingTypeLogic ltLogic = new ListingTypeLogic();
            listingType = ltLogic.InsertListingType(listingType);

            Facility facility = new Facility();
            facility.ClientGuid = Guid.Parse(clientGuidTxt.Text);
            facility.FacilityName = facFacilityName.Text;
            facility.Exerpt = facExcerpt.Text;
            facility.Description = facDescription.Text;
            facility.PhoneNumber = facPhoneNumber.Text;
            facility.Address = facAddress.Text;
            facility.CityStateZipGuid = csz.CityStateZipGuid;
            facility.Email = facEmail.Text;
            facility.Website = facWebsite.Text;
            facility.ListingTypeGuid = listingType.ListingTypeGuid;
            facility.PublicPhotoFileUri = facPhotoUri.Text;
            FacilityLogic facilityLogic = new FacilityLogic();
            facilityLogic.InsertFacility(facility);
        }
Exemple #7
0
        public string GetCommunitiesMarketCopy(SearchCriteria criteria, ListingType listingType)
        {
            GetMarketCopyCommand getMarketCopyCommand = new GetMarketCopyCommand(criteria, new ListingType?(listingType));

            getMarketCopyCommand.Execute();
            return(getMarketCopyCommand.CommandResult);
        }
Exemple #8
0
        //[UITheory]
        //[InlineData(ListingType.Sale)]
        //[InlineData(ListingType.Rent)]
        //[InlineData(ListingType.Share)]
        //[InlineData(ListingType.Sold)]

        public void ViewPageSourceCountOld(ListingType mode)
        {
            Url =
                BuildUrl()
                .SetLocation(state: State.NSW, suburb: "Pyrmont", area: "Sydney City", postcode: "2009")
                .SetParameters(mode)
                .Perform(_baseUri);    // + query;

            ExecuteCmdOld();

            ReadAndGetListOld();

            switch (mode)
            {
            case ListingType.Sale:
                ParsePage(Url)
                .GetCountResults(CountSearchServiceList[0]);
                break;

            case ListingType.Rent:
                ParsePage(Url)
                .GetCountResults(CountSearchServiceList[1]);
                break;

            case ListingType.Share:
                ParsePage(Url)
                .GetCountResults(CountSearchServiceList[2]);
                break;

            case ListingType.Sold:
                ParsePage(Url)
                .GetCountResults(CountSearchServiceList[3]);
                break;
            }
        }
Exemple #9
0
        public BuildUrl SetParameters(ListingType mode = ListingType.Sale, PropertyType?propertyType = null,
                                      int?maxBed       = null, int?minBed = null, int?maxBath  = null, int?minBath  = null,
                                      int?maxCar       = null, int?minCar = null, int?maxPrice = null, int?minPrice = null,
                                      SearchPropertyFeature?propertyFeature = null, int?maxLand = null, int?minLand = null,
                                      string[] keyWords = null, bool map = false, int[] adId = null)
        {
            var parametersV1 = new SearchParametersV1
            {
                ListingType = mode,
                //LocationTerms = loc
                Locations        = new[] { SearchLocation },
                PropertyTypes    = propertyType == null ? new PropertyType[] { } : new[] { propertyType.Value },
                MaxBedrooms      = maxBed,
                MinBedrooms      = minBed,
                MaxBathrooms     = maxBath,
                MinBathrooms     = minBath,
                MaxCarspaces     = maxCar,
                MinCarspaces     = minCar,
                MaxPrice         = maxPrice,
                MinPrice         = minPrice,
                PropertyFeatures =
                    propertyFeature == null ? new SearchPropertyFeature[] { } : new[] { propertyFeature.Value },
                MaxLandArea = maxLand,
                MinLandArea = minLand,
                Keywords    = keyWords,
                DisplayMap  = map
            };

            SearchParameters = parametersV1;
            return(this);
        }
        public async Task <IActionResult> Index(int page,
                                                SortOptions sortOptions = SortOptions.Newest,
                                                ListingType listingType = ListingType.All)
        {
            var model = new ListWithFilterModel {
                SortOption = sortOptions
            };

            var searchText    = HttpContext.Session.GetString("search");
            var cachedFilters = HttpContext.Session.GetString("filters");

            if (!string.IsNullOrEmpty(searchText))
            {
                model.Search     = searchText;
                model.Properties = await _propertyViewModelService.Search(User.Identity.Name, searchText, model.SortOption);
            }
            else
            {
                if (cachedFilters != null)
                {
                    model.FilterSpecification = JsonConvert.DeserializeObject <PropertyFilterSpecification>(cachedFilters);
                }

                model.FilterSpecification.Reason = listingType;
                model.Properties = await _propertyViewModelService
                                   .ListProperties(User.Identity.Name, model.FilterSpecification, page == 0? 1 : page, Constants.ItemsPerPage,
                                                   model.SortOption);
            }

            await SetCacheEntries();

            return(View(model));
        }
        public async Task NewListing(ulong id, string n, string r, ListingType t = ListingType.Undefined)
        {
            DiscordSocketClient c    = _provider.GetService <DiscordSocketClient>();
            Listing             list = new Listing(r, id, "Undefined", t);
            await Listings.AddAsync(list);

            await SaveChangesAsync();
        }
Exemple #12
0
 public Listing(string r, ulong id, string name, ListingType t = ListingType.Undefined)
 {
     Reason = r;
     Type   = t;
     ID     = id;
     Name   = name;
     Date   = DateTime.Now;
 }
Exemple #13
0
 private bool HasListingType(List <ListingType> list, ListingType type)
 {
     if (list == null || !list.Any <ListingType>())
     {
         return(false);
     }
     return(list.Contains(type));
 }
        public IEnumerable <Listing> RecentTypes(ListingType listingType, int count)
        {
            var enumerable = _listings
                             .Where(l => l.ListingType == listingType)
                             .OrderByDescending(l => l.ListingDate)
                             .Take(count);

            return(enumerable);
        }
Exemple #15
0
 public IListingAgent(IAuthentication authentication, ListingType listingType, string path, string fileFilter, string subpathFilter, bool recurse)
 {
     Authentication = authentication;
     ListingType    = listingType;
     Path           = path;
     FileFilter     = fileFilter;
     SubpathFilter  = subpathFilter;
     Recurse        = recurse;
 }
        public async Task <ActionResult> ListingTypeUpdate(ListingType model)
        {
            var isNew = false;

            if (model.ID == 0)
            {
                model.ObjectState = Repository.Pattern.Infrastructure.ObjectState.Added;

                isNew = true;
                _listingTypeService.Insert(model);
            }
            else
            {
                var listingTypeExisting = await _listingTypeService.FindAsync(model.ID);

                listingTypeExisting.Name            = model.Name;
                listingTypeExisting.ButtonLabel     = model.ButtonLabel;
                listingTypeExisting.PriceUnitLabel  = model.PriceUnitLabel;
                listingTypeExisting.ShippingEnabled = model.ShippingEnabled;

                listingTypeExisting.PriceEnabled   = model.PriceEnabled;
                listingTypeExisting.PaymentEnabled = model.PaymentEnabled;
                if (model.PaymentEnabled)
                {
                    listingTypeExisting.OrderTypeID    = model.OrderTypeID;
                    listingTypeExisting.OrderTypeLabel = model.OrderTypeLabel;
                }

                listingTypeExisting.ObjectState = Repository.Pattern.Infrastructure.ObjectState.Modified;

                _listingTypeService.Update(listingTypeExisting);
            }

            await _unitOfWorkAsync.SaveChangesAsync();

            // Add item type to each category
            if (isNew)
            {
                foreach (var category in CacheHelper.Categories)
                {
                    _categoryListingTypeService.Insert(new CategoryListingType()
                    {
                        CategoryID    = category.ID,
                        ListingTypeID = model.ID,
                        ObjectState   = Repository.Pattern.Infrastructure.ObjectState.Added
                    });
                }
                await _unitOfWorkAsync.SaveChangesAsync();
            }

            _dataCacheService.RemoveCachedItem(CacheKeys.ListingTypes);

            return(RedirectToAction("ListingTypes"));
        }
Exemple #17
0
        public void ViewPageSource_Suburb_Query_Suburb(ListingType mode, string query)
        {
            Url =
                BuildUrl()
                .SetLocation(state: null)
                .SetParameters(mode)
                .Perform(_baseUri) + query;

            ParsePage(Url)
            .VerifyRobotsPresentWithNoIndexFollow()
            .VerifyURLWithQuerySuburbCanonical();
        }
Exemple #18
0
 /// <summary>
 ///     * This method will check for Sold, Sale, Rent
 ///     and any URLwithout a query type('?' +query type):
 ///     - If the canonical link is present
 ///     - If the meta robots tag
 ///     < NOINDEX, NOFOLLOW>
 ///         is present
 ///         - If the link for next page is present and in a correct format
 ///         * Any pages which contains an URLs with a query type have to contain
 ///         the meta robots tag
 ///         < NOINDEX, FOLLOW>
 ///             .
 ///             * For any Share listings, the method will *not* check
 ///             if the next link is present
 /// </summary>
 /// <param name="mode"></param>
 public ParsePage VerifyPageSource(ListingType mode)
 {
     if (mode != ListingType.Share)
     {
         if (Url.Contains("?"))
         {
             var cutUrl = Url.Split('?');
             Url = cutUrl[0];
             VerifyCanonicalPresent();
             VerifyRobotsPresentWithNoIndexFollow();
             PageSource.ShouldContain("<link rel=\"next\" href=\"" + Url + "?page=2\"");
         }
         else
         {
             if (Url.Contains("auction"))
             {
                 Url = Url.Replace("http", "https");
                 VerifyCanonicalPresent();
                 VerifyRobotsNotPresent();
             }
             else
             {
                 VerifyCanonicalPresent();
                 if (Url.Contains("sold"))
                 {
                     VerifyRobotsPresentWithNoIndexFollow();
                 }
                 else
                 {
                     VerifyRobotsNotPresent();
                 }
                 PageSource.ShouldContain("<link rel=\"next\" href=\"" + Url + "?page=2\"");
                 //RB: Checking next link
             }
         }
     }
     else
     {
         if (Url.Contains("?"))
         {
             var cutUrl = Url.Split('?');
             Url = cutUrl[0];
             VerifyCanonicalPresent();
             VerifyRobotsPresentWithNoIndexFollow();
         }
         else
         {
             VerifyCanonicalPresent();
             VerifyRobotsNotPresent();
         }
     }
     return(this);
 }
Exemple #19
0
        private string ListingTypeToTypeString(ListingType type)
        {
            switch (type)
            {
            case ListingType.Rent:
                return("huur");

            case ListingType.Sale:
                return("koop");

            default:
                throw new ArgumentException($"Unknown listingtype {type}");
            }
        }
Exemple #20
0
        public async Task <IEnumerable <ObjectForSale> > GetObjects(ListingType type, params string[] searchTerms)
        {
            var objects  = new List <ObjectForSale>();
            var pageSize = _configuration.PageSize;
            var objectsFromWebservice = await _client.GetObjects(type, 1, pageSize, 1, searchTerms).ConfigureAwait(false);

            for (var pageNr = 2; pageNr <= objectsFromWebservice.NumberOfPages; pageNr++)
            {
                objects.AddRange(objectsFromWebservice.Result);
                objectsFromWebservice = await _client.GetObjects(type, pageNr, pageSize, 1, searchTerms).ConfigureAwait(false);
            }

            return(objects);
        }
        public async Task <ActionResult> ListingTypeUpdate(int?id)
        {
            ListingType ListingType = new ListingType();

            if (id.HasValue)
            {
                ListingType = await _listingTypeService.FindAsync(id);

                if (ListingType == null)
                {
                    return(new HttpNotFoundResult());
                }
            }

            return(View(ListingType));
        }
        public void AddTrigger(int itemID, IsTriggered trigger, ItemPrice threshold, ListingType type)
        {
            if (_timer == null)
            {
                _timer          = new Timer(1000 * (60 * 3)); //Interval is 3 minute.
                _timer.Elapsed += TimerElapsed;
                _timer.Start();
            }

            if (_triggers == null)
            {
                _triggers = new List <PriceTrigger>();
            }

            _triggers.Add(new PriceTrigger()
            {
                ItemID = itemID, Trigger = trigger, Threshold = threshold, ListingType = type
            });
        }
Exemple #23
0
 public Book(
     int bookID,
     string author, string title,
     int year, Price price, string email,
     ListingType listingType, string abn, string contactName, string phone,
     string comments = "")
 {
     this.BookID      = bookID;
     this.Author      = author;
     this.Title       = title;
     this.Year        = year;
     this.Price       = price;
     this.Email       = email;
     this.ListingType = listingType;
     this.ABN         = abn;
     this.ContactName = contactName;
     this.Phone       = phone;
     this.Comments    = comments;
 }
Exemple #24
0
        public async Task <PagedResult <IEnumerable <ObjectForSale> > > GetObjects(ListingType listingType, int pageNumber, int pageSize, int tryNumber = 1, params string[] searchTerms)
        {
            if (tryNumber > _maxRetries)
            {
                throw new RequestLimitExceededException();
            }

            var queryString = "";

            if (searchTerms != null && searchTerms.Length > 0)
            {
                var searchTermsAsQueryString = string.Join('/', searchTerms);
                queryString = $"&zo=/{searchTermsAsQueryString}/";
            }

            var requestUrl = string.Format(_baseUrl, ListingTypeToTypeString(listingType), queryString, pageNumber, pageSize);
            var response   = await _client.GetAsync(requestUrl);

            if (IsRequestLimitExceeded(response.StatusCode, response.ReasonPhrase))
            {
                _logger.Info($"Request limit exceeded. Waiting for {_sleepTime / 1000} seconds before trying again. Try number {tryNumber} of {_maxRetries}");
                Thread.Sleep(5000);
                return(await this.GetObjects(listingType, pageNumber, pageNumber, ++tryNumber, searchTerms).ConfigureAwait(false));
            }

            if (!response.IsSuccessStatusCode)
            {
                throw new Exception(response.StatusCode + ": " + response.ReasonPhrase);
            }

            var content = await response.Content.ReadAsStringAsync();

            var fundaObjects = JsonConvert.DeserializeObject <FundaResultDTO>(content);

            return(new PagedResult <IEnumerable <ObjectForSale> >()
            {
                CurrentPage = fundaObjects.Paging.HuidigePagina,
                NumberOfPages = fundaObjects.Paging.AantalPaginas,
                Result = fundaObjects.Objects.Select(o =>
                                                     new ObjectForSale(o.Id, o.Adres, new Realtor(o.MakelaarId, o.MakelaarNaam)))
            });
        }
Exemple #25
0
        /// <summary>
        /// This optional argument specifies which type of listing the user is interested in.
        /// Valid values include:
        /// * blended - request KML, Local Business Listings, and Geocode results
        /// * kmlonly - request KML and Geocode results
        /// * localonly - request Local Business Listings and Geocode results
        ///
        /// If this argument is not supplied, the default value of localonly is used.
        /// </summary>
        /// <param name="lt"></param>
        void SetListingType(ListingType lt)
        {
            string val = null;

            switch (lt)
            {
            case ListingType.Blended:
                val = "blended";
                break;

            case ListingType.KmlOnly:
                val = "kmlonly";
                break;

            case ListingType.LocalOnly:
                val = "localonly";
                break;
            }

            SetOption("mrt", val);
        }
        public static SearchType ToSearchType(this ListingType listingType)
        {
            switch (listingType)
            {
            case ListingType.ActiveAdultCommunities:
            {
                return(SearchType.ActiveAdultCommunities);
            }

            case ListingType.ActiveAdultHomes:
            {
                return(SearchType.ActiveAdultHomes);
            }

            case ListingType.SeniorHousingAndCare:
            {
                return(SearchType.SeniorHousingAndCare);
            }
            }
            throw new IndexOutOfRangeException(string.Format("Can't convert from '{0}' community listing type to appropriate search type.", listingType));
        }
        public List <ListingType> GetListingTypes()
        {
            var _db   = new DBUtility();
            var token = new List <ListingType>();
            var _dt   = new DataTable();

            _cmd             = new SqlCommand();
            _cmd.CommandType = CommandType.StoredProcedure;
            _cmd.CommandText = "GP_SP_GetListingTypes";
            _dt = _db.FillDataTable(_cmd, _dt);
            if (_dt.Rows.Count > 0)
            {
                foreach (DataRow dr in _dt.Rows)
                {
                    var temp = new ListingType();
                    temp.ID   = Convert.ToInt32(dr["ID"]);
                    temp.Name = Convert.ToString(dr["Name"]);
                    token.Add(temp);
                }
            }
            return(token);
        }
        private ActionResult GetResult(string category, string city, int take, ListingType listingType)
        {
            var agents = _context.Agents
                         .Where(x => x.ListingType == listingType)
                         .OrderByDescending(x => x.Listings)
                         .Take(take)
                         .ToList();

            if (!agents.Any())
            {
                _logger.LogDebug($"No agents were found, fetching data...");

                var result = listingType == ListingType.All ? _sourceController.FetchAgents(category, city).Result
                                                            : _sourceController.FetchAgentsThatSellGardens(category, city, "tuin").Result;

                if (result is OkResult)
                {
                    return(Ok
                           (
                               _context.Agents
                               .Where(x => x.ListingType == listingType)
                               .OrderByDescending(x => x.Listings)
                               .Take(take)
                               .ToList()
                           ));
                }

                return(NotFound(
                           new
                {
                    error = "Something went wrong trying to fetch agents. Please try again later."
                }
                           ));
            }

            return(Ok(agents));
        }
 /// <summary>
 /// Removes ListingType from the collection.
 /// </summary>
 /// <param name="listingType">The listingType to remove.</param>
 public void Remove(ListingType listingType)
 {
     List.Remove(listingType);
 }
 public ListingTypeAlreadyExistsException(ListingType listingType)
     : base(null, listingType)
 {
 }
 /// <summary>
 /// Adds a ListingType to the collection.
 /// </summary>
 /// <param name="listingType">The listingType to add.</param>
 public void Add(ListingType listingType)
 {
     //listingType.Owner = this;
     List.Add(listingType);
 }
        public async Task <IOrderedEnumerable <KeyValuePair <Realtor, int> > > GetRankedList(ListingType listingType, params string[] searchTerms)
        {
            var objectsForSale = await _objectService.GetObjects(listingType, searchTerms);

            var numberOfObjectsPerRealtor = objectsForSale.GroupBy(o => o.Realtor, o => o).ToDictionary(o => o.Key, o => o.Count());

            // first order by the actual number of items and then by the name of the realtor for reproducable results.
            var orderedList = numberOfObjectsPerRealtor.OrderByDescending(rank => rank.Value).ThenBy(rank => rank.Key.Name);

            return(orderedList);
        }
 protected ListingTypeException(string message, ListingType listingType)
     : base(message)
 {
     this.ListingType = listingType;
 }
        // car search
        /// <summary>
        /// <para>Performs the Search Method:
        /// Search Used Motors.
        /// Creates a query string based on the parameters provided, can be null if the parameter is not required for the request.
        /// </para>
        /// DOES NOT REQUIRE AUTHENTICATION.
        /// </summary>
        /// <param name="searchString">One or more keywords to use in a search query.</param>
        /// <param name="userRegion">Restricts search results to items from sellers located in the specified region.</param>
        /// <param name="sortOrder">Sort the returned record-set by a single specified sort order.</param>
        /// <param name="priceMin">Minimum price.</param>
        /// <param name="priceMax">Maximum price.</param>
        /// <param name="make">Car make.</param>
        /// <param name="model">Car model.</param>
        /// <param name="bodyStyle">Car body style.</param>
        /// <param name="doorsMin">Minimum number of doors (range from 2 to 5).</param>
        /// <param name="doorsMax">Maximum number of doors. </param>
        /// <param name="transmission">Transmission type.</param>
        /// <param name="yearMax">Maximum year of manufacture.</param>
        /// <param name="yearMin">Minimum year of manufacture.</param>
        /// <param name="energySizeMin">Minimum engine size in cubic centimetres (e.g. 2000 for 2 litre engine). </param>
        /// <param name="energySizeMax">Maximum engine size.</param>
        /// <param name="odometerMin">	Minimum odometer value in kilometres.</param>
        /// <param name="odometerMax">Maximum odometer value.</param>
        /// <param name="listingType">Type of listing.</param>
        /// <param name="dateFrom">Return only listings started from this date.</param>
        /// <param name="page">Page number.</param>
        /// <param name="rows">Number of rows per page.</param>
        /// <returns>Cars.</returns>
        public Cars SearchUsedMotors(
            string searchString,
            int? userRegion,
            SortOrder sortOrder,
            decimal priceMin,
            decimal priceMax,
            string make,
            string model,
            BodyStyle bodyStyle,
            int? doorsMin,
            int? doorsMax,
            Transmission transmission,
            int? yearMax,
            int? yearMin,
            int? energySizeMin,
            int? energySizeMax,
            int? odometerMin,
            int? odometerMax,
            ListingType listingType,
            DateTime dateFrom,
            int? page,
            int? rows)
        {
            var url = String.Format(Constants.Culture, "{0}/{1}/Used{2}", Constants.SEARCH, Constants.MOTORS, Constants.XML);
            _addAnd = false;
            var conditions = "?";

            // create the parameters for the query string
            conditions += SearchMethods.ConstructQueryHelper(Constants.SEARCH_STRING, searchString, _addAnd);
            conditions += SearchMethods.ConstructQueryHelper(Constants.USER_REGION, string.Empty + userRegion, _addAnd);
            conditions += SearchMethods.ConstructQueryHelper(Constants.PRICE_MIN, string.Empty + priceMin, _addAnd);
            conditions += SearchMethods.ConstructQueryHelper(Constants.SORT_ORDER, string.Empty + sortOrder, _addAnd);
            conditions += SearchMethods.ConstructQueryHelper(Constants.PRICE_MAX, string.Empty + priceMax, _addAnd);
            conditions += SearchMethods.ConstructQueryHelper(Constants.MAKE, make, _addAnd);
            conditions += SearchMethods.ConstructQueryHelper(Constants.MODEL, model, _addAnd);
            conditions += SearchMethods.ConstructQueryHelper(Constants.BODY_STYLE, bodyStyle.ToString(), _addAnd);
            conditions += SearchMethods.ConstructQueryHelper(Constants.DOORS_MIN, string.Empty + doorsMin, _addAnd);
            conditions += SearchMethods.ConstructQueryHelper(Constants.DOORS_MAX, string.Empty + doorsMax, _addAnd);
            conditions += SearchMethods.ConstructQueryHelper(Constants.TRANSMISSION, transmission.ToString(), _addAnd);
            conditions += SearchMethods.ConstructQueryHelper(Constants.YEAR_MIN, string.Empty + yearMin, _addAnd);
            conditions += SearchMethods.ConstructQueryHelper(Constants.YEAR_MAX, string.Empty + yearMax, _addAnd);
            conditions += SearchMethods.ConstructQueryHelper(Constants.ENERGY_SIZE_MAX, string.Empty + energySizeMax, _addAnd);
            conditions += SearchMethods.ConstructQueryHelper(Constants.ENERGY_SIZE_MIN, string.Empty + energySizeMin, _addAnd);
            conditions += SearchMethods.ConstructQueryHelper(Constants.ODOMETER_MIN, string.Empty + odometerMin, _addAnd);
            conditions += SearchMethods.ConstructQueryHelper(Constants.ODOMETER_MAX, string.Empty + odometerMax, _addAnd);
            conditions += SearchMethods.ConstructQueryHelper(Constants.LISTING_TYPE, listingType.ToString(), _addAnd);
            conditions += SearchMethods.ConstructQueryHelper(Constants.DATE_FROM, Client.DateToStringConverter(dateFrom), _addAnd);
            conditions += SearchMethods.ConstructQueryHelper(Constants.PAGE, string.Empty + page, _addAnd);
            conditions += SearchMethods.ConstructQueryHelper(Constants.ROWS, string.Empty + rows, _addAnd);

            // add the parameters to the query string if there are any
            if (conditions.Equals("?"))
            {
                url += conditions;
            }

            // perform the request
            return this.SearchUsedMotors(url);
        }
Exemple #35
0
        public List <S3Object> ListObjects(string bucketName, string prefix, ListingType listType, bool recurse, string directoryFilter, string fileFilter, int maxResults = Int32.MaxValue)
        {
            List <S3Object> ret = new List <S3Object>();

            prefix = prefix.Replace('\\', '/');
            prefix = prefix.TrimEnd('/');
            prefix = prefix + "/";

            Regex inclusiveDirFilter = null;

            if (_InclusiveDirFilter.ContainsKey(directoryFilter))
            {
                inclusiveDirFilter = _InclusiveDirFilter[directoryFilter];
            }
            else
            {
                inclusiveDirFilter = STEM.Sys.IO.Path.BuildInclusiveFilter(directoryFilter);
                if (inclusiveDirFilter != null)
                {
                    _InclusiveDirFilter[directoryFilter] = inclusiveDirFilter;
                }
            }

            Regex exclusiveDirFilter = null;

            if (_ExclusiveDirFilter.ContainsKey(directoryFilter))
            {
                exclusiveDirFilter = _ExclusiveDirFilter[directoryFilter];
            }
            else
            {
                exclusiveDirFilter = STEM.Sys.IO.Path.BuildExclusiveFilter(directoryFilter);
                if (exclusiveDirFilter != null)
                {
                    _ExclusiveDirFilter[directoryFilter] = exclusiveDirFilter;
                }
            }

            Regex inclusiveFileFilter = null;

            if (_InclusiveFileFilter.ContainsKey(fileFilter))
            {
                inclusiveFileFilter = _InclusiveFileFilter[fileFilter];
            }
            else
            {
                inclusiveFileFilter = STEM.Sys.IO.Path.BuildInclusiveFilter(fileFilter);
                if (inclusiveFileFilter != null)
                {
                    _InclusiveFileFilter[fileFilter] = inclusiveFileFilter;
                }
            }

            Regex exclusiveFileFilter = null;

            if (_ExclusiveFileFilter.ContainsKey(fileFilter))
            {
                exclusiveFileFilter = _ExclusiveFileFilter[fileFilter];
            }
            else
            {
                exclusiveFileFilter = STEM.Sys.IO.Path.BuildExclusiveFilter(fileFilter);
                if (exclusiveFileFilter != null)
                {
                    _ExclusiveFileFilter[fileFilter] = exclusiveFileFilter;
                }
            }

            if (String.IsNullOrEmpty(bucketName))
            {
                List <S3Object> buckets = new List <S3Object>();
                foreach (S3Bucket i in ListBuckets())
                {
                    S3Object o = new S3Object();
                    o.BucketName   = i.BucketName;
                    o.Key          = "";
                    o.LastModified = i.CreationDate;
                    o.Size         = -1;

                    buckets.Add(o);
                }

                if (listType != ListingType.File)
                {
                    if (inclusiveDirFilter != null)
                    {
                        buckets = buckets.Where(i => inclusiveDirFilter.IsMatch(STEM.Sys.IO.Path.GetFileName(i.BucketName.TrimEnd('/')).ToUpper())).ToList();
                    }

                    if (exclusiveDirFilter != null)
                    {
                        buckets = buckets.Where(i => !exclusiveDirFilter.IsMatch(STEM.Sys.IO.Path.GetFileName(i.BucketName.TrimEnd('/')).ToUpper())).ToList();
                    }

                    ret.AddRange(buckets);
                }

                if (recurse)
                {
                    foreach (S3Object i in buckets)
                    {
                        ret.AddRange(ListObjects(i.BucketName, "", listType, recurse, directoryFilter, fileFilter, maxResults));
                    }
                }

                return(ret);
            }

            List <S3Object> fullList = ListObjects(bucketName, prefix, maxResults);

            List <string> folders = fullList.Where(i => !i.Key.EndsWith("/") && STEM.Sys.IO.Path.GetDirectoryName(i.Key).Replace("\\", "/").TrimEnd('/') != prefix.TrimEnd('/')).Select(i => STEM.Sys.IO.Path.GetDirectoryName(i.Key).Replace("\\", "/").TrimEnd('/') + '/').ToList();

            folders.AddRange(fullList.Where(i => i.Key.EndsWith("/") && i.Key != prefix).Select(i => i.Key));

            folders = folders.Distinct().ToList();

            if (inclusiveDirFilter != null)
            {
                folders = folders.Where(i => inclusiveDirFilter.IsMatch(i.TrimEnd('/').ToUpper())).ToList();
            }

            if (exclusiveDirFilter != null)
            {
                folders = folders.Where(i => !exclusiveDirFilter.IsMatch(i.TrimEnd('/').ToUpper())).ToList();
            }

            if (!recurse)
            {
                folders = folders.Where(i => i.Equals(prefix, StringComparison.InvariantCultureIgnoreCase)).ToList();
            }

            List <S3Object> ret2 = fullList.Where(i => !i.Key.EndsWith("/")).ToList();

            if (inclusiveFileFilter != null)
            {
                ret2 = ret2.Where(i => inclusiveFileFilter.IsMatch(STEM.Sys.IO.Path.GetFileName(i.Key).ToUpper())).ToList();
            }

            if (exclusiveFileFilter != null)
            {
                ret2 = ret2.Where(i => !exclusiveFileFilter.IsMatch(STEM.Sys.IO.Path.GetFileName(i.Key).ToUpper())).ToList();
            }

            foreach (S3Object o in ret2)
            {
                if (folders.Exists(i => i.Equals(STEM.Sys.IO.Path.GetDirectoryName(o.Key).Replace("\\", "/") + "/", StringComparison.InvariantCultureIgnoreCase)))
                {
                    ret.Add(o);
                }
                else if (prefix.Equals(STEM.Sys.IO.Path.GetDirectoryName(o.Key).Replace("\\", "/") + "/", StringComparison.InvariantCultureIgnoreCase))
                {
                    ret.Add(o);
                }
            }

            if (listType == ListingType.Directory)
            {
                ret = ret.Where(i => i.Key.EndsWith("/") && i.Key != prefix).ToList();
            }
            else if (listType == ListingType.File)
            {
                ret = ret.Where(i => !i.Key.EndsWith("/")).ToList();
            }

            return(ret);
        }
        // car search
        /// <summary>
        /// <para>Performs the Search Method:
        /// Search Used Motors.
        /// Creates a query string based on the parameters provided, can be null if the parameter is not required for the request.
        /// </para>
        /// DOES NOT REQUIRE AUTHENTICATION.
        /// </summary>
        /// <param name="searchString">One or more keywords to use in a search query.</param>
        /// <param name="userRegion">Restricts search results to items from sellers located in the specified region.</param>
        /// <param name="sortOrder">Sort the returned record-set by a single specified sort order.</param>
        /// <param name="priceMin">Minimum price.</param>
        /// <param name="priceMax">Maximum price.</param>
        /// <param name="make">Car make.</param>
        /// <param name="model">Car model.</param>
        /// <param name="bodyStyle">Car body style.</param>
        /// <param name="doorsMin">Minimum number of doors (range from 2 to 5).</param>
        /// <param name="doorsMax">Maximum number of doors. </param>
        /// <param name="transmission">Transmission type.</param>
        /// <param name="yearMax">Maximum year of manufacture.</param>
        /// <param name="yearMin">Minimum year of manufacture.</param>
        /// <param name="energySizeMin">Minimum engine size in cubic centimetres (e.g. 2000 for 2 litre engine). </param>
        /// <param name="energySizeMax">Maximum engine size.</param>
        /// <param name="odometerMin">	Minimum odometer value in kilometres.</param>
        /// <param name="odometerMax">Maximum odometer value.</param>
        /// <param name="listingType">Type of listing.</param>
        /// <param name="dateFrom">Return only listings started from this date.</param>
        /// <param name="page">Page number.</param>
        /// <param name="rows">Number of rows per page.</param>
        /// <returns>Cars.</returns>
        public Cars SearchUsedMotors(
            string searchString,
            int? userRegion,
            SortOrder sortOrder,
            decimal priceMin,
            decimal priceMax,
            string make,
            string model,
            BodyStyle bodyStyle,
            int? doorsMin,
            int? doorsMax,
            Transmission transmission,
            int? yearMax,
            int? yearMin,
            int? energySizeMin,
            int? energySizeMax,
            int? odometerMin,
            int? odometerMax,
            ListingType listingType,
            DateTime dateFrom,
            int? page,
            int? rows)
        {
            if (_search == null)
            {
                _search = new SearchMethods(_connection);
            }

            return _search.SearchUsedMotors(searchString, userRegion, sortOrder, priceMin, priceMax, make, model, bodyStyle, doorsMin, doorsMax, transmission, yearMax, yearMin, energySizeMin, energySizeMax, odometerMin, odometerMax, listingType, dateFrom, page, rows);
        }
Exemple #37
0
 public override IListingAgent ConstructListingAgent(ListingType listingType, string path, string fileFilter, string subpathFilter, bool recurse)
 {
     return(new ListingAgent(this, listingType, path, fileFilter, subpathFilter, recurse));
 }