private void btnXoa_Click(object sender, EventArgs e) { DialogResult check = MessageBox.Show("Bạn có muốn xóa không", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (check == DialogResult.Yes) { ENTITY.PhieuVatTu p = new ENTITY.PhieuVatTu(); p.ID_PhieuVatTu = txtID_PhieuVatTu.Text.Trim(); DAL.PhieuVatTu_Model pvt = new DAL.PhieuVatTu_Model(); pvt.deletePhieuVatTu(p); } showLsvPhieuVatTu(); lockControl(); clearControl(); }
private void btnTimKiem_Click(object sender, EventArgs e) { try { clearLsvPhieuVatTu(); DAL.PhieuVatTu_Model p = new DAL.PhieuVatTu_Model(); SqlDataReader dr = p.searchPhieuVatTu(cmbTimKiem.Text.Trim(), cmbValue.Text.Trim()); while (dr.Read()) { addList(dr); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnLuu_Click(object sender, EventArgs e) { ENTITY.PhieuVatTu p = new ENTITY.PhieuVatTu(); p.ID_PhieuVatTu = txtID_PhieuVatTu.Text.Trim(); p.MaNPT = txtMaNPT.Text.Trim(); p.ThoiGian = dtThoiGian.Value.ToShortDateString(); DAL.PhieuVatTu_Model pvt = new DAL.PhieuVatTu_Model(); if (kt == true) { pvt.insertPhieuVatTu(p); } else { pvt.editPhieuVatTu(p); } showLsvPhieuVatTu(); clearControl(); lockControl(); }