Пример #1
0
 public Management()
 {
     InitializeComponent();
     try
     {
         FoodCategoryDAO fcDAO = new FoodCategoryDAO();
         dataGridView1.DataSource = fcDAO.loadFoodCategories();
         textBox1.Enabled         = false;
     }
     catch (Exception e)
     {
     }
 }
Пример #2
0
        private void button5_Click(object sender, EventArgs e)
        {
            FoodCategoryDAO fcDAO = new FoodCategoryDAO();

            if (fcDAO.addFoodCategory(textBox2.Text))
            {
                MessageBox.Show("Dữ liệu được thêm thành công", "Thêm thành công", MessageBoxButtons.OK, MessageBoxIcon.Information);
                dataGridView1.DataSource = fcDAO.loadFoodCategories();
            }
            else
            {
                MessageBox.Show("Dữ liệu không được thêm", "Thêm thất bại", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }