public static void delete(tbl_KitchenInventoryCategory kic) { RMSDBEntities db = DBContext.getInstance(); db.tbl_KitchenInventoryCategory.Remove(kic); db.SaveChanges(); }
public static void insert(tbl_KitchenInventoryCategory kic) { RMSDBEntities db = DBContext.getInstance(); db.tbl_KitchenInventoryCategory.Add(kic); db.SaveChanges(); }
public static void update(tbl_KitchenInventoryCategory kic) { RMSDBEntities db = DBContext.getInstance(); db.Entry(kic).State = EntityState.Modified; db.Configuration.ValidateOnSaveEnabled = false; db.SaveChanges(); db.Configuration.ValidateOnSaveEnabled = true; }
private void btn_AddNewCaterory(object sender, RoutedEventArgs e) { if (tb_Name.Text != "") { tbl_KitchenInventoryCategory kic = new tbl_KitchenInventoryCategory(); kic.Name = tb_Name.Text; KitchenInventoryCategory.insert(kic); AutoClosingMessageBox.Show("Category Added", "Success", 3000); tb_Name.Text = ""; initFormOperations(); } else { AutoClosingMessageBox.Show("Please Enter Category Name", "Alert", 3000); } }
private void btn_UpdateCaterory(object sender, RoutedEventArgs e) { if (dg_AllCategories.SelectedItem != null) { tbl_KitchenInventoryCategory category = (tbl_KitchenInventoryCategory)dg_AllCategories.SelectedItem; var dialog = new Form_InputDialog(category.Name); if (dialog.ShowDialog() == true) { category.Name = dialog.ResponseText; KitchenInventoryCategory.update(category); AutoClosingMessageBox.Show("Category Updated", "Success", 3000); initFormOperations(); } } else { AutoClosingMessageBox.Show("Please Select a Item", "Alert", 3000); } }