예제 #1
0
        public void Handle(object sender, EventArgs e)
        {
            Food f = listFood.FormFood.GetFood();

            if (f != null)
            {
                bool b = new FoodDAO().InsertFood(f);
                if (b)
                {
                    listFood.DisplayNewFood(f);
                    listFood.CloseFormFood();
                }
                else
                {
                    listFood.DisplayErrorAddFood();
                }
            }
        }
        public void Handle(object sender, EventArgs e)
        {
            Food f = listFood.FormFood.GetFoodUpdate();

            //System.Windows.Forms.MessageBox.Show(f.Id);
            if (f != null)
            {
                bool b = new FoodDAO().UpdateFood(f);
                if (b)
                {
                    listFood.DisplayNewFood(f);
                    listFood.CloseFormFood();
                }
                else
                {
                    listFood.DisplayErrorEditFood();
                }
            }
        }