private void editWhseBtn_Click(object sender, RoutedEventArgs e) { if (CentersListBox.SelectedItem is AmzWarehouseModel) { //grab selected item. AmzWarehouseModel amzSelected = (AmzWarehouseModel)CentersListBox.SelectedItem; //instantiate new AmazonWarehouseWin and pass in selected AmzWarehouseModel AmazonWarehouseWin amzWin = new AmazonWarehouseWin(amzSelected, Utilities.DbQuery.Edit); amzWin.titleLabel.Content = "Edit Amazon Fulfillment Warehouse"; //show the window. amzWin.ShowDialog(); if (amzWin.DialogResult == true) //warehouse edit is successful { //save updated warehouse to database. MessageBox.Show("Amazon Fulfillment Warehouse successfully saved."); PopulateGUI(); } else //warehouse edit is unsuccessful { //inform user nothing was done. MessageBox.Show("Unable to save the Amazon Fulfillment Warehouse."); } } }
private void btn_AddWhse_Click(object sender, RoutedEventArgs e) { //open new window to add an Amazon Warehouse AmzWarehouseModel amzwhse = new AmzWarehouseModel(); AmazonWarehouseWin amzWindow = new AmazonWarehouseWin(amzwhse, DbQuery.Add); amzWindow.ShowDialog(); if (amzWindow.DialogResult == true) { MessageBox.Show("New Amazon warehouse successfully added to DB!"); RefreshGUI(); } else { MessageBox.Show("Unable to save Amazon warehouse to DB."); } }
/// <summary> /// Event when the 'Add' button is clicked on the view. ds to the warehouse. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void addWhseBtn_Click(object sender, RoutedEventArgs e) { //open new window to add an Amazon Warehouse AmzWarehouseModel amzwhse = new AmzWarehouseModel(); AmazonWarehouseWin amzWindow = new AmazonWarehouseWin(amzwhse, DbQuery.Add); amzWindow.titleLabel.Content = "Add An Amazon Warehouse"; amzWindow.ShowDialog(); if (amzWindow.DialogResult == true) { MessageBox.Show("The new Amazon Fulfillment Warehouse was successfully added to the Database! :D"); //refresh UI PopulateGUI(); } else { MessageBox.Show("Unable to save the new Amazon Warehouse"); } }