| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- using System;
-
- namespace cwebplusApp.Shared.Models {
- public class BicycleGeoPosition {
-
- private string displayCity;
-
- public double Latitude { get; set; }
- public double Longitude { get; set; }
- public string Address { get; set; }
- public string City { get; set; }
- public string Zip { get; set; }
- public string DisplayCity {
- get { return displayCity; }
- set {
- displayCity = value;
- decodeDisplayCity(value);
- }
- }
-
- public BicycleGeoPosition() {
- Latitude = 0.0;
- Longitude = 0.0;
- Address = "";
- Zip = "";
- City = "";
- DisplayCity = "";
- }
-
- private void decodeDisplayCity(string displayCity) {
- if (!String.IsNullOrEmpty(displayCity)) {
- displayCity = displayCity.Trim();
- char[] delimiterChars = { '-', ' ' };
- string[] tokens = displayCity.Split(delimiterChars);
- if (tokens.Length == 3) {
- Zip = tokens[1];
- City = tokens[2];
- } else if (tokens.Length == 2) {
- Zip = tokens[0];
- City = tokens[1];
- } else {
- Zip = null;
- City = null;
- }
- }
- }
- }
- }
|