void Duyet()
        {
            if (!tlbApprove.IsEnabled)
            {
                return;
            }
            Cursor = Cursors.Wait;
            List <int>       lstID       = new List <int>();
            UtilitiesProcess process     = new UtilitiesProcess();
            bool             retLockData = false;

            try
            {
                if (raddgrHDTDDS.SelectedItems.Count > 0)
                {
                    if (LMessage.ShowMessage("M.DungChung.HoiDuyet", LMessage.MessageBoxType.Question) == MessageBoxResult.Yes)
                    {
                        TinDungTDProcess            tindungProcess       = new TinDungTDProcess();
                        List <ClientResponseDetail> ClientResponseDetail = new List <Presentation.Process.Common.ClientResponseDetail>();
                        List <TD_KIEM_SOAT_RR>      lstKiemSoat          = new List <TD_KIEM_SOAT_RR>();

                        lstKiemSoat = LayListGiaTriObject();
                        lstID       = lstKiemSoat.Select(e => e.ID).ToList();

                        // Yêu cầu lock dữ liệu
                        retLockData = process.UnlockData(DatabaseConstant.Module.TDTD,
                                                         DatabaseConstant.Function.TDTD_KIEM_SOAT_RR,
                                                         DatabaseConstant.Table.TD_KIEM_SOAT_RR,
                                                         DatabaseConstant.Action.DUYET,
                                                         lstID);

                        int iret = tindungProcess.KiemSoatRuiRo(DatabaseConstant.Action.DUYET, ref lstKiemSoat, ref ClientResponseDetail);
                        if (iret > 0)
                        {
                            LMessage.ShowMessage("M.DungChung.DuyetThanhCong", LMessage.MessageBoxType.Information);
                        }
                        else
                        {
                            CommonFunction.ThongBaoKetQua(ClientResponseDetail);
                        }
                        LoadData();
                    }
                }
            }
            catch (Exception ex)
            {
                LMessage.ShowMessage("M.DungChung.LoiChung", LMessage.MessageBoxType.Error);
                LLogging.WriteLog(ex.TargetSite.Name, LLogging.LogType.ERR, ex);
            }
            finally
            {
                // Yêu cầu Unlock dữ liệu
                retLockData = process.UnlockData(DatabaseConstant.Module.TDTD,
                                                 DatabaseConstant.Function.TDTD_KIEM_SOAT_RR,
                                                 DatabaseConstant.Table.TD_KIEM_SOAT_RR,
                                                 DatabaseConstant.Action.DUYET,
                                                 lstID);
                Cursor = Cursors.Arrow;
            }
        }
 void TinhLaiTatToanTruocHan()
 {
     try
     {
         TDTD_THONG_TIN_THU_NO objTinThuNo = lstThongTinThuNo.FirstOrDefault(f => f.GOC_KH > 0 || f.LAI_KH > 0);
         if (objTinThuNo.IsNullOrEmpty())
         {
             int iret = 0;
             List <ClientResponseDetail> ResponseDetail = new List <ClientResponseDetail>();
             obj.NGUOI_CNHAT = ClientInformation.TenDangNhap;
             obj.NGAY_CNHAT  = ClientInformation.NgayLamViecHienTai;
             List <TDTD_THONG_TIN_THU_NO> lstThongTinKH = new List <TDTD_THONG_TIN_THU_NO>();
             lstThongTinKH.AddRange(lstThongTinThuNo);
             lstThongTinKH.AddRange(lstThongTinThuNoTTruoc);
             obj.DSACH_THU_NO              = lstThongTinKH.ToArray();
             iret                          = new TinDungTDProcess().ThuGocLaiVay(DatabaseConstant.Action.TINH_TOAN_LICH_TRA_NO, ref obj, ref ResponseDetail);
             lstThongTinThuNo              = obj.DSACH_THU_NO.Where(f => f.NGAY_KH.CompareTo(ClientInformation.NgayLamViecHienTai) <= 0).ToList();
             lstThongTinThuNoTTruoc        = obj.DSACH_THU_NO.Where(f => f.NGAY_KH.CompareTo(ClientInformation.NgayLamViecHienTai) > 0).ToList();
             grdGocLaiTraTruoc.ItemsSource = lstThongTinThuNoTTruoc;
             grdGocLaiTraTruoc.Rebind();
         }
     }
     catch (Exception ex)
     {
         LLogging.WriteLog(ex.TargetSite.Name, LLogging.LogType.ERR, ex);
     }
 }
        private void Duyet()
        {
            if (!tlbApprove.IsEnabled)
            {
                return;
            }
            Cursor = Cursors.Wait;
            List <int>       lstID       = new List <int>();
            UtilitiesProcess process     = new UtilitiesProcess();
            bool             retLockData = false;

            try
            {
                if (raddgrSanPham.SelectedItems.Count > 0)
                {
                    if (LMessage.ShowMessage("M.DungChung.HoiDuyet", LMessage.MessageBoxType.Question) == MessageBoxResult.Yes)
                    {
                        TinDungTDProcess            tindungProcess       = new TinDungTDProcess();
                        List <ClientResponseDetail> ClientResponseDetail = new List <Presentation.Process.Common.ClientResponseDetail>();
                        List <TDTD_SAN_PHAM>        lstSanPham           = new List <TDTD_SAN_PHAM>();
                        List <KT_PHAN_HE_PLOAI>     lstPhanHePloai       = new List <KT_PHAN_HE_PLOAI>();

                        foreach (DataRowView dr in raddgrSanPham.SelectedItems)
                        {
                            TDTD_SAN_PHAM objSP = new TDTD_SAN_PHAM();
                            objSP.ID = Convert.ToInt32(dr["ID"]);
                            lstSanPham.Add(objSP);
                            lstID.Add(objSP.ID);
                        }

                        // Yêu cầu lock dữ liệu
                        retLockData = process.UnlockData(DatabaseConstant.Module.TDTD,
                                                         DatabaseConstant.Function.TDTD_SAN_PHAM,
                                                         DatabaseConstant.Table.TDTD_SAN_PHAM,
                                                         DatabaseConstant.Action.DUYET,
                                                         lstID);

                        int iret = tindungProcess.SanPhamTinDung(DatabaseConstant.Action.DUYET, ref lstSanPham, ref lstPhanHePloai, ref ClientResponseDetail);
                        CommonFunction.ThongBaoKetQua(ClientResponseDetail);
                    }
                }
            }
            catch (Exception ex)
            {
                LMessage.ShowMessage("M.DungChung.LoiChung", LMessage.MessageBoxType.Error);
                LLogging.WriteLog(ex.TargetSite.Name, LLogging.LogType.ERR, ex);
            }
            finally
            {
                // Yêu cầu Unlock dữ liệu
                retLockData = process.UnlockData(DatabaseConstant.Module.TDTD,
                                                 DatabaseConstant.Function.TDTD_DON_XIN_VAY_VON,
                                                 DatabaseConstant.Table.TDTD_HDTD,
                                                 DatabaseConstant.Action.DUYET,
                                                 lstID);
                Cursor = Cursors.Arrow;
            }
        }
 private void LayDSHopDongKheUoc(int idKhachHang)
 {
     try
     {
         DataSet          dsHopDongKheUoc = new DataSet();
         TinDungTDProcess tdProcess       = new TinDungTDProcess();
         dsHopDongKheUoc = tdProcess.getDanhSachKUOCTheoKH(idKhachHang);
         if (dsHopDongKheUoc == null)
         {
             return;
         }
         raddgrThongTinDon.ItemsSource = dsHopDongKheUoc.Tables[0].DefaultView;
         raddgrThongTinDon.Rebind();
     }
     catch (Exception ex)
     {
         LLogging.WriteLog(ex.TargetSite.Name, LLogging.LogType.ERR, ex);
     }
 }
 private void LayDSDonVayVon(int idKhachHang)
 {
     try
     {
         DataSet          dsDonVayVon = new DataSet();
         TinDungTDProcess tdProcess   = new TinDungTDProcess();
         dsDonVayVon = tdProcess.LayDSDonVayVonBIDV(idKhachHang);
         if (dsDonVayVon == null)
         {
             return;
         }
         //raddgrThongTinDon.DataContext = dsDonVayVon.Tables[0].DefaultView;
         raddgrThongTinDon.ItemsSource = dsDonVayVon.Tables[0].DefaultView;
         raddgrThongTinDon.Rebind();
     }
     catch (Exception ex)
     {
         LLogging.WriteLog(ex.TargetSite.Name, LLogging.LogType.ERR, ex);
     }
 }
        private void LoadDataPhanTrang()
        {
            Cursor = Cursors.Wait;
            try
            {
                DataTable dt = null;
                LDatatable.MakeParameterTable(ref dt);
                string loaiTien       = "";
                string loaiVay        = "";
                string ngayHieuLucTu  = "";
                string ngayHieuLucDen = "";
                string TThaiNVu       = ucTrangThaiNVu.GetItemsSelected();

                if (tvwKhuVuc.SelectedItem == null)
                {
                    tvwKhuVuc.SelectedItem = tvwKhuVuc.Items[0];
                }

                string ListKVuc = "";
                if (((RadTreeViewItem)tvwKhuVuc.SelectedItem).Tag.ToString().Substring(0, 3).Equals("DVI"))
                {
                    RadTreeViewItem itemDVI = (RadTreeViewItem)tvwKhuVuc.SelectedItem;
                    foreach (RadTreeViewItem item in itemDVI.Items)
                    {
                        if (item.Tag.ToString().Substring(0, 3).Equals("CNH"))
                        {
                            ListKVuc += ",''" + item.Tag.ToString() + "''";
                        }
                    }
                    ListKVuc = ListKVuc.Substring(3);
                    ListKVuc = ListKVuc.Substring(0, ListKVuc.Length - 2);
                }
                else
                {
                    ListKVuc = ((RadTreeViewItem)tvwKhuVuc.SelectedItem).Tag.ToString();
                }

                if (cmbLoaiVay.SelectedIndex != -1)
                {
                    loaiVay = lstSourceThoiHanVay.ElementAt(cmbLoaiVay.SelectedIndex).KeywordStrings.FirstOrDefault();
                }

                if (cmbLoaiTien.SelectedIndex != -1)
                {
                    loaiTien = lstSourceLoaiTien.ElementAt(cmbLoaiTien.SelectedIndex).KeywordStrings.FirstOrDefault();
                }

                if (dtNgayHieuLucTu.Value != null)
                {
                    ngayHieuLucTu = dtNgayHieuLucTu.Value.Value.ToString("yyyyMMdd");
                }

                if (dtNgayHieuLucDen.Value != null)
                {
                    ngayHieuLucDen = dtNgayHieuLucDen.Value.Value.ToString("yyyyMMdd");
                }

                // Phân trang
                int StartRow       = 1;
                int EndRow         = ClientInformation.SoLuongBanGhi;
                int CurrentPagging = 1;
                int PaggingSize    = ClientInformation.SoLuongBanGhi;

                LDatatable.AddParameter(ref dt, "@INP_MA_TRANG_THAI_NGHIEP_VU", "String", TThaiNVu);
                LDatatable.AddParameter(ref dt, "@INP_MA_SAN_PHAM", "String", txtMaSanPham.Text.Trim());
                LDatatable.AddParameter(ref dt, "@INP_TEN_SAN_PHAM", "String", txtTenSanPham.Text.Trim());
                LDatatable.AddParameter(ref dt, "@INP_LOAI_TIEN", "String", loaiTien);
                LDatatable.AddParameter(ref dt, "@INP_LOAI_VAY", "String", loaiVay);
                LDatatable.AddParameter(ref dt, "@INP_NGAY_HL_DEN", "String", ngayHieuLucDen);
                LDatatable.AddParameter(ref dt, "@INP_NGAY_HL_TU", "String", ngayHieuLucTu);
                LDatatable.AddParameter(ref dt, "@INP_SO_TIEN_VAY_TU", "Decimal", numSoTienVayTu.Value.Value.ToString());
                LDatatable.AddParameter(ref dt, "@INP_SO_TIEN_VAY_DEN", "Decimal", numSoTienVayDen.Value.Value.ToString());
                LDatatable.AddParameter(ref dt, "@INP_KHUVUC", "String", ListKVuc);
                LDatatable.AddParameter(ref dt, "@INP_USERNAME", "String", ClientInformation.TenDangNhap);
                LDatatable.AddParameter(ref dt, "@MA_DVI_QLY", "String", ClientInformation.MaDonViQuanLy);
                LDatatable.AddParameter(ref dt, "@INP_START_ROW", "String", StartRow.ToString());
                LDatatable.AddParameter(ref dt, "@INP_END_ROW", "String", EndRow.ToString());

                DataSet ds = new TinDungTDProcess().GetDSSanPhamTinDungTieuDung(dt);

                if (ds != null && ds.Tables.Count > 0)
                {
                    foreach (DataRow dr in ds.Tables[0].Rows)
                    {
                        dr["TRANG_THAI_NVU"] = LLanguage.SearchResourceByKey(dr["TRANG_THAI_NVU"].ToString());
                        dr["LOAI_SAN_PHAM"]  = LLanguage.SearchResourceByKey(dr["LOAI_SAN_PHAM"].ToString());
                        dr["LOAI_VAY"]       = LLanguage.SearchResourceByKey(dr["LOAI_VAY"].ToString());
                    }

                    DataTable serverDataTable = ds.Tables[0];
                    int       totalRecord     = Int32.Parse(ds.Tables[1].Rows[0][0].ToString());
                    DataTable clientDataTable = CommonFunction.BuildClientDataTable(serverDataTable, CurrentPagging, PaggingSize, totalRecord);

                    //raddgrSanPham.ItemsSource = ds.Tables["DANH_SACH"].DefaultView;
                    raddgrSanPham.ItemsSource = clientDataTable.DefaultView;
                    if (!LObject.IsNullOrEmpty(raddgrSanPham.SelectedItems))
                    {
                        raddgrSanPham.SelectedItems.Clear();
                    }
                    lblSumKhachHang.Content = totalRecord.ToString();
                }
            }
            catch (Exception ex)
            {
            }
            Cursor = Cursors.Arrow;
        }
        void LoadDataPhanTrang()
        {
            Cursor = Cursors.Wait;
            //AutoCompleteEntry auLoaiSanPham = lstSourceLoaiSPham.ElementAt(cmbLoaiSanPham.SelectedIndex);
            string ngayKiemSoatTu  = "";
            string ngayKiemSoatDen = "";

            DataTable dt = null;

            LDatatable.MakeParameterTable(ref dt);
            string TThaiNVu = ucTrangThaiNVu.GetItemsSelected();

            if (tvwKhuVuc.SelectedItem == null)
            {
                tvwKhuVuc.SelectedItem = tvwKhuVuc.Items[0];
            }
            string ListKVuc = "";

            if (((RadTreeViewItem)tvwKhuVuc.SelectedItem).Tag.ToString().Substring(0, 3).Equals("DVI"))
            {
                RadTreeViewItem itemDVI = (RadTreeViewItem)tvwKhuVuc.SelectedItem;
                foreach (RadTreeViewItem item in itemDVI.Items)
                {
                    if (item.Tag.ToString().Substring(0, 3).Equals("CNH"))
                    {
                        ListKVuc += ",''" + item.Tag.ToString() + "''";
                    }
                }
                ListKVuc = ListKVuc.Substring(3);
                ListKVuc = ListKVuc.Substring(0, ListKVuc.Length - 2);
            }
            else
            {
                ListKVuc = ((RadTreeViewItem)tvwKhuVuc.SelectedItem).Tag.ToString();
            }

            LDatatable.AddParameter(ref dt, "@INP_MA_TRANG_THAI_NGHIEP_VU", "String", TThaiNVu);
            LDatatable.AddParameter(ref dt, "@INP_MA_PHIEU_KIEM_SOAT", "String", txtSoPhieuKiemSoat.Text.Trim());
            LDatatable.AddParameter(ref dt, "@INP_NGAY_KIEM_SOAT_TU", "String", ngayKiemSoatTu);
            LDatatable.AddParameter(ref dt, "@INP_NGAY_KIEM_SOAT_DEN", "String", ngayKiemSoatDen);
            LDatatable.AddParameter(ref dt, "@INP_SO_KHE_UOC", "String", txtSoKheUoc.Text.Trim());
            LDatatable.AddParameter(ref dt, "@INP_SO_HDTD", "String", txtSoHDTD.Text.Trim());
            LDatatable.AddParameter(ref dt, "@INP_MA_KHACH_HANG", "String", txtMaKhachHang.Text.Trim());
            LDatatable.AddParameter(ref dt, "@INP_TEN_KHACH_HANG", "String", txtTenKhachHang.Text.Trim());
            LDatatable.AddParameter(ref dt, "@INP_KHUVUC", "String", ListKVuc);
            LDatatable.AddParameter(ref dt, "@INP_USERNAME", "String", ClientInformation.TenDangNhap);
            LDatatable.AddParameter(ref dt, "@MA_DVI_QLY", "String", ClientInformation.MaDonViQuanLy);
            LDatatable.AddParameter(ref dt, "@INP_START_ROW", "String", StartRow.ToString());
            LDatatable.AddParameter(ref dt, "@INP_END_ROW", "String", EndRow.ToString());

            DataSet ds = new TinDungTDProcess().GetDanhSachKiemSoatRuiRo(dt);

            if (ds != null && ds.Tables.Count > 0 && ds.Tables[0] != null)
            {
                DataTable serverDataTable = ds.Tables[0];
                foreach (DataRow dr in serverDataTable.Rows)
                {
                    dr["TTHAI_NVU_TEN"] = BusinessConstant.layNgonNguNghiepVu(dr["TTHAI_NVU_TEN"].ToString());
                }

                int       totalRecord     = Int32.Parse(ds.Tables[1].Rows[0][0].ToString());
                DataTable clientDataTable = CommonFunction.BuildClientDataTable(serverDataTable, CurrentPagging, PaggingSize, totalRecord);

                //raddgrHDTDDS.ItemsSource = ds.Tables["DANH_SACH"].DefaultView;
                raddgrHDTDDS.ItemsSource = clientDataTable.DefaultView;
                if (!LObject.IsNullOrEmpty(raddgrHDTDDS.SelectedItems))
                {
                    raddgrHDTDDS.SelectedItems.Clear();
                }
                lblSumKhachHang.Content = totalRecord.ToString();
            }
            Cursor = Cursors.Arrow;
        }