Exemple #1
0
        /// <summary>
        /// Creates a <see cref="SortExpression"/> from a lambda expression.
        /// </summary>
        /// <example>
        /// <code><![CDATA[
        /// var sort = CreateSortExpressionFromLambda(new PropertySortOrder
        /// {
        ///     (model => model.CreatedAt, ListSortDirection.Ascending),
        ///     (model => model.Password, ListSortDirection.Descending)
        /// });
        /// ]]></code>
        /// </example>
        protected SortExpression CreateSortExpressionFromLambda(PropertySortOrder keySelectors)
        {
            if (keySelectors == null)
            {
                throw new ArgumentNullException(nameof(keySelectors));
            }

            List <SortElementExpression> sortElements = new List <SortElementExpression>();

            foreach (var(keySelector, sortDirection) in keySelectors)
            {
                bool isAscending = sortDirection == ListSortDirection.Ascending;
                var  attribute   = ResourceGraph.GetAttributes(keySelector).Single();

                var sortElement = new SortElementExpression(new ResourceFieldChainExpression(attribute), isAscending);
                sortElements.Add(sortElement);
            }

            return(new SortExpression(sortElements));
        }
Exemple #2
0
        protected void DataGridCategories_Sorting(object sender, GridViewSortEventArgs e)
        {
            PropertySortOrder propertySortOrder = PropertySortOrder.Ascending;

            if (SortInfo.PropertyName == e.SortExpression)
            {
                switch (SortInfo.SortOrder)
                {
                case PropertySortOrder.Ascending:
                    propertySortOrder = PropertySortOrder.Descending;
                    e.SortDirection   = SortDirection.Descending;
                    break;

                case PropertySortOrder.Descending:
                    propertySortOrder = PropertySortOrder.Ascending;
                    e.SortDirection   = SortDirection.Ascending;
                    break;
                }
            }
            SortInfo = new PropertySortInfo(e.SortExpression, propertySortOrder);

            presenter.FindAllDataBind();
        }
        /// <summary>
        /// <para>Performs the search method:
        /// Search Rural Property.
        /// Creates a query string using the parameters provided - parameters can be null if they are 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="sortOrder">Sort the returned record-set by a single specified sort order.</param>
        /// <param name="page">	Page number.</param>
        /// <param name="rows">Number of rows per page.</param>
        /// <param name="region">Specifies the search region ID.</param>
        /// <param name="district">Specifies the search district ID.</param>
        /// <param name="suburb">Specifies the search suburb ID.</param>
        /// <param name="dateFrom">Specifies minimum start date for returned listings.</param>
        /// <param name="priceMin">Minimum property price.</param>
        /// <param name="priceMax">Maximum property price.</param>
        /// <param name="landAreaMin">Minimum land area in square meters.</param>
        /// <param name="landAreaMax">Maximum land area in square meters.</param>
        /// <param name="usage">The usage of the property.</param>
        /// <returns>Properties.</returns>
        public global::Properties SearchRuralProperties(
            string searchString,
            PropertySortOrder sortOrder,
            int? page,
            int? rows,
            int? region,
            int? district,
            int? suburb,
            DateTime dateFrom,
            int? priceMin,
            int? priceMax,
            int? landAreaMin,
            int? landAreaMax,
            RuralPropertyUsage usage)
        {
            if (_search == null)
            {
                _search = new SearchMethods(_connection);
            }

            return _search.SearchRuralProperties(searchString, sortOrder, page, rows, region, district, suburb, dateFrom, priceMin, priceMax, landAreaMin, landAreaMax, usage);
        }
        /// <summary>
        /// <para>Performs the search method:
        /// Search Retirement Villages.
        /// Creates a query string using the parameters provided - parameters can be null if they are 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="sortOrder">Sort the returned record-set by a single specified sort order.</param>
        /// <param name="page">Page number.</param>
        /// <param name="rows">Number of rows per page.</param>
        /// <param name="region">Specifies the search region ID.</param>
        /// <param name="district">Specifies the search district ID.</param>
        /// <param name="suburb">Specifies the search suburb ID.</param>
        /// <param name="dateFrom">Specifies minimum start date for returned listings.</param>
        /// <param name="priceMin">Minimum property price.</param>
        /// <param name="priceMax">Maximum property price.</param>
        /// <param name="bathroomsMin">Minimum number of bathrooms..</param>
        /// <param name="bathroomsMax">Maximum number of bathrooms.</param>
        /// <param name="areaMin">	Minimum floor area in square meters.</param>
        /// <param name="areaMax">	Maximum square area in square meters.</param>
        /// <param name="landAreaMin">Minimum land area in square meters.</param>
        /// <param name="landAreaMax">Maximum land area in square meters.</param>
        /// <param name="propertyType">The property type.</param>
        /// <param name="bedroomsMin">Minimum number of bedrooms.</param>
        /// <param name="bedroomsMax">Maximum number of bedrooms.</param>
        /// <returns>RetirementVillages.</returns>
        public RetirementVillages SearchRetirementVillages(
            string searchString,
            PropertySortOrder sortOrder,
            int? page,
            int? rows,
            int? region,
            int? district,
            int? suburb,
            DateTime dateFrom,
            int? priceMin,
            int? priceMax,
            int? bathroomsMin,
            int? bathroomsMax,
            int? areaMin,
            int? areaMax,
            int? landAreaMin,
            int? landAreaMax,
            RetirementVillagePropertyType propertyType,
            int? bedroomsMin,
            int? bedroomsMax)
        {
            if (_search == null)
            {
                _search = new SearchMethods(_connection);
            }

            return _search.SearchRetirementVillages(searchString, sortOrder, page, rows, region, district, suburb, dateFrom, priceMin, priceMax, bathroomsMin, bathroomsMax, areaMin, areaMax, landAreaMin, landAreaMax, propertyType, bedroomsMin, bedroomsMax);
        }
        /// <summary>
        /// <para>Performs the Search Method:
        /// Search Residential Rental Property.
        /// Creates a query string using the parameters provided - parameters can be null if they are 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="sortOrder">Sort the returned record-set by a single specified sort order.</param>
        /// <param name="page">Page number.</param>
        /// <param name="rows">Number of rows per page.</param>
        /// <param name="region">Specifies the search region ID.</param>
        /// <param name="district">Specifies the search district ID.</param>
        /// <param name="suburb">Specifies the search suburb ID.</param>
        /// <param name="dateFrom">Specifies minimum start date for returned listings.</param>
        /// <param name="priceMin">Minimum property price.</param>
        /// <param name="priceMax">Maximum property price.</param>
        /// <param name="bathroomsMin">Minimum number of bathrooms.</param>
        /// <param name="bathroomsMax">Maximum number of bathrooms.</param>
        /// <param name="bedroomsMin">Minimum number of bedrooms.</param>
        /// <param name="bedroomsMax">Maximum number of bedrooms.</param>
        /// <param name="areaMax">Maximum square area in square meters.</param>
        /// <param name="areaMin">Minimum floor area in square meters.</param>
        /// <param name="landAreaMin">Minimum land area in square meters.</param>
        /// <param name="landAreaMax">Maximum land area in square meters.</param>
        /// <param name="propertyType">The type of the property.</param>
        /// <param name="adjacentSuburbs">Indicates whether the search should include listings in adjacent suburbs.</param>
        /// <returns>Properties.</returns>
        public global::Properties SearchResidentialRentalProperties(
            string searchString,
            PropertySortOrder sortOrder,
            int? page,
            int? rows,
            int? region,
            int? district,
            int? suburb,
            DateTime dateFrom,
            int? priceMin,
            int? priceMax,
            int? bathroomsMin,
            int? bathroomsMax,
            int? bedroomsMin,
            int? bedroomsMax,
            int? areaMax,
            int? areaMin,
            int? landAreaMin,
            int? landAreaMax,
            PropertyType propertyType,
            bool? adjacentSuburbs)
        {
            if (_search == null)
            {
                _search = new SearchMethods(_connection);
            }

            return _search.SearchResidentialRentalProperties(searchString, sortOrder, page, rows, region, district, suburb, dateFrom, priceMin, priceMax, bathroomsMin, bathroomsMax, bedroomsMin, bedroomsMax, areaMax, areaMin, landAreaMin, landAreaMax, propertyType, adjacentSuburbs);
        }
        /// <summary>
        /// <para>Performs the Search Method:
        /// Search for Flatmate
        /// Creates a query string using the parameters provided - parameters can be null if they are 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="sortOrder">Sort the returned record-set by a single specified sort order.</param>
        /// <param name="page">Page number.</param>
        /// <param name="rows">Number of rows per page.</param>
        /// <param name="region">Specifies the search region ID.</param>
        /// <param name="district">Specifies the search district ID.</param>
        /// <param name="suburb">Specifies the search suburb ID.</param>
        /// <param name="dateFrom">Specifies minimum start date for returned listings.</param>
        /// <param name="priceMin">Minimum property price.</param>
        /// <param name="priceMax">Maximum property price.</param>
        /// <returns>Flatmates.</returns>
        public Flatmates SearchFlatmates(
            string searchString,
            PropertySortOrder sortOrder,
            int? page,
            int? rows,
            int? region,
            int? district,
            int? suburb,
            DateTime dateFrom,
            int? priceMin,
            int? priceMax)
        {
            if (_search == null)
            {
                _search = new SearchMethods(_connection);
            }

            return _search.SearchFlatmates(searchString, sortOrder, page, rows, region, district, suburb, dateFrom, priceMin, priceMax);
        }
 /// <summary>
 /// Construtor da estrutura.
 /// </summary>
 /// <param name="propertyName">Nome da propriedade</param>
 /// <param name="sortOrder">Direção do ordenamento.</param>
 public PropertySortInfo(string propertyName, PropertySortOrder sortOrder)
 {
     this.propertyName = propertyName ?? "";
     this.sortOrder    = sortOrder;
 }
        /// <summary>
        /// <para>Performs the search method:
        /// Search Retirement Villages.
        /// Creates a query string using the parameters provided - parameters can be null if they are 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="sortOrder">Sort the returned record-set by a single specified sort order.</param>
        /// <param name="page">Page number.</param>
        /// <param name="rows">Number of rows per page.</param>
        /// <param name="region">Specifies the search region ID.</param>
        /// <param name="district">Specifies the search district ID.</param>
        /// <param name="suburb">Specifies the search suburb ID.</param>
        /// <param name="dateFrom">Specifies minimum start date for returned listings.</param>
        /// <param name="priceMin">Minimum property price.</param>
        /// <param name="priceMax">Maximum property price.</param>
        /// <param name="bathroomsMin">Minimum number of bathrooms..</param>
        /// <param name="bathroomsMax">Maximum number of bathrooms.</param>
        /// <param name="areaMin">	Minimum floor area in square meters.</param>
        /// <param name="areaMax">	Maximum square area in square meters.</param>
        /// <param name="landAreaMin">Minimum land area in square meters.</param>
        /// <param name="landAreaMax">Maximum land area in square meters.</param>
        /// <param name="propertyType">The property type.</param>
        /// <param name="bedroomsMin">Minimum number of bedrooms.</param>
        /// <param name="bedroomsMax">Maximum number of bedrooms.</param>
        /// <returns>RetirementVillages.</returns>
        public RetirementVillages SearchRetirementVillages(
            string searchString,
            PropertySortOrder sortOrder,
            int? page,
            int? rows,
            int? region,
            int? district,
            int? suburb,
            DateTime dateFrom,
            int? priceMin,
            int? priceMax,
            int? bathroomsMin,
            int? bathroomsMax,
            int? areaMin,
            int? areaMax,
            int? landAreaMin,
            int? landAreaMax,
            RetirementVillagePropertyType propertyType,
            int? bedroomsMin,
            int? bedroomsMax)
        {
            var url = String.Format(Constants.Culture, "{0}/{1}/Retirement{2}", Constants.SEARCH, Constants.PROPERTY, 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.SORT_ORDER, sortOrder.ToString(), _addAnd);
            conditions += SearchMethods.ConstructQueryHelper(Constants.PAGE, string.Empty + page, _addAnd);
            conditions += SearchMethods.ConstructQueryHelper(Constants.ROWS, string.Empty + rows, _addAnd);
            conditions += SearchMethods.ConstructQueryHelper(Constants.REGION, string.Empty + region, _addAnd);
            conditions += SearchMethods.ConstructQueryHelper(Constants.DISTRICT, string.Empty + district, _addAnd);
            conditions += SearchMethods.ConstructQueryHelper(Constants.SUBURB, string.Empty + suburb, _addAnd);
            conditions += SearchMethods.ConstructQueryHelper(Constants.DATE_FROM, Client.DateToStringConverter(dateFrom), _addAnd);
            conditions += SearchMethods.ConstructQueryHelper(Constants.PRICE_MIN, string.Empty + priceMin, _addAnd);
            conditions += SearchMethods.ConstructQueryHelper(Constants.PRICE_MAX, string.Empty + priceMax, _addAnd);
            conditions += SearchMethods.ConstructQueryHelper(Constants.BEDROOMS_MIN, string.Empty + bedroomsMin, _addAnd);
            conditions += SearchMethods.ConstructQueryHelper(Constants.BEDROOMS_MAX, string.Empty + bedroomsMax, _addAnd);
            conditions += SearchMethods.ConstructQueryHelper(Constants.BATHROOMS_MIN, string.Empty + bathroomsMin, _addAnd);
            conditions += SearchMethods.ConstructQueryHelper(Constants.BATHROOMS_MAX, string.Empty + bathroomsMax, _addAnd);
            conditions += SearchMethods.ConstructQueryHelper(Constants.AREA_MIN, string.Empty + areaMin, _addAnd);
            conditions += SearchMethods.ConstructQueryHelper(Constants.AREA_MAX, string.Empty + areaMax, _addAnd);
            conditions += SearchMethods.ConstructQueryHelper(Constants.LAND_AREA_MIN, string.Empty + landAreaMin, _addAnd);
            conditions += SearchMethods.ConstructQueryHelper(Constants.LAND_AREA_MAX, string.Empty + landAreaMax, _addAnd);
            conditions += SearchMethods.ConstructQueryHelper(Constants.PROPERTY_TYPE, propertyType.ToString(), _addAnd);

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

            // perform the request
            return this.SearchRetirementVillages(url);
        }
        /// <summary>
        /// <para>Performs the search method:
        /// Search Commercial Lease Property.
        /// Creates a query string using the parameters provided - parameters can be null if they are 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="sortOrder">Sort the returned record-set by a single specified sort order.</param>
        /// <param name="page">	Page number.</param>
        /// <param name="rows">Number of rows per page.</param>
        /// <param name="region">Specifies the search region ID.</param>
        /// <param name="district">Specifies the search district ID.</param>
        /// <param name="suburb">Specifies the search suburb ID.</param>
        /// <param name="dateFrom">Specifies minimum start date for returned listings.</param>
        /// <param name="priceMin">Minimum property price.</param>
        /// <param name="priceMax">Maximum property price.</param>
        /// <param name="areaMax">	Maximum floor area in square meters.</param>
        /// <param name="areaMin">Minimum floor area in square meters.</param>
        /// <param name="landAreaMin">Minimum land area in square meters.</param>
        /// <param name="landAreaMax">Maximum land area in square meters.</param>
        /// <param name="adjacentSuburbs">Indicates whether the search should include listings in adjacent suburbs.</param>
        /// <param name="usage">The usage of the property.</param>
        /// <returns>Properties.</returns>
        public global::Properties SearchCommercialLeaseProperties(
            string searchString,
            PropertySortOrder sortOrder,
            int? page,
            int? rows,
            int? region,
            int? district,
            int? suburb,
            DateTime dateFrom,
            int? priceMin,
            int? priceMax,
            int? areaMax,
            int? areaMin,
            int? landAreaMin,
            int? landAreaMax,
            bool? adjacentSuburbs,
            PropertyUsage usage)
        {
            var url = String.Format(Constants.Culture, "{0}{1}/{2}/CommercialLease{3}", _connection.BaseUrl, Constants.SEARCH, Constants.PROPERTY, Constants.XML);
            _addAnd = false;
            var conditions = "?";

            // create the parameters for the query string
            conditions += this.RuralPropertiesHelper(
                searchString,
                sortOrder.ToString(),
                page,
                rows,
                region,
                district,
                suburb,
                dateFrom,
                priceMin,
                priceMax,
                areaMax,
                areaMin,
                landAreaMin,
                landAreaMax,
                adjacentSuburbs,
                usage.ToString());

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

            // perform the request
            return this.PropertyConnectionHelper(url);
        }
        /// <summary>
        /// <para>Performs the Search Method:
        /// Search Residential Rental Property.
        /// Creates a query string using the parameters provided - parameters can be null if they are 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="sortOrder">Sort the returned record-set by a single specified sort order.</param>
        /// <param name="page">Page number.</param>
        /// <param name="rows">Number of rows per page.</param>
        /// <param name="region">Specifies the search region ID.</param>
        /// <param name="district">Specifies the search district ID.</param>
        /// <param name="suburb">Specifies the search suburb ID.</param>
        /// <param name="dateFrom">Specifies minimum start date for returned listings.</param>
        /// <param name="priceMin">Minimum property price.</param>
        /// <param name="priceMax">Maximum property price.</param>
        /// <param name="bathroomsMin">Minimum number of bathrooms.</param>
        /// <param name="bathroomsMax">Maximum number of bathrooms.</param>
        /// <param name="bedroomsMin">Minimum number of bedrooms.</param>
        /// <param name="bedroomsMax">Maximum number of bedrooms.</param>
        /// <param name="areaMax">Maximum square area in square meters.</param>
        /// <param name="areaMin">Minimum floor area in square meters.</param>
        /// <param name="landAreaMin">Minimum land area in square meters.</param>
        /// <param name="landAreaMax">Maximum land area in square meters.</param>
        /// <param name="propertyType">The type of the property.</param>
        /// <param name="adjacentSuburbs">Indicates whether the search should include listings in adjacent suburbs.</param>
        /// <returns>Properties.</returns>
        public global::Properties SearchResidentialRentalProperties(
            string searchString,
            PropertySortOrder sortOrder,
            int? page,
            int? rows,
            int? region,
            int? district,
            int? suburb,
            DateTime dateFrom,
            int? priceMin,
            int? priceMax,
            int? bathroomsMin,
            int? bathroomsMax,
            int? bedroomsMin,
            int? bedroomsMax,
            int? areaMax,
            int? areaMin,
            int? landAreaMin,
            int? landAreaMax,
            PropertyType propertyType,
            bool? adjacentSuburbs)
        {
            var url = String.Format(Constants.Culture, "{0}{1}/{2}/Rental{3}", _connection.BaseUrl, Constants.SEARCH, Constants.PROPERTY, Constants.XML);
            _addAnd = false;
            var conditions = "?";

            // create the parameters for the query string
            conditions += this.PropertyHelper(searchString, sortOrder.ToString(), page, rows, region, district, suburb, dateFrom, priceMin, priceMax, landAreaMin, landAreaMax);
            conditions += ResidentialPropertyHelper(bathroomsMin, bathroomsMax, bedroomsMax, bedroomsMin, areaMax, areaMin, propertyType.ToString(), adjacentSuburbs);

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

            // perform the request
            return this.PropertyConnectionHelper(url);
        }
        /// <summary>
        /// <para>Performs the Search Method:
        /// Search for Flatmate
        /// Creates a query string using the parameters provided - parameters can be null if they are 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="sortOrder">Sort the returned record-set by a single specified sort order.</param>
        /// <param name="page">Page number.</param>
        /// <param name="rows">Number of rows per page.</param>
        /// <param name="region">Specifies the search region ID.</param>
        /// <param name="district">Specifies the search district ID.</param>
        /// <param name="suburb">Specifies the search suburb ID.</param>
        /// <param name="dateFrom">Specifies minimum start date for returned listings.</param>
        /// <param name="priceMin">Minimum property price.</param>
        /// <param name="priceMax">Maximum property price.</param>
        /// <returns>Flatmates.</returns>
        public Flatmates SearchFlatmates(
            string searchString,
            PropertySortOrder sortOrder,
            int? page,
            int? rows,
            int? region,
            int? district,
            int? suburb,
            DateTime dateFrom,
            int? priceMin,
            int? priceMax)
        {
            var url = String.Format(Constants.Culture, "{0}/Flatmates{1}", Constants.SEARCH, 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.SORT_ORDER, sortOrder.ToString(), _addAnd);
            conditions += SearchMethods.ConstructQueryHelper(Constants.PAGE, string.Empty + page, _addAnd);
            conditions += SearchMethods.ConstructQueryHelper(Constants.ROWS, string.Empty + rows, _addAnd);
            conditions += SearchMethods.ConstructQueryHelper(Constants.REGION, string.Empty + region, _addAnd);
            conditions += SearchMethods.ConstructQueryHelper(Constants.DISTRICT, string.Empty + district, _addAnd);
            conditions += SearchMethods.ConstructQueryHelper(Constants.SUBURB, string.Empty + suburb, _addAnd);
            conditions += SearchMethods.ConstructQueryHelper(Constants.DATE_FROM, Client.DateToStringConverter(dateFrom), _addAnd);
            conditions += SearchMethods.ConstructQueryHelper(Constants.PRICE_MIN, string.Empty + priceMin, _addAnd);
            conditions += SearchMethods.ConstructQueryHelper(Constants.PRICE_MAX, string.Empty + priceMax, _addAnd);

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

            // perform the request
            return this.SearchFlatmates(url);
        }