Beispiel #1
0
        /// <summary>
        /// Возвращает строку запроса типа ?min_lat=55.30077916694387&min_lng=36.974153699712836&max_lat=56.200586833056136&max_lng=38.26083830028717
        /// </summary>
        /// <returns></returns>
        public string ToUrlQuery()
        {
            var list = new List <string>(15);

            if (!string.IsNullOrWhiteSpace(Id))
            {
                list.Add($"id={Id}");
            }
            if (WeightGramms > 0)
            {
                list.Add($"weight={WeightGramms.ToString()}");
            }
            if (OrderPrice > 0)
            {
                list.Add($"order_price={OrderPrice.ToString()}");
            }
            if (!string.IsNullOrWhiteSpace(City))
            {
                list.Add($"city={City}");
            }
            if (!string.IsNullOrWhiteSpace(Region))
            {
                list.Add($"region={Region}");
            }
            if (!string.IsNullOrWhiteSpace(CountryCode))
            {
                list.Add($"country={CountryCode}");
            }
            if (!string.IsNullOrWhiteSpace(Type))
            {
                list.Add($"type={Type}");
            }
            if (!string.IsNullOrWhiteSpace(Partner))
            {
                list.Add($"partner={Partner}");
            }
            if (MinLng.HasValue && MaxLng.HasValue && MinLat.HasValue && MaxLat.HasValue)
            {
                list.Add($"min_lng={MinLng.ToString().Replace(",", ".")}");
                list.Add($"max_lng={MaxLng.ToString().Replace(",", ".")}");
                list.Add($"min_lat={MinLat.ToString().Replace(",", ".")}");
                list.Add($"max_lat={MaxLat.ToString().Replace(",", ".")}");
            }
            if (RegionCities.HasValue)
            {
                list.Add($"region_cities={(RegionCities.Value ? "Y" : "N")}");
            }
            if (!string.IsNullOrWhiteSpace(InSales))
            {
                list.Add($"insales={InSales}");
            }
            return("?" + string.Join("&", list));
        }
Beispiel #2
0
 public override int GetHashCode()
 {
     return(MinLat.GetHashCode() ^ MinLng.GetHashCode() ^ MaxLat.GetHashCode() ^ MaxLng.GetHashCode());
 }