//add private void button1_Click(object sender, EventArgs e) { if (string.IsNullOrWhiteSpace(textBox1.Text)) { MessageBox.Show("Bạn chưa nhập mã phiếu"); textBox1.Focus(); return; } PhieubaocaoDoanhThuDTO dt = new PhieubaocaoDoanhThuDTO(); dt.maphieuBCDT = textBox1.Text; dt.ngayLapPhieu = DateTime.Today; dt.tongdt = 0; if (bcdtBUS.CheckExist(DateTime.Today.Month, DateTime.Today.Year)) { MessageBox.Show("Thêm hồ sơ thất bại. Tháng này đã có phiếu báo cáo doanh thu"); return; } bool kq = bcdtBUS.Them(dt); if (kq == false) { MessageBox.Show("Thêm hồ sơ thất bại. Vui lòng kiểm tra lại dũ liệu"); } else { MessageBox.Show("Thêm hồ sơ thành công"); textBox1.Text = ""; ChitietBaoCaoDoanhThu frm = new ChitietBaoCaoDoanhThu(dt, true); frm.ShowDialog(); } loadData_Vao_GridView(); }
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(); } }
//xem chi tiet private void xemChiTiếtToolStripMenuItem_Click(object sender, EventArgs e) { int currentRowIndex = dataGridView1.CurrentCellAddress.Y;// 'current row selected //'Verify that indexing OK if (-1 < currentRowIndex && currentRowIndex < dataGridView1.RowCount) { PhieubaocaoDoanhThuDTO ma = (PhieubaocaoDoanhThuDTO)dataGridView1.Rows[currentRowIndex].DataBoundItem; if (ma != null) { ChitietBaoCaoDoanhThu frm = new ChitietBaoCaoDoanhThu(ma, false); frm.ShowDialog(); loadData_Vao_GridView(); } } }
public ChitietBaoCaoDoanhThu(PhieubaocaoDoanhThuDTO bcdt, Boolean watch) { this.bcdt = bcdt; bcdtBUS = new PhieubaocaoDoanhThuBUS(); ctbcdtBUS = new ChitietphieubcdtBUS(); xemornot = watch; InitializeComponent(); if (watch) { loadData_Vao_GridView(); } else { loadData_Vao_GridViewXem(); button1.Enabled = false; } Tinhtien(); }
//xoa private void xóaPhiếuToolStripMenuItem_Click(object sender, EventArgs e) { int currentRowIndex = dataGridView1.CurrentCellAddress.Y;// 'current row selected //'Verify that indexing OK if (-1 < currentRowIndex && currentRowIndex < dataGridView1.RowCount) { PhieubaocaoDoanhThuDTO ma = (PhieubaocaoDoanhThuDTO)dataGridView1.Rows[currentRowIndex].DataBoundItem; if (ma != null) { bool kq1 = ctbcdtBUS.XoatheophieuBCDT(ma.maphieuBCDT); bool kq2 = bcdtBUS.Xoa(ma); if (!kq1 && !kq2) { MessageBox.Show("Xóa phiếu thất bại. Vui lòng kiểm tra lại dũ liệu"); } else { MessageBox.Show("Xóa phiếu thành công"); this.loadData_Vao_GridView(); } } } }
public bool Xoa(PhieubaocaoDoanhThuDTO ma) { bool re = bcdtDAL.Xoa(ma); return(re); }
public bool Them(PhieubaocaoDoanhThuDTO ma) { bool re = bcdtDAL.Them(ma); return(re); }