private void btnLuu_Click(object sender, EventArgs e) { try { eCTPhieuQlyKho newect = new eCTPhieuQlyKho(); newect._maPhieuQly = cbbMaPhieuQL.Text; newect._sTT = txtSTT.Text; newect._maSP = cbbMaSP.Text; newect._tenSP = cbbMaSP.Text; newect._soLuongQly = Convert.ToInt32(txtSoluong.Text); newect._donVi = txtDonVi.Text; bool kq = bllCTqlkho.AddAllCTPQLKho(newect); if (kq) { MessageBox.Show("Thêm thành công!!!"); } else { MessageBox.Show("Trùng mã phiếu!!"); } listCTqlykho = bllCTqlkho.getCTPhieuQLKhoTheoMaPhieu(cbbMaPhieuQL.Text); //listtp = blltp.getthuephongbymaphong(txtmaphong.Text); duadulieulendgview(dgvCTPQLK, listCTqlykho); CheDoButton(true); CheDoTextBox(false); btnThem.Text = "Thêm"; } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void btnthem_Click(object sender, EventArgs e) { eCTQLKho ect = new eCTQLKho(); ect._maPhieuQL = txtmaphieu.Text; ect._sott = txtstt.Text; ect._masp = txtmasp.Text; ect._tensp = txttensp.Text; ect._soluongql = txtsoluong.Text; ect._donvi = txtdonvi.Text; bool kq = ctqlkBLL.AddAllCTPQLKho(ect); if (kq == false) { MessageBox.Show("Không có mã phiếu để thêm!", "Thông báo!"); } else { MessageBox.Show("Thêm thành công!", "Thông báo!"); dataCTPQLK.DataSource = ctqlkBLL.getAllCTPhieuQLKho(); } }