Exemplo n.º 1
0
 private void dgvDanhSach_KeyDown(object sender, KeyEventArgs e)
 {
     tsbtnXoa.Enabled      = true;
     dgvChiTiet.DataSource = DonDatHangBUS.DanhSachCTPD(dgvDanhSach.CurrentRow.Cells[0].Value.ToString());
     Custom2();
     dgvChiTiet.ClearSelection();
 }
 private void dgvDanhSachPG_KeyUp(object sender, KeyEventArgs e)
 {
     tsbtnXoa.Enabled        = true;
     dgvChiTietPG.DataSource = PhieuGiaoHangBUS.DanhSachCTPG(dgvDanhSachPG.CurrentRow.Cells[0].Value.ToString());
     Custom2();
     dgvChiTietPG.ClearSelection();
     dgvDanhSachPD.DataSource = DonDatHangBUS.DanhSachDDHTheoMaPG(dgvDanhSachPG.CurrentRow.Cells[0].Value.ToString());
     Custom3();
     dgvChiTietPD.DataSource = DonDatHangBUS.DanhSachCTPD(dgvDanhSachPD.CurrentRow.Cells[0].Value.ToString());
     Custom4();
     dgvChiTietPD.ClearSelection();
 }
 void LoadData()
 {
     if (dgvDanhSachPD.Rows.Count > 0)
     {
         // Cập nhật trạng thái đơn dặt hàng.
         if (DonDatHangBUS.KiemTraSLHang(dgvDanhSachPD.CurrentRow.Cells[0].Value.ToString()) == 0)
         {
             if (DonDatHangBUS.UpdateTrangThai(dgvDanhSachPD.CurrentRow.Cells[0].Value.ToString(), 3) == false)
             {
                 MessageBox.Show("Cập nhật trạng thái thất bại.", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
         else if (DonDatHangBUS.KiemTraSLHang(dgvDanhSachPD.CurrentRow.Cells[0].Value.ToString()) == 1)
         {
             if (DonDatHangBUS.UpdateTrangThai(dgvDanhSachPD.CurrentRow.Cells[0].Value.ToString(), 2) == false)
             {
                 MessageBox.Show("Cập nhật trạng thái thất bại.", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
         else if (DonDatHangBUS.KiemTraSLHang(dgvDanhSachPD.CurrentRow.Cells[0].Value.ToString()) == -1)
         {
             if (DonDatHangBUS.UpdateTrangThai(dgvDanhSachPD.CurrentRow.Cells[0].Value.ToString(), 1) == false)
             {
                 MessageBox.Show("Cập nhật trạng thái thất bại.", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
         // Load data.
         dgvDanhSachPG.DataSource = PhieuGiaoHangBUS.DanhSachPG();
         Custom1();
         dgvDanhSachPG.ClearSelection();
         if (dgvDanhSachPG.Rows.Count > 0)
         {
             dgvChiTietPG.DataSource = PhieuGiaoHangBUS.DanhSachCTPG(dgvDanhSachPG.CurrentRow.Cells[0].Value.ToString());
             Custom2();
             dgvChiTietPG.ClearSelection();
             dgvDanhSachPD.DataSource = DonDatHangBUS.DanhSachDDHTheoMaPG(dgvDanhSachPG.CurrentRow.Cells[0].Value.ToString());
             Custom3();
             dgvChiTietPD.DataSource = DonDatHangBUS.DanhSachCTPD(dgvDanhSachPD.CurrentRow.Cells[0].Value.ToString());
             Custom4();
             dgvChiTietPD.ClearSelection();
         }
         else
         {
             dgvChiTietPG.DataSource  = null;
             dgvDanhSachPD.DataSource = null;
             dgvChiTietPD.DataSource  = null;
         }
     }
 }
Exemplo n.º 4
0
 void LoadData()
 {
     dgvDanhSach.DataSource = DonDatHangBUS.DanhSachPD();
     Custom1();
     dgvDanhSach.ClearSelection();
     if (dgvDanhSach.Rows.Count > 0)
     {
         dgvChiTiet.DataSource = DonDatHangBUS.DanhSachCTPD(dgvDanhSach.CurrentRow.Cells[0].Value.ToString());
         Custom2();
         dgvChiTiet.ClearSelection();
     }
     else
     {
         dgvChiTiet.DataSource = null;
     }
 }