public bool AddData(PhieuNhapObj pnObj) { cmd.CommandText = "insert into HoaDonNhapSach(MaPN,MaNV,MaNCC) values('" + pnObj.Ma + "','" + pnObj.Manhanvien + "','" + pnObj.Manhacungcap + "')"; cmd.CommandType = CommandType.Text; cmd.Connection = con.Connection; try { con.OpenConn(); cmd.ExecuteNonQuery(); return(true); } catch (Exception ex) { string mex = ex.Message; cmd.Dispose(); con.CloseConn(); } return(false); }
private void btnGhiPhieu_Click(object sender, EventArgs e) { //btnIn.Enabled = true; txtSoLuong.Enabled = false; txtGiaNhap.Enabled = true; cbbMaSach.Enabled = true; btnThemSach.Enabled = true; PhieuNhapObj pnObj = new PhieuNhapObj(); addData(pnObj); if (pnCtr.AddData(pnObj)) { btnGhiPhieu.Enabled = false; btnLapPhieuMoi.Enabled = true; } else { MessageBox.Show("Ghi không thành công!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void addData(PhieuNhapObj pn) { pn.Ma = txtMaPN.Text.Trim(); pn.Manhanvien = txtMaNV.Text.Trim(); pn.Manhacungcap = cbbNhaCC.SelectedValue.ToString(); }
public bool AddData(PhieuNhapObj pnObj) { return(pnMod.AddData(pnObj)); }