Пример #1
0
        public IngredientCategoryList(int idItem)
        {
            InitializeComponent();
            IdItem = idItem;
            ManagementModel mg = new ManagementModel();

            lv_ingredientCategoryList.ItemsSource = mg.GetAllIngredientCat();
        }
Пример #2
0
 private void ManagementLoaded(object sender, RoutedEventArgs e)
 {
     try
     {
         mg = new ManagementModel();
         lv_itemsCategory.ItemsSource      = mg.GetAllCategory();
         lv_menu.ItemsSource               = mg.GetAllMenu();
         lv_menuOption.ItemsSource         = mg.GetMenuOptions();
         lv_ingredientCategory.ItemsSource = mg.GetAllIngredientCat();
     }
     catch (Exception ex)
     {
     }
 }
Пример #3
0
 private void OnClickDeleteIngCat(object sender, RoutedEventArgs e)
 {
     try
     {
         var item = (ItemsCategoryModel)((ListViewItem)lv_ingredientCategory.ContainerFromElement((Button)sender)).Content;
         var it   = db.CATEGORY_INGREDIENT.Where(i => i.id_category_ingredient == item.Id).Single();
         db.CATEGORY_INGREDIENT.Remove(it);
         db.SaveChanges();
         mg = new ManagementModel();
         lv_ingredientCategory.ItemsSource = mg.GetAllIngredientCat();
         DialogHost.Show(new Message()
         {
             message_tb = { Text = "Catégorie supprimée avec succès" }
         }, "RootDialog");
     }
     catch (Exception ex)
     {
         DialogHost.Show(new Message()
         {
             message_tb = { Text = "Impossible de supprimer la catégorie " + ex.Message }
         }, "RootDialog");
     }
 }
Пример #4
0
 private void OnCloseAddIngCat(object sender, DialogClosingEventArgs eventArgs)
 {
     lv_ingredientCategory.ItemsSource = mg.GetAllIngredientCat();
 }