示例#1
0
 private void textBox6_TextChanged(object sender, EventArgs e)
 {
     RecipeBL = new RecipeBL();
     RecipeBO = new RecipeBO();
     Cursor   = Cursors.WaitCursor;
     try
     {
         if (textBox6.Text != "Search box")
         {
             if (radioButton1.Checked == true)
             {
                 RecipeBO.recipe          = textBox6.Text.Trim();
                 RecipeBO.cat             = cat;
                 dataGridView1.DataSource = RecipeBL.searchRecipe(RecipeBO);
             }
             else
             {
                 RecipeBO.recipe          = textBox6.Text.Trim();
                 RecipeBO.cat             = cat;
                 dataGridView1.DataSource = RecipeBL.searchRecipeUn(RecipeBO);
             }
         }
     }
     catch (Exception)
     {
         Cursor = Cursors.Arrow;
         throw;
     }
     Cursor = Cursors.Arrow;
 }
示例#2
0
        private void tabControl1_SelectedIndexChanged(object sender, EventArgs e)
        {
            RecipeBL = new RecipeBL();
            RecipeBO = new RecipeBO();
            try
            {
                int selectedcat = Convert.ToInt32(tabControl1.SelectedIndex.ToString());
                if (selectedcat == 0)
                {
                    cat = "Appetizer";
                }
                else if (selectedcat == 1)
                {
                    cat = "Bread Service";
                }
                else if (selectedcat == 2)
                {
                    cat = "Soup";
                }
                else if (selectedcat == 3)
                {
                    cat = "Salad";
                }
                else if (selectedcat == 4)
                {
                    cat = "Pasta";
                }
                else if (selectedcat == 5)
                {
                    cat = "Main Dish";
                }
                else if (selectedcat == 6)
                {
                    cat = "Kiddie Meal";
                }
                else if (selectedcat == 7)
                {
                    cat = "Rice";
                }
                else if (selectedcat == 8)
                {
                    cat = "Dessert";
                }
                else if (selectedcat == 9)
                {
                    cat = "Cake";
                }
                else if (selectedcat == 10)
                {
                    cat = "Drinks";
                }
                else if (selectedcat == 11)
                {
                    cat = "Crew meal";
                }
                else if (selectedcat == 12)
                {
                    cat = "Others";
                }

                if (radioButton1.Checked == true)
                {
                    RecipeBO.recipe = textBox6.Text.Trim();
                    if (textBox6.Text == "Search box")
                    {
                        RecipeBO.recipe = "";
                    }
                    RecipeBO.cat             = cat;
                    dataGridView1.DataSource = RecipeBL.searchRecipe(RecipeBO);
                }
                else
                {
                    RecipeBO.recipe = textBox6.Text.Trim();
                    if (textBox6.Text == "Search box")
                    {
                        RecipeBO.recipe = " ";
                    }
                    RecipeBO.cat             = cat;
                    dataGridView1.DataSource = RecipeBL.searchRecipeUn(RecipeBO);
                }
            }
            catch (Exception)
            {
                throw;
            }
        }