private void button1_Click(object sender, EventArgs e) { bool check = true; ChitietphieubcdtDTO ctbc = new ChitietphieubcdtDTO(); foreach (DataGridViewRow row in dataGridView1.Rows) { ctbc.maphieuBCDT = label6.Text; ctbc.mahd = row.Cells[0].Value.ToString(); ctbc.tongtien = int.Parse(row.Cells[1].Value.ToString()); check = ctbcdtBUS.Them(ctbc); if (check == false) { MessageBox.Show("Lưu thông tin phiếu thất bại. Vui lòng kiểm tra lại dũ liệu"); return; } } PhieubaocaoDoanhThuDTO bcdtnew = new PhieubaocaoDoanhThuDTO(); bcdtnew.maphieuBCDT = bcdt.maphieuBCDT; bcdtnew.ngayLapPhieu = bcdt.ngayLapPhieu; bcdtnew.tongdt = GiaTien; bool kq = bcdtBUS.Sua(bcdtnew); if (kq == false) { MessageBox.Show("Lưu thông tin phiếu thất bại. Vui lòng kiểm tra lại dũ liệu"); } else { MessageBox.Show("Lưu thông tin phiếu thành công"); this.Close(); } }
public bool Them(ChitietphieubcdtDTO ma) { bool re = ctbcdtDAL.Them(ma); return(re); }