private void LoadThongTin_ThanhToanDL(string s) { List <QuanLiTIenNo_DaiLi_DTO> ds = QuanLiTienNo_DaiLi_BUS.ThongTinTienNoDL(s); dtgvListPayOfAgency.DataSource = ds; if (dtgvListPayOfAgency.Rows.Count == 0) { dtgvListPayOfAgency.ColumnCount = 4; dtgvListPayOfAgency.ColumnHeadersVisible = true; dtgvListPayOfAgency.Columns[0].Name = "MaTN"; dtgvListPayOfAgency.Columns[1].Name = "MaDL"; dtgvListPayOfAgency.Columns[2].Name = "NgayTra"; dtgvListPayOfAgency.Columns[3].Name = "SoTienTra"; dtgvListPayOfAgency.Columns[0].DataPropertyName = "MaTN"; dtgvListPayOfAgency.Columns[1].DataPropertyName = "MaDL"; dtgvListPayOfAgency.Columns[2].DataPropertyName = "NgayTra"; dtgvListPayOfAgency.Columns[3].DataPropertyName = "SoTienTra";; dtgvListPayOfAgency.Columns[0].HeaderText = "Mã TT"; dtgvListPayOfAgency.Columns[1].HeaderText = "Mã DL"; dtgvListPayOfAgency.Columns[2].HeaderText = "Ngày trả"; dtgvListPayOfAgency.Columns[3].HeaderText = "Số tiền trả"; dtgvListPayOfAgency.Columns[0].Width = 100; dtgvListPayOfAgency.Columns[1].Width = 105; dtgvListPayOfAgency.Columns[2].Width = 115; dtgvListPayOfAgency.Columns[3].Width = 115; } }
private void btnDeletePay_Click(object sender, EventArgs e) { if (txtPayAgency.Text == "") { XtraMessageBox.Show("Bạn phải điền đầy đủ thông tin !", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } QuanLiTIenNo_DaiLi_DTO thanhtoan = new QuanLiTIenNo_DaiLi_DTO(); thanhtoan.MaTN = txtIDPayOfAgency.Text; try { if (QuanLiTienNo_DaiLi_BUS.XoaThongTinTienNoDL(thanhtoan)) { Load_DSNoDaiLi(); LoadThongTin_ThanhToanDL(txtIDAgency.Text.ToString()); txtIDPayOfAgency.Text = DataProvider.ExcuteScalar(string.Format("SELECT MaTN=dbo.fcGetMaTTDL()")); string arr = HoaDonNhapHang_BUS.TongNoDaiLi(txtIDAgency.Text); txtTotalDebt.Text = arr; txtPayAgency.Text = ""; XtraMessageBox.Show("Xóa thông tin thanh toán thành công !", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } catch (Exception ex) { XtraMessageBox.Show(ex.Message, "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } }