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; } }
private void dtgvListAgency_CellClick(object sender, DataGridViewCellEventArgs e) { txtPayAgency.Text = ""; try { lbListBillOfAgency.Items.Clear(); if (e.RowIndex >= 0 && e.ColumnIndex >= 0) { txtIDAgency.Text = dtgvListAgency.CurrentRow.Cells["MaDL"].Value.ToString(); txtNameAgency.Text = dtgvListAgency.CurrentRow.Cells["TenDL"].Value.ToString(); List <string> dsMaHDN = HoaDonNhapHang_BUS.LoadDS_MaHDNhap(txtIDAgency.Text.ToString()); if (dsMaHDN == null) { return; } else { foreach (string item in dsMaHDN) { lbListBillOfAgency.Items.Add(item); } } string arr = HoaDonNhapHang_BUS.TongNoDaiLi(txtIDAgency.Text); txtTotalDebt.Text = arr; txtIDPayOfAgency.Text = DataProvider.ExcuteScalar(string.Format("SELECT MaTN=dbo.fcGetMaTTDL()")); LoadThongTin_ThanhToanDL(txtIDAgency.Text); return; } } catch (Exception ex) { XtraMessageBox.Show(ex.Message, "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } }