Exemplo n.º 1
0
 private void btnLuu_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("Xác Nhận Mua Hàng?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
     {
         HDBanDTO ob = checkDataHDB();
         if (ob != null)
         {
             if (cthdbList.Count == 0)
             {
                 MessageBox.Show("Phải Có Hàng Hóa", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 cbxMaHang.Focus();
                 return;
             }
             else
             {
                 B_HDBan.saveHDB(ob, sys.INSERT);
                 foreach (CTHDBDTO cthdb in cthdbList)
                 {
                     B_CTHDB.saveCTHDB(cthdb, sys.INSERT);
                 }
                 MessageBox.Show("Tuyệt Vời", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 cthdbList.Clear();
                 loadTempTable(cthdbList);
                 dgvHDB.DataSource = B_HDBan.GetAllHDBan();
                 clrHang();
                 clrHD();
                 clrCbx();
                 turnOffBtnUnder(false);
             }
         }
     }
 }
Exemplo n.º 2
0
 private void backHDB(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         string arg = dgvHDB.Rows[e.RowIndex].Cells[0].Value.ToString();
         txtSoHDB.Text         = arg;
         cbxMaNV.SelectedValue = dgvHDB.Rows[e.RowIndex].Cells[1].Value.ToString();
         dtpNgayBan.Text       = dgvHDB.Rows[e.RowIndex].Cells[2].Value.ToString();
         cbxMaKH.SelectedValue = dgvHDB.Rows[e.RowIndex].Cells[3].Value.ToString();
         DataTable cthdngg = B_CTHDB.GetInfoHangHoaHDB(arg);
         dgvHDB.DataSource     = cthdngg;
         btnLuu.Enabled        = false;
         btnThemVaoGio.Enabled = false;
     }
     catch { }
 }