예제 #1
0
        private void btnLuu_Click(object sender, EventArgs e)
        {
            try
            {
                HoaDon hoaDon = new HoaDon(txtMaHoaDon.Text, txtMaKhachHang.Text, DateTime.Now.ToString("MM/dd/yyyy"),
                                           txtMaNhanVien.Text);
                BULHoaDon = new BULHoaDon();
                BULHoaDon.themHoaDon(hoaDon);

                themHoaDonChiTiet();
                MessageBox.Show("Thêm Hóa Đơn Thành Công");
            }
            catch (Exception)
            {
                MessageBox.Show("Vui Lòng Kiểm tra Lại");
            }
        }
예제 #2
0
        private void btnTaoHoaDon_Click(object sender, EventArgs e)
        {
            try
            {
                BULHoaDon bulhd = new BULHoaDon();
                bulhd.themHoaDon(new HoaDon(1, DateTime.Now.ToShortDateString(), int.Parse(txtMaKhachHang.Text), int.Parse(txtMaNhanVien.Text)));
                BULChiTietHoaDon bulct = new BULChiTietHoaDon();

                for (int i = 0; i < dgvGio.RowCount - 1; i++)
                {
                    ChiTietHoaDon cthd = new ChiTietHoaDon(int.Parse(dgvGio.Rows[i].Cells[0].Value + ""), bulhd.layHoaDonVuaThem(), int.Parse(dgvGio.Rows[i].Cells[3].Value + ""), int.Parse(dgvGio.Rows[i].Cells[4].Value + ""));

                    bulct.themChiTietHoaDon(cthd);
                }
                MessageBox.Show("Tạo hóa đơn thành công", "Thành công", MessageBoxButtons.OK, MessageBoxIcon.Information);
                frmST.hienDanhSachHoaDon();
                this.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Có lỗi xảy ra, xem lại dữ liệu hàng", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }