public bool AddData(PhieuNhapobj pnObj) { cmd.CommandText = "insert into PhieuNhapHang(MaNV,MaNCC,TongTien) values ('" + pnObj.Nguoilap + "','" + pnObj.Ncc + "','" + pnObj.Tongtien + "')"; 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 button3_Click(object sender, EventArgs e) { PhieuNhapobj hdObj = new PhieuNhapobj(); adddata(hdObj); if (pnctr.AddData(hdObj)) { if (ctctr.AddData(dtDSCT)) { MessageBox.Show("Thêm hóa đơn thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Thêm chi tiết không thành công!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("Thêm hóa đơn không thành công!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } PhieuNhap_Load(sender, e); }
public bool AddData(PhieuNhapobj hdObj) { return(hdMod.AddData(hdObj)); }
private void adddata(PhieuNhapobj pn) { pn.Nguoilap = bientoancuc.bienxy; pn.Ncc = cmbKhachHang.SelectedValue.ToString(); }