예제 #1
0
        public static void delete(tbl_FoodItemCategory categroy)
        {
            RMSDBEntities db = DBContext.getInstance();

            db.tbl_FoodItemCategory.Remove(categroy);
            db.SaveChanges();
        }
예제 #2
0
 private void dg_AllFoodItemCategory_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (dg_AllFoodItemCategory.SelectedItem != null)
     {
         tbl_FoodItemCategory r = (tbl_FoodItemCategory)dg_AllFoodItemCategory.SelectedItem;
     }
 }
예제 #3
0
        public static void insert(tbl_FoodItemCategory category)
        {
            RMSDBEntities db = DBContext.getInstance();

            db.tbl_FoodItemCategory.Add(category);
            db.SaveChanges();
        }
예제 #4
0
        public static void update(tbl_FoodItemCategory category)
        {
            RMSDBEntities db = DBContext.getInstance();

            db.Entry(category).State = EntityState.Modified;
            db.Configuration.ValidateOnSaveEnabled = false;
            db.SaveChanges();
            db.Configuration.ValidateOnSaveEnabled = true;
        }
예제 #5
0
 private void btn_RemoveFoodItemCategory(object sender, RoutedEventArgs e)
 {
     if (dg_AllFoodItemCategory.SelectedItem != null)
     {
         tbl_FoodItemCategory f = (tbl_FoodItemCategory)dg_AllFoodItemCategory.SelectedItem;
         FoodItemCategory.delete(f);
         initFormOperations();
     }
     else
     {
         AutoClosingMessageBox.Show("Please Select a Item", "Alert", 3000);
     }
 }
예제 #6
0
 private void btn_AddNewFoodItemCategory(object sender, RoutedEventArgs e)
 {
     if (tb_FoodItemCategory.Text != "")
     {
         tbl_FoodItemCategory category = new tbl_FoodItemCategory();
         category.Name = tb_FoodItemCategory.Text;
         FoodItemCategory.insert(category);
         AutoClosingMessageBox.Show("New Category Added", "Success", 3000);
         tb_FoodItemCategory.Text = "";
         initFormOperations();
     }
     else
     {
         AutoClosingMessageBox.Show("Please Enter A Name", "Alert", 3000);
     }
 }
예제 #7
0
 private void btn_UpdateFoodItemCategory(object sender, RoutedEventArgs e)
 {
     if (dg_AllFoodItemCategory.SelectedItem != null)
     {
         tbl_FoodItemCategory category = (tbl_FoodItemCategory)dg_AllFoodItemCategory.SelectedItem;
         var dialog = new Form_InputDialog(category.Name);
         if (dialog.ShowDialog() == true)
         {
             category.Name = dialog.ResponseText;
             FoodItemCategory.update(category);
             AutoClosingMessageBox.Show("Category Updated", "Success", 3000);
             initFormOperations();
         }
     }
     else
     {
         AutoClosingMessageBox.Show("Please Select a Item", "Alert", 3000);
     }
 }