public CitiesOfServiceControlViewModel()
 {
     RegisterCommands();
     CitiesOfService = new ObservableCollection<City>();
     City selectCity = new City() { Id = -1, Name = "-SELECT-" };
     CitiesOfService.Add(selectCity);
     SelectedCity = selectCity;
 }
Exemplo n.º 2
0
 static SettingViewModel()
 {
     ApplySettingDefault();
     DummyCity = new City() { Id = -1, Name = "-select-" };
     DummyAssociation = new Association() { Id = -1, Name = "-ALL ASSOCIATIONS-" };
     DummyCountry = new Country() { Id = -1, Name = "-ALL COUNTRIES-", HasStates = true, DisplayStates = true };
     DummyState = new State() { Id = -1, Name = "-select-" };
 }
Exemplo n.º 3
0
     private void FixupCity(City previousValue)
     {
         if (IsDeserializing)
         {
             return;
         }
 
         if (City != null)
         {
             CityId = City.Id;
         }
 
         if (ChangeTracker.ChangeTrackingEnabled)
         {
             if (ChangeTracker.OriginalValues.ContainsKey("City")
                 && (ChangeTracker.OriginalValues["City"] == City))
             {
                 ChangeTracker.OriginalValues.Remove("City");
             }
             else
             {
                 ChangeTracker.RecordOriginalValue("City", previousValue);
             }
             if (City != null && !City.ChangeTracker.ChangeTrackingEnabled)
             {
                 City.StartTracking();
             }
         }
     }
Exemplo n.º 4
0
     public bool Equals(City other)
     {
         if (ReferenceEquals(null, other)) return false;
         if (ReferenceEquals(this, other)) return true;
 		if (other.Id == 0 && Id == 0)
 			return false;
 		else
 			return other.Id == Id;
     }
Exemplo n.º 5
0
 private bool IsValidCity(City city)
 {
     bool isValid = false;
     if (city != null && city.Id > 0)
     {
         isValid = true;
     }
     return isValid;
 }
Exemplo n.º 6
0
 /// <summary>
 /// Get the Cities of Service for the Country and State
 /// </summary>
 private void GetCitiesOfService()
 {
     if (SelectedCountry == null || SelectedCountry.Id < 1 ) return;
     //StateId 0 means search all the cities for the selected country, to filter based on state also pass SelectedState.Id instead of 0
     DataService.BeginGetCities(SelectedCountry.Id, 0, CreateAsyncCallback(ar => DataService.EndGetCities(ar),
         result =>
         {
             ObservableCollection<City> cites = result;
             City selectCity = new City() { Id = -1, Name = "-SELECT-" };
             if (cites == null) cites = new ObservableCollection<City>();
             cites.Insert(0, selectCity);
             CitiesViewModels[0].CitiesOfService = new ObservableCollection<City>(cites);
             CitiesViewModels[1].CitiesOfService =  new ObservableCollection<City>(cites);
             CitiesViewModels[2].CitiesOfService =  new ObservableCollection<City>(cites);
         }), null);
 }