private void UpdateWindow()
 {
     WpfApplication1.FoodProjectDataSet foodProjectDataSet = ((WpfApplication1.FoodProjectDataSet)(this.FindResource("foodProjectDataSet")));
     // Load data into the table Cuisine. You can modify this code as needed.
     WpfApplication1.FoodProjectDataSetTableAdapters.CuisineTableAdapter foodProjectDataSetCuisineTableAdapter = new WpfApplication1.FoodProjectDataSetTableAdapters.CuisineTableAdapter();
     foodProjectDataSetCuisineTableAdapter.FillByAZ(foodProjectDataSet.Cuisine);
     System.Windows.Data.CollectionViewSource cuisineViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("cuisineViewSource")));
     cuisineViewSource.View.MoveCurrentToFirst();
 }
        private void btnNewCuisine_Click(object sender, RoutedEventArgs e)
        {
            NewCuisine win = new NewCuisine();

            win.ShowDialog();

            WpfApplication1.FoodProjectDataSet foodProjectDataSet = ((WpfApplication1.FoodProjectDataSet)(this.FindResource("foodProjectDataSet")));
            WpfApplication1.FoodProjectDataSetTableAdapters.CuisineTableAdapter foodProjectDataSetCuisineTableAdapter = new WpfApplication1.FoodProjectDataSetTableAdapters.CuisineTableAdapter();
            foodProjectDataSetCuisineTableAdapter.Fill(foodProjectDataSet.Cuisine);
        }
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            int rid = (int)App.Current.Properties["rid"];

            WpfApplication1.FoodProjectDataSet foodProjectDataSet = ((WpfApplication1.FoodProjectDataSet)(this.FindResource("foodProjectDataSet")));
            foodProjectDataSet.EnforceConstraints = false; //Tek af constraints

            // Measure
            WpfApplication1.FoodProjectDataSetTableAdapters.MeasureTableAdapter foodProjectDataSetMeasureTableAdapter = new WpfApplication1.FoodProjectDataSetTableAdapters.MeasureTableAdapter();
            foodProjectDataSetMeasureTableAdapter.Fill(foodProjectDataSet.Measure);
            //System.Windows.Data.CollectionViewSource measureViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("measureViewSource")));
            //measureViewSource.View.MoveCurrentToFirst();

            // Ingredient
            WpfApplication1.FoodProjectDataSetTableAdapters.IngredientTableAdapter foodProjectDataSetIngredientTableAdapter = new WpfApplication1.FoodProjectDataSetTableAdapters.IngredientTableAdapter();
            foodProjectDataSetIngredientTableAdapter.Fill(foodProjectDataSet.Ingredient);
            //System.Windows.Data.CollectionViewSource ingredientViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("ingredientViewSource")));
            //ingredientViewSource.View.MoveCurrentToFirst();

            // Recipe
            WpfApplication1.FoodProjectDataSetTableAdapters.RecipeTableAdapter foodProjectDataSetRecipeTableAdapter = new WpfApplication1.FoodProjectDataSetTableAdapters.RecipeTableAdapter();
            foodProjectDataSetRecipeTableAdapter.FillByRid(foodProjectDataSet.Recipe, rid);
            System.Windows.Data.CollectionViewSource recipeViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("recipeViewSource")));
            recipeViewSource.View.MoveCurrentToFirst();

            // MainRecipeDetails
            WpfApplication1.FoodProjectDataSetTableAdapters.MainRecipeDetailsTableAdapter foodProjectDataSetMainRecipeDetailsTableAdapter = new WpfApplication1.FoodProjectDataSetTableAdapters.MainRecipeDetailsTableAdapter();
            foodProjectDataSetMainRecipeDetailsTableAdapter.FillByRid(foodProjectDataSet.MainRecipeDetails, rid);
            System.Windows.Data.CollectionViewSource mainRecipeDetailsViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("mainRecipeDetailsViewSource")));
            mainRecipeDetailsViewSource.View.MoveCurrentToFirst();

            // CuisineInfo
            WpfApplication1.FoodProjectDataSetTableAdapters.CuisineInfoTableAdapter foodProjectDataSetCuisineInfoTableAdapter = new WpfApplication1.FoodProjectDataSetTableAdapters.CuisineInfoTableAdapter();
            foodProjectDataSetCuisineInfoTableAdapter.FillByCuisineInfo(foodProjectDataSet.CuisineInfo, rid);
            System.Windows.Data.CollectionViewSource cuisineInfoViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("cuisineInfoViewSource")));
            cuisineInfoViewSource.View.MoveCurrentToFirst();

            // Cuisine
            WpfApplication1.FoodProjectDataSetTableAdapters.CuisineTableAdapter foodProjectDataSetCuisineTableAdapter = new WpfApplication1.FoodProjectDataSetTableAdapters.CuisineTableAdapter();
            foodProjectDataSetCuisineTableAdapter.Fill(foodProjectDataSet.Cuisine);
            //System.Windows.Data.CollectionViewSource cuisineViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("cuisineViewSource")));
            //cuisineViewSource.View.MoveCurrentToFirst();

            string currentImage = foodProjectDataSetRecipeTableAdapter.GetImageUrl(rid);

            App.Current.Properties["image_url"] = currentImage;
            App.Current.Properties["isDeleted"] = isDeleted;

            unsavedChanges = false;
        }
        private void UpdateWindow()
        {
            WpfApplication1.FoodProjectDataSet foodProjectDataSet = ((WpfApplication1.FoodProjectDataSet)(this.FindResource("foodProjectDataSet")));
            foodProjectDataSet.EnforceConstraints = false;
            // Load data into the table Recipe. You can modify this code as needed.
            WpfApplication1.FoodProjectDataSetTableAdapters.RecipeTableAdapter foodProjectDataSetRecipeTableAdapter = new WpfApplication1.FoodProjectDataSetTableAdapters.RecipeTableAdapter();
            foodProjectDataSetRecipeTableAdapter.FillByname(foodProjectDataSet.Recipe);
            System.Windows.Data.CollectionViewSource recipeViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("recipeViewSource")));
            recipeViewSource.View.MoveCurrentToFirst();

            // Load data into the table Cuisine. You can modify this code as needed.
            WpfApplication1.FoodProjectDataSetTableAdapters.CuisineTableAdapter foodProjectDataSetCuisineTableAdapter = new WpfApplication1.FoodProjectDataSetTableAdapters.CuisineTableAdapter();
            foodProjectDataSetCuisineTableAdapter.Fill(foodProjectDataSet.Cuisine);
            System.Windows.Data.CollectionViewSource cuisineViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("cuisineViewSource")));
            cuisineViewSource.View.MoveCurrentToFirst();

            cuisineComboBox.SelectedValue = null;
        }
Ejemplo n.º 5
0
        private void UpdateWindow()
        {
            try
            {
                WpfApplication1.FoodProjectDataSet foodProjectDataSet = ((WpfApplication1.FoodProjectDataSet)(this.FindResource("foodProjectDataSet")));

                foodProjectDataSet.EnforceConstraints = false;
                // Load data into the table Recipe. You can modify this code as needed.
                WpfApplication1.FoodProjectDataSetTableAdapters.RecipeTableAdapter foodProjectDataSetRecipeTableAdapter = new WpfApplication1.FoodProjectDataSetTableAdapters.RecipeTableAdapter();
                foodProjectDataSetRecipeTableAdapter.Fill(foodProjectDataSet.Recipe);
                System.Windows.Data.CollectionViewSource recipeViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("recipeViewSource")));
                recipeViewSource.View.MoveCurrentToFirst();


                // Load data into the table Cuisine. You can modify this code as needed.
                WpfApplication1.FoodProjectDataSetTableAdapters.CuisineTableAdapter foodProjectDataSetCuisineTableAdapter = new WpfApplication1.FoodProjectDataSetTableAdapters.CuisineTableAdapter();
                foodProjectDataSetCuisineTableAdapter.Fill(foodProjectDataSet.Cuisine);
                System.Windows.Data.CollectionViewSource cuisineViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("cuisineViewSource")));
                cuisineViewSource.View.MoveCurrentToFirst();

                // Load data into the table Category. You can modify this code as needed.
                WpfApplication1.FoodProjectDataSetTableAdapters.CategoryTableAdapter foodProjectDataSetCategoryTableAdapter = new WpfApplication1.FoodProjectDataSetTableAdapters.CategoryTableAdapter();
                foodProjectDataSetCategoryTableAdapter.Fill(foodProjectDataSet.Category);
                System.Windows.Data.CollectionViewSource categoryViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("categoryViewSource")));
                categoryViewSource.View.MoveCurrentToFirst();

                // Load data into the table Ingredient. You can modify this code as needed.
                WpfApplication1.FoodProjectDataSetTableAdapters.IngredientTableAdapter foodProjectDataSetIngredientTableAdapter = new WpfApplication1.FoodProjectDataSetTableAdapters.IngredientTableAdapter();
                foodProjectDataSetIngredientTableAdapter.Fill(foodProjectDataSet.Ingredient);
                System.Windows.Data.CollectionViewSource categoryIngredientViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("categoryIngredientViewSource")));
                categoryIngredientViewSource.View.MoveCurrentToFirst();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Villa í Update");
            }
        }