public DeleteFoodPage(string language) : this()
        {
            this.MainLanguage = language;

            Types = MainFunctions.GetFoodTypes(MainLanguage);
            FoodTypeBox.ItemsSource = Types.ToArray();

            Languages = MainFunctions.GetLanguages();
            FoodLanguageBox.ItemsSource = Languages.ToArray();

            ShopContext shopContext = new ShopContext();

            Foods = shopContext.Food
                    .Join(shopContext.FoodDictionary, f => f.FoodID, t => t.FoodID,
                          (f, t) => new { FoodId = f.FoodID, FoodName = t.Name, LanguageId = t.LanguageID })
                    .Join(shopContext.Language, f => f.LanguageId, l => l.LanguageID,
                          (f, l) => new { FoodId = f.FoodId, FoodName = f.FoodName, Language = l.Name })
                    .Where(l => l.Language == MainLanguage)
                    .Select(ft => new FoodPropertie
            {
                FoodName = ft.FoodName,
                FoodId   = ft.FoodId
            }).ToList();
            FoodList.ItemsSource = Foods.ToArray();
        }
Exemple #2
0
        private void LanguageChange(object sender, SelectionChangedEventArgs e)
        {
            string      lang        = (sender as ComboBox).SelectedItem.ToString();
            ShopContext shopContext = new ShopContext();

            Types = MainFunctions.GetFoodTypes(lang);
            FoodType.ItemsSource = Types.ToArray();
        }
        private void LanguageChange(object sender, SelectionChangedEventArgs e)
        {
            string language = (sender as ComboBox).SelectedItem.ToString();

            Types = MainFunctions.GetFoodTypes(language);
            FoodTypeBox.ItemsSource = Types.ToArray();
            FoodTypeBox.Text        = "Type";
            RefreshList(language);
        }
        public EditShopStorePage(string language, int shopId) : this()
        {
            this.MainLanguage = language;
            this.ShopId       = shopId;

            Languages = MainFunctions.GetLanguages();
            LanguageBox.ItemsSource = Languages.ToArray();

            Types = MainFunctions.GetFoodTypes(MainLanguage);
            TypeBox.ItemsSource = Types.ToArray();
            RefreshList(MainLanguage);
        }
        public EditFoodPage(string language) : this()
        {
            this.MainLanguage = language;

            ShopContext shopContext = new ShopContext();

            Languages = MainFunctions.GetLanguages();
            FoodLanguageBox.ItemsSource = Languages.ToArray();

            Types = MainFunctions.GetFoodTypes(MainLanguage);
            FoodTypeBox.ItemsSource = Types.ToArray();

            RefreshList();
        }
Exemple #6
0
        public AddFoodPage(string language) : this()
        {
            this.MainLanguage = language;
            AddedImage        = false;
            LanguageNum       = 1;

            Types = MainFunctions.GetFoodTypes(MainLanguage);
            FoodType.ItemsSource = Types.ToArray();

            Languages = MainFunctions.GetLanguages();
            LanguageBox.ItemsSource = Languages.ToArray();
            FoodNames.Items.Add(new NewLanguage {
                Languages = Languages
            });
        }
        private void RefreshList(string itemLanguage)
        {
            ShopContext shopContext = new ShopContext();

            Types = MainFunctions.GetFoodTypes(itemLanguage);
            FoodTypeBox.ItemsSource = Types.ToArray();

            Foods = shopContext.FoodDictionary
                    .Join(shopContext.Language, f => f.LanguageID, l => l.LanguageID, (f, l) => new { foodName = f.Name, Language = l.Name })
                    .Where(l => l.Language == itemLanguage).Select(f => f.foodName.ToString()).ToList();
            FoodBox.ItemsSource = Foods.ToArray();

            Units = shopContext.UnitDictionary
                    .Join(shopContext.Language, u => u.LanguageID, l => l.LanguageID, (u, l) => new { UnitId = u.UnitID, UnitName = u.Name, Language = l.Name })
                    .Where(l => l.Language == itemLanguage).Select(u => new { UnitId = u.UnitId, UnitName = u.UnitName.ToString() })
                    .Join(shopContext.Unit, n => n.UnitId, u => u.UnitID, (n, u) => new UnitPropertis {
                Step = (float)u.UnitStep, Name = n.UnitName
            }).ToList();
            FoodUnitBox.ItemsSource = Units.ToArray();
        }