예제 #1
0
 private void btndelete_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         Recipe deleterecipe = CheckNulls();
         //Recipe recipedelete = new Recipe();
         //recipedelete.RecipeId = Convert.ToInt32(txtrecipeId.Text);
         //recipedelete.RecipeName = txtrecipename.Text;
         //recipedelete.Description = txtrecipedescription.Text;
         AdminRecipeBL recipeValidations = new AdminRecipeBL();
         bool          deleteresult      = recipeValidations.DeleteRecipeBL(deleterecipe.RecipeId);
         if (deleteresult)
         {
             bool recipedeleted = recipeValidations.DeleteRecipeBL(deleterecipe.RecipeId);
             if (recipedeleted)
             {
                 MessageBox.Show("Recipe Deleted");
             }
             else
             {
                 MessageBox.Show("Recipe not Deleted");
             }
         }
         else
         {
             MessageBox.Show("No Recipe Details Available");
         }
     }
     catch (RecipeIngredientSystemExceptions ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
예제 #2
0
        private void btnlist_Click(object sender, RoutedEventArgs e)
        {
            AdminRecipeBL recipeValidations = new AdminRecipeBL();

            // dgrecipedetails.DataContext = recipeValidations.GetRecipes();
            dgrecipedetails.ItemsSource = recipeValidations.GetRecipes();
            // dgrecipedetails.Items.Add( recipeValidations.GetRecipes());
        }
예제 #3
0
 private void btnsearch_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         Recipe recipeupdate = CheckNulls();
         // Recipe recipesearch = new Recipe();
         //recipesearch.RecipeId = Convert.ToInt32(txtrecipeId.Text);
         // recipesearch.RecipeName = txtrecipename.Text;
         // recipesearch.Description = txtrecipedescription.Text;
         AdminRecipeBL recipeValidations = new AdminRecipeBL();
         Recipe        searchresult      = recipeValidations.SearchRecipeBL(recipeupdate.RecipeId);
         txtrecipeId.Text          = Convert.ToString(searchresult.RecipeId);
         txtrecipename.Text        = Convert.ToString(searchresult.Name);
         txtrecipedescription.Text = Convert.ToString(searchresult.Description);
     }
     catch (RecipeIngredientSystemExceptions ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
예제 #4
0
        private void btnupdate_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                Recipe recipeupdate = CheckNulls();

                AdminRecipeBL recipeValidations = new AdminRecipeBL();
                bool          updateresult      = recipeValidations.UpdateRecipeBL(recipeupdate);
                if (updateresult)
                {
                    MessageBox.Show("Recipe Updated");
                }
                else
                {
                    MessageBox.Show("Recipe Not Updated");
                }
            }
            catch (RecipeIngredientSystemExceptions ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
예제 #5
0
        private void btnaddrecipe_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                Recipe recipeadd = new Recipe();

                recipeadd.Name        = txtrecipename.Text;
                recipeadd.Description = txtrecipedescription.Text;
                AdminRecipeBL recipeValidations = new AdminRecipeBL();
                bool          addresult         = recipeValidations.AddRecipeBL(recipeadd);
                if (addresult)
                {
                    MessageBox.Show("Recipe Added");
                }
                else
                {
                    MessageBox.Show("Recipe Not Added");
                }
            }
            catch (RecipeIngredientSystemExceptions ex)
            {
                MessageBox.Show(ex.Message);
            }
        }