/// <summary> /// Edits the currently selected company address. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void editShipFrBtn_Click(object sender, RoutedEventArgs e) { if (comboCompanyAddress.SelectedItem is CompanyAddressModel) { //grab selected item. CompanyAddressModel companyAddress = (CompanyAddressModel)comboCompanyAddress.SelectedItem; //instantiate new CompanyAddressWin.xaml and pass in selected comp address CompanyAddressWin compWindow = new CompanyAddressWin(companyAddress, Utilities.DbQuery.Edit); compWindow.titleLabel.Content = "Edit Company Ship From"; //show the window. compWindow.ShowDialog(); if (compWindow.DialogResult == true) //warehouse edit is successful { //save updated warehouse to database. MessageBox.Show("Company Address successfully saved."); PopulateGUI(); } else //warehouse edit is unsuccessful { //inform user nothing was done. MessageBox.Show("Unable to save the Company Address."); } } }
/// <summary> /// Opens a new window that allows the user to add a new ShipFrom Company Address to the databse. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void newShipFrbtn_Click(object sender, RoutedEventArgs e) { //open a new window for adding a new Company Ship From. CompanyAddressModel comp = new CompanyAddressModel(); CompanyAddressWin compWindow = new CompanyAddressWin(comp, Utilities.DbQuery.Add); compWindow.titleLabel.Content = "Add New Company Ship From"; compWindow.ShowDialog(); if (compWindow.DialogResult == true) { //save updated warehouse to database. MessageBox.Show("Company Address successfully saved."); PopulateGUI(); } else { //inform user nothing was done. MessageBox.Show("Unable to save the Company Address."); } }