private void btnLuu_Click(object sender, EventArgs e) { // Mở kết nối // Thêm dữ liệu if (Them) { try { // Thực hiện lệnh BLFood blSanPham = new BLFood(); blSanPham.ThemFood(int.Parse(txtFoodId.Text.ToString()), this.txtFoodName.Text, int.Parse(TxtGia.Text.ToString()), int.Parse(txtCategory.Text.ToString()), ref err); // Load lại dữ liệu trên DataGridView LoadData(); // Thông báo MessageBox.Show("Đã thêm xong!"); } catch (SqlException) { MessageBox.Show("Không thêm được. Lỗi rồi!"); } } else { // Thực hiện lệnh BLFood blSanPham = new BLFood(); blSanPham.CapNhatFood(int.Parse(txtFoodId.Text.ToString()), this.txtFoodName.Text, int.Parse(TxtGia.Text.ToString()), int.Parse(txtCategory.Text.ToString()), ref err); // Load lại dữ liệu trên DataGridView LoadData(); // Thông báo MessageBox.Show("Đã sửa xong!"); } // Đóng kết nối }
public frmQuanLyMonAn() { InitializeComponent(); food = new BLFood(); typefood = new BLTypeFood(); supplier = new BLSupplier(); lstTypeFood = new List <cTypeFood>(); lstsupplier = new List <cSupplier>(); LoadData(); }
public frmQuanLyBanAn() { InitializeComponent(); bill = new BLBill(); billinfo = new BLBillInfo(); food = new BLFood(); typefood = new BLTypeFood(); blvoucher = new BLVoucher(); tablefood = new BLTableFood(); LayBanaAn(); LoadType(); //menuStrip1.Hide(); }