private void btn_Update(object sender, RoutedEventArgs e) { if (tb_Name.Text == "" || tb_Quantity.Text == "" || tb_MinimumQuantity.Text == "" || tb_PurchasePrice.Text == "") { AutoClosingMessageBox.Show("Please Enter Correct Values", "Alert", 3000); return; } try { ki.Name = tb_Name.Text; ki.Quantity = Convert.ToDouble(tb_Quantity.Text); ki.MinimumQuantity = Convert.ToDouble(tb_MinimumQuantity.Text); ki.PurchasePrice = Convert.ToDouble(tb_PurchasePrice.Text); ki.ExpiryDate = dp_ExpiryDate.SelectedDate; ki.KitchenInventoryCategory_Id = catId; KitchenInventory.update(ki); AutoClosingMessageBox.Show("Item Updated", "Success", 3000); Close(); new Form_ManageKitchenInventory().Show(); } catch { AutoClosingMessageBox.Show("Some Error Occured", "Alert", 3000); return; } }
private void tb_Price_KeyDown_PressEnter(object sender, KeyEventArgs e) { if (dg_AllKitchenItems.SelectedItem != null) { if (e.Key == Key.Enter) { tbl_KitchenInventory ki = (tbl_KitchenInventory)dg_AllKitchenItems.SelectedItem; ki.PurchasePrice = Convert.ToDouble(tb_Price.Text); KitchenInventory.update(ki); initFormOperations(); } } }