Ejemplo n.º 1
0
        private async void dgvHoanThanh_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            HoaDon hd = new HoaDon();
            int    a  = dgvHoanThanh.Rows.Count;

            hd.ID = Convert.ToInt32(dgvHoanThanh.Rows[e.RowIndex].Cells[0].Value);

            if (Convert.IsDBNull(dgvHoanThanh.Rows[e.RowIndex].Cells[1].Value))
            {
                hd.IDKhachHang = -1;
            }
            hd.IDKhachHang = Convert.IsDBNull(dgvHoanThanh.Rows[e.RowIndex].Cells[1].Value) ? -1 : Convert.ToInt32(dgvHoanThanh.Rows[e.RowIndex].Cells[1].Value) == 0 ? -1 : Convert.ToInt32(dgvHoanThanh.Rows[e.RowIndex].Cells[1].Value);
            hd.IDNhanVien  = Convert.IsDBNull(dgvHoanThanh.Rows[e.RowIndex].Cells[2].Value) ? -1 : Convert.ToInt32(dgvHoanThanh.Rows[e.RowIndex].Cells[2].Value) == 0 ? -1 : Convert.ToInt32(dgvHoanThanh.Rows[e.RowIndex].Cells[2].Value);
            hd.Ngay        = Convert.ToDateTime(dgvHoanThanh.Rows[e.RowIndex].Cells[3].Value);
            hd.TinhTrang   = Convert.ToByte(true);

            await balHD.CapNhap(hd);

            bsHoanThanh.DataSource = await balHD.LayDT(dtpNgayBD.Value, dtpNgayKetThuc.Value, Convert.ToByte(0));

            if (a <= dgvHoanThanh.Rows.Count)
            {
                MessageBox.Show("Hoàn thành đơn không thành công.\nVui lòng thử lại.\nNếu vẫn tiếp tục lỗi xin thông báo cho kỹ thuật viên.");
            }
        }
Ejemplo n.º 2
0
 private async void btnHoanThanh_Click(object sender, EventArgs e)
 {
     if (dgvDanhSachHang.Rows.Count == 0)
     {
         if (MessageBox.Show("Chưa có sản phẩm bán đi. Bạn muốn xóa đơn ?\nYES để xóa đơn.\nNO để tiếp tục sửa hóa đơn", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
         {
             ;
         }
         {
             await balHD.Xoa(hd.ID);
         }
     }
     else
     {
         hd.TinhTrang = 1;
         await balHD.CapNhap(hd);
     }
     if (MessageBox.Show("Bạn có muốn tiếp tục tạo đơn không ?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
     {
         MessageBox.Show("Tạo đơn mới");
     }
     else
     {
         this.Close();
     }
 }