Esempio n. 1
0
        public CategoriesViewModel()
        {
            EsaDbContext db = new EsaDbContext();

            foreach (var e in db.CategoriesList)
            {
                CategoriesCollection.Add(new CategorieModel(e));
            }
        }
Esempio n. 2
0
        public DishIngredientViewModel()
        {
            EsaDbContext db = new EsaDbContext();

            foreach (var e in db.DishIngredientList)
            {
                DishIngredientModelCollection.Add(new DishIngredientModel(e));
            }
        }
Esempio n. 3
0
        public MenuCategorieViewModel()
        {
            EsaDbContext db = new EsaDbContext();

            foreach (var e in db.MenuCategorieList)
            {
                MenuCategorieCollection.Add(e);
            }
        }
Esempio n. 4
0
        public StoreViewModel()
        {
            EsaDbContext db = new EsaDbContext();

            foreach (var e in db.StoreList)
            {
                StoreModelCollection.Add(new StoreModel(e));
            }
        }
Esempio n. 5
0
 public MenuMModel(MenuModel Menu)
 {
     Id             = Menu.Id;
     Name           = Menu.Name;
     Datum          = Menu.Datum;
     MenuCategoryId = Menu.MenuCategoryId;
     MenuCategory   = new EsaDbContext().MenuCategorieList.Where(i => i.Id == MenuCategoryId).Single().Name;
     DatumStr       = Datum.ToString("dd.MM.yyyy");
 }
Esempio n. 6
0
        public IngredientViewModel()
        {
            EsaDbContext db = new EsaDbContext();

            foreach (var e in db.IngredientList)
            {
                IngredientCollection.Add(e);
            }
        }
Esempio n. 7
0
        public MenuViewModel()
        {
            EsaDbContext db = new EsaDbContext();

            foreach (var e in db.MenuList)
            {
                MenuMModelCollection.Add(new MenuMModel(e));
            }
        }
Esempio n. 8
0
 public DishIngredientModel(DishIngredient DI)
 {
     Id            = DI.Id;
     IngredientsId = DI.IngredientsId;
     DishId        = DI.DishId;
     Quantity      = DI.Quantity;
     Ingredients   = new EsaDbContext().IngredientList.Where(i => i.Id == IngredientsId).Single().Name;
     Dish          = new EsaDbContext().DishList.Where(i => i.Id == DishId).Single().Name;
 }
Esempio n. 9
0
        public static void Update()
        {
            DishIngredientModelCollection.Clear();
            EsaDbContext db = new EsaDbContext();

            foreach (var e in db.DishIngredientList)
            {
                DishIngredientModelCollection.Add(new DishIngredientModel(e));
            }
        }
Esempio n. 10
0
        public static void Update()
        {
            MenuMModelCollection.Clear();
            EsaDbContext db = new EsaDbContext();

            foreach (var e in db.MenuList)
            {
                MenuMModelCollection.Add(new MenuMModel(e));
            }
        }
Esempio n. 11
0
        public static void Update()
        {
            MenuCategorieCollection.Clear();
            EsaDbContext db = new EsaDbContext();

            foreach (var e in db.MenuCategorieList)
            {
                MenuCategorieCollection.Add(e);
            }
        }
Esempio n. 12
0
        public static void Update()
        {
            IngredientCollection.Clear();
            EsaDbContext db = new EsaDbContext();

            foreach (var e in db.IngredientList)
            {
                IngredientCollection.Add(e);
            }
        }
Esempio n. 13
0
        public static void Update()
        {
            CategoriesCollection.Clear();
            EsaDbContext db = new EsaDbContext();

            foreach (var e in db.CategoriesList)
            {
                CategoriesCollection.Add(new CategorieModel(e));
            }
        }
Esempio n. 14
0
 public MenuDishModel(MenuDish menuDish)
 {
     Id          = menuDish.Id;
     MenuId      = menuDish.MenuId;
     DishId      = menuDish.DishId;
     CategorieId = menuDish.CategorieId;
     MenuDish    = menuDish;
     Menu        = new EsaDbContext().MenuList.Where(i => i.Id == MenuId).Single().Name;
     Dish        = new EsaDbContext().DishList.Where(i => i.Id == DishId).Single().Name;
     Categorie   = new EsaDbContext().CategoriesList.Where(i => i.Id == CategorieId).Single().Categorie;
 }
Esempio n. 15
0
        public void MenuCategorieDelete(MenuCatigorie delMC)
        {
            EsaDbContext db = new EsaDbContext();

            foreach (var e in db.MenuList)
            {
                if (e.MenuCategoryId == delMC.Id)
                {
                    MenuDelete(e);
                }
            }
            db.MenuCategoriesDelete(delMC);
        }
Esempio n. 16
0
        public DishViewModel()
        {
            EsaDbContext db = new EsaDbContext();

            foreach (var e in db.CategoriesList)
            {
                CategoriesCollection.Add(e);
            }
            foreach (var e in db.DishList)
            {
                DishModelCollection.Add(new DishModel(e));
            }
        }
Esempio n. 17
0
        public void MenuDelete(MenuModel delMenu)
        {
            EsaDbContext db = new EsaDbContext();

            foreach (var e in db.MenuDishList)
            {
                if (e.MenuId == delMenu.Id)
                {
                    MenuDishDelete(e);
                }
            }
            db.MenuDelete(delMenu);
        }
Esempio n. 18
0
 public async void SaveJson()
 {
     EsaDbContext db = new EsaDbContext();
     await Task.Run(() =>
     {
         while (true)
         {
             using (StreamWriter file = new StreamWriter(@"C:\Users\Public\Documents\menu\Categories.json"))
             {
                 var json = JsonConvert.SerializeObject(db.CategoriesList);
                 file.Write(json);
             }
             using (StreamWriter file = new StreamWriter(@"C:\Users\Public\Documents\menu\DishIngredient.json"))
             {
                 var json = JsonConvert.SerializeObject(db.DishIngredientList);
                 file.Write(json);
             }
             using (StreamWriter file = new StreamWriter(@"C:\Users\Public\Documents\menu\Dish.json"))
             {
                 var json = JsonConvert.SerializeObject(db.DishList);
                 file.Write(json);
             }
             using (StreamWriter file = new StreamWriter(@"C:\Users\Public\Documents\menu\Ingredient.json"))
             {
                 var json = JsonConvert.SerializeObject(db.IngredientList);
                 file.Write(json);
             }
             using (StreamWriter file = new StreamWriter(@"C:\Users\Public\Documents\menu\MenuCategorie.json"))
             {
                 var json = JsonConvert.SerializeObject(db.MenuCategorieList);
                 file.Write(json);
             }
             using (StreamWriter file = new StreamWriter(@"C:\Users\Public\Documents\menu\MenuDish.json"))
             {
                 var json = JsonConvert.SerializeObject(db.MenuDishList);
                 file.Write(json);
             }
             using (StreamWriter file = new StreamWriter(@"C:\Users\Public\Documents\menu\Menu.json"))
             {
                 var json = JsonConvert.SerializeObject(db.MenuList);
                 file.Write(json);
             }
             using (StreamWriter file = new StreamWriter(@"C:\Users\Public\Documents\menu\Store.json"))
             {
                 var json = JsonConvert.SerializeObject(db.StoreList);
                 file.Write(json);
             }
             Task.Delay(2000);
         }
     });
 }
Esempio n. 19
0
        public CategorieModel(Categories cat)
        {
            Id        = cat.Id.ToString();
            Categorie = cat.Categorie;
            EsaDbContext db = new EsaDbContext();
            var          rn = db.DishList.Where(i => i.CatigorieId == cat.Id);

            if (!db.DishList.Any(i => i.CatigorieId == cat.Id) &&
                !db.MenuDishList.Any(i => i.CategorieId == cat.Id))
            {
                Activity = true;
            }
            else
            {
                Activity = false;
            }
        }
Esempio n. 20
0
        public void CategoriesDelete(Categories delCat)
        {
            EsaDbContext db = new EsaDbContext();

            foreach (var e in db.DishList)
            {
                if (e.CatigorieId == delCat.Id)
                {
                    DishDelete(e);
                }
            }
            foreach (var e in db.MenuDishList)
            {
                if (e.CategorieId == delCat.Id)
                {
                    MenuDishDelete(e);
                }
            }
            db.CategoriesDelete(delCat);
        }
Esempio n. 21
0
        public void DishDelete(Dish delDish)
        {
            EsaDbContext db = new EsaDbContext();

            foreach (var e in db.DishIngredientList)
            {
                if (e.DishId == delDish.Id)
                {
                    DishIngredientDelete(e);
                }
            }
            foreach (var e in db.MenuDishList)
            {
                if (e.CategorieId == delDish.Id)
                {
                    MenuDishDelete(e);
                }
            }
            db.DishDelete(delDish);
        }
Esempio n. 22
0
        public void IngredientDelete(Ingredient delI)
        {
            EsaDbContext db = new EsaDbContext();

            foreach (var e in db.DishIngredientList)
            {
                if (e.IngredientsId == delI.Id)
                {
                    DishIngredientDelete(e);
                }
            }
            foreach (var e in db.StoreList)
            {
                if (e.IngredientsId == delI.Id)
                {
                    StoreDelete(e);
                }
            }
            db.IngredientDelete(delI);
        }
Esempio n. 23
0
        public void MenuDishDelete(MenuDish delMD) //?
        {
            EsaDbContext db = new EsaDbContext();

            db.MenuDishDelete(delMD);
        }
Esempio n. 24
0
        public void DishIngredientDelete(DishIngredient delDI)
        {
            EsaDbContext db = new EsaDbContext();

            db.DishIngredientDelete(delDI);
        }
Esempio n. 25
0
        public void StoreDelete(Store delStore)
        {
            EsaDbContext db = new EsaDbContext();

            db.StoreDelete(delStore);
        }