private void UpdateCommandHandler(object sender, ExecutedRoutedEventArgs e) { if (newCountryGrid.IsVisible) { newCountry = new Model.Country(); Model.Country nCountry = myCountriesViewSource.View.CurrentItem as Model.Country; if (nCountry != null) { newCountry.CountryName = nCountry?.CountryName; if (!string.IsNullOrWhiteSpace(newCountry?.CountryName)) { myCountriesViewSource.View.Refresh(); myCountriesViewSource.View.MoveCurrentTo(newCountry); context.SaveChanges(); Messenger.Default.Send <string>(Utils.LanguageAddedMessage); } else { MessageBox.Show("Country Is Empty."); } } newCountryGrid.Visibility = Visibility.Collapsed; existingCountryGrid.Visibility = Visibility.Visible; } }
//does an action of the country tab private void doCountry() { Model.Country mCountry = new Model.Country(); Controller.Country cCountry = new Controller.Country(); if (cmbCountryAction.SelectedIndex == 0) { MessageBox.Show("Please, choose an action!"); } else if (cmbCountryAction.SelectedIndex == 1) //select { refreshCountry(); } else if (cmbCountryAction.SelectedIndex == 2) //delete { mCountry.Id = Convert.ToInt32(cmbCountries.SelectedValue.ToString()); cCountry = new Controller.Country(mCountry); cCountry.delete(); refreshCountry(); } else if (cmbCountryAction.SelectedIndex == 3) { cmbCountries.Enabled = true; gbNewCountry.Visible = true; txtCountryId.Text = cmbCountries.SelectedValue.ToString(); gbNewCountry.Visible = true; } else if (cmbCountryAction.SelectedIndex == 4) { cmbCountries.Enabled = false; gbNewCountry.Visible = true; txtCountryId.Text = "0"; gbNewCountry.Visible = true; } }
private void SetNextState() { this.state = this.state != ResultsState.TwelvePoints ? this.state + 1 : ResultsState.RevealCountry; if (this.state == ResultsState.SplashScreen) { Messenger.Default.Send(new ReadyForLateVotesMessage()); } if (this.state == ResultsState.RevealCountry) { if (Countries.Count(c => c.IsInQueue) > 0) { this.currentlyRevealedCountry = GetSelectedCountry(); } else { this.state = ResultsState.RevealWinner; } } if (this.state == ResultsState.TwelvePoints) { if (this.currentlyRevealedCountry != null) { this.currentlyRevealedCountry.IsSelected = false; this.currentlyRevealedCountry.IsInQueue = false; if (Countries.Count(c => c.IsInQueue) > 0) { if (Countries.Count(c => c.IsInQueue && c.IsSelected) == 0) { Countries.First(c => c.IsInQueue).IsSelected = true; } } } } var selectedCountryId = Countries.FirstOrDefault(c => c.IsSelected)?.Id; Model.Country nextCountry = null; if (selectedCountryId.HasValue) { nextCountry = dataService.GetCountry(selectedCountryId.Value); } Messenger.Default.Send(new ChangeStateMessage(this.state, nextCountry)); NextCommand.RaiseCanExecuteChanged(); }
//saves a country private void saveCountry() { try { Model.Country mCountry = new Model.Country(); Controller.Country cCountry = new Controller.Country(); mCountry.Id = Convert.ToInt32(txtCountryId.Text.ToString()); mCountry.Name = txtCountryName.Text; mCountry.Flag = this.flag; cCountry = new Controller.Country(mCountry); cCountry.insert(); refreshCountry(); } catch { MessageBox.Show("Please, try again!"); } }
public VendorIndexViewItem(Model.Vendor vendor, Model.Country country) : base(vendor) { ObjectId = vendor.ObjectId; CountryName = country.CountryName; }
public CustomerIndexViewItem(Model.Customer customer, Model.Country country) : base(customer) { CountryName = country.CountryName; }
public void EditCountry(Model.Country country) { throw new NotImplementedException(); }
public void AddVendor(Model.Country country) { throw new NotImplementedException(); }
public Country() { this.country = new Model.Country(); }
public Country(Model.Country country) { this.country = country; }
public VendorDetailsViewItem(Model.Vendor vendor, Model.Country country) : base(vendor) { CountryName = country.CountryName; }
protected override void Seed(DataLayer_2.ContextFolder.TableContext context) { // This method will be called after migrating to the latest version. // You can use the DbSet<T>.AddOrUpdate() helper extension method // to avoid creating duplicate seed data. E.g. // // context.People.AddOrUpdate( // p => p.FullName, // new Person { FullName = "Andrew Peters" }, // new Person { FullName = "Brice Lambson" }, // new Person { FullName = "Rowan Miller" } // ); // context.countries.AddOrUpdate( new Model.Country { CountryName = "South Africa" }); Model.Country c = new Model.Country(); c.CountryName = "South Africa"; c.CountryID = 1; context.provincies.AddOrUpdate( new Model.Province { ProvinceName = "Gauteng", country = c }, new Model.Province { ProvinceName = "Eastern Cape", country = c }, new Model.Province { ProvinceName = "Free State", country = c }, new Model.Province { ProvinceName = "KwaZulu-Natal", country = c }, new Model.Province { ProvinceName = "Limpopo", country = c }, new Model.Province { ProvinceName = "Mpumalanga", country = c }, new Model.Province { ProvinceName = "Northern Cape", country = c }, new Model.Province { ProvinceName = "North West", country = c }); Model.Town t1 = new Model.Town { TownName = "Joburg", ProvinceID = 1 }; context.towns.AddOrUpdate(t1); context.surbubs.AddOrUpdate( new Model.Surbub { SuburbName = "Hyde Park", town = t1 } ); context.Genders.AddOrUpdate( new Model.Gender { GenderDescription = "Male" }, new Model.Gender { GenderDescription = "Female" }); context.addresstypes.AddOrUpdate( new Model.AddressType { AddressTypeDecs = "Postal Code" }, new Model.AddressType { AddressTypeDecs = "Physical" }); context.statuses.AddOrUpdate( new Model.Status { StatusDesc = "Active" }, new Model.Status { StatusDesc = "UnActive" }); context.Usertypes.AddOrUpdate( new Model.UserType { UserDescribtion = "ADMIN" }, new Model.UserType { UserDescribtion = "User" }); context.departments.AddOrUpdate( new Model.Department { DepartmentName = "GMIC", DepartmentDescrption = "Gauteng Microsoft," }, new Model.Department { DepartmentName = "GMOB", DepartmentDescrption = "Gauteng Mobility" }); }