/// <summary> /// Saves all the changes made and places information into the database. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSave_Click(object sender, RoutedEventArgs e) { try { // Executes the add/edit function. switch (selectedFunction) { case "Add": sSQL = mydb.AddInventoryItem(txtItemDesc.Text, txtItemCost.Text); db.ExecuteNonQuery(sSQL); break; case "Edit": sSQL = mydb.EditInventoryItem(itemCode, txtItemDesc.Text, txtItemCost.Text); db.ExecuteNonQuery(sSQL); break; default: break; } clear(); txtItemDesc.IsReadOnly = true; txtItemCost.IsReadOnly = true; btnAddItem.IsEnabled = true; btnEditItem.IsEnabled = true; btnDeleteItem.IsEnabled = true; DescriptionCostCanvas.Visibility = Visibility.Hidden; inventoryDictionary = new Dictionary<string, string>(); populateDatagridInv(); } catch (Exception) { MessageBox.Show(MethodInfo.GetCurrentMethod().DeclaringType.Name); } }