private void gridCtNganHang_Click(object sender, EventArgs e) { if (GVCTNH.RowCount > 0) { cTNgan = (GVCTNH.GetRow(GVCTNH.GetSelectedRows()[0]) as O_CTNGANHANG); } }
void ChinhSua() { if (DuLieuTaoSan.Q.NganHangThemSua) { cTNgan = (GVCTNH.GetRow(GVCTNH.GetSelectedRows()[0]) as O_CTNGANHANG); int Ma = cTNgan.ID; if (cTNgan.LoaiGiaoDich == 23 || cTNgan.LoaiGiaoDich == 24) { List <O_CTNGANHANG> cTNganHangOs = _listCTNganHangO.Where(w => (w.MaLienKet ?? string.Empty).Equals(cTNgan.MaLienKet)).ToList(); if (cTNganHangOs.Count == 2) { Ma = cTNgan.ID == cTNganHangOs[0].ID ? Ma : cTNganHangOs[0].ID; Ma = cTNgan.ID == cTNganHangOs[1].ID ? Ma : cTNganHangOs[1].ID; new frmNHCTThem(cTNgan, Ma).ShowDialog(ParentForm); } else { XuLyGiaoDien.Alert("Sai định dạng", Form_Alert.enmType.Info); } } else { new frmNHCTThem(cTNgan, 0).ShowDialog(ParentForm); } } }
private void btnDel_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (XtraMessageBox.Show("Bạn có chắc xóa", "Thông báo", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.Cancel) { return; } cTNgan = (GVCTNH.GetRow(GVCTNH.GetSelectedRows()[0]) as O_CTNGANHANG); D_CTNGANHANG nh = new D_CTNGANHANG(); List <object> lstCtv = new List <object>(); if (cTNgan.LoaiKhachHang == 7) { List <O_CTNGANHANG> cTNganHangOs = new D_CTNGANHANG().Dem($"WHERE MaLienKet = '{cTNgan.MaLienKet}'"); if (cTNganHangOs.Count == 2) { lstCtv.Add(cTNganHangOs[0].ID); lstCtv.Add(cTNganHangOs[1].ID); } else { XuLyGiaoDien.Alert("Sai định dạng", Form_Alert.enmType.Info); return; } } else { lstCtv.Add(cTNgan.ID); new D_BAOCAOCTNH().Xoa(cTNgan.ID, "WHERE IDCTNganHang = {0}"); } if (XuLyGiaoDien.ThongBao(Text, nh.XoaNhieu1Ban(lstCtv, "CTNGANHANG") > 0, true)) { if (cTNgan.LoaiKhachHang == 1 || cTNgan.LoaiKhachHang == 2) { new D_DAILY().ChayLaiPhi(cTNgan.NgayHT); } else if (cTNgan.LoaiKhachHang == 4 || cTNgan.LoaiKhachHang == 30) { List <O_GIAODICH> _GiaoDich = new D_GIAODICH().DuLieuNganHang(cTNgan.IDGiaoDich); List <Dictionary <string, object> > lstdic2 = new List <Dictionary <string, object> >(); List <string> CTV = new List <string>(); Dictionary <string, object> dic2 = new Dictionary <string, object>(); for (int i = 0; i < _GiaoDich.Count; i++) { O_GIAODICH gd = _GiaoDich[i]; dic2 = new Dictionary <string, object>(); CTV.Add(string.Format("WHERE ID = {0}", gd.ID)); dic2.Add("Khoa", false); lstdic2.Add(dic2); } new D_GIAODICH().SuaNhieu1Ban(lstdic2, CTV); } nhD.ChayLaiSD(); string NoiDung = string.Format("Xóa GD Ngân Hàng : {0} VNĐ [{1}]", cTNgan.SoTien.ToString("#,###"), cTNgan.GhiChu); Dictionary <string, object> dic = new Dictionary <string, object>(); dic.Add("FormName", Text); dic.Add("MaCho", cTNgan.MaLienKet); dic.Add("NoiDung", NoiDung); dic.Add("NVGiaoDich", DuLieuTaoSan.NV.ID); dic.Add("LoaiKhachHang", cTNgan.LoaiKhachHang); dic.Add("Ma", cTNgan.MaDL); if (NoiDung.Length > 10) { new D_LS_GIAODICH().ThemMoi(dic); } TaiLaiDuLieu(); } }