public void OnApprove()
 {
     Mouse.OverrideCursor = Cursors.Wait;
     try
     {
         TaiSanDamBaoProcess         processTSDB = new TaiSanDamBaoProcess();
         List <ClientResponseDetail> listClientResponseDetail = new List <ClientResponseDetail>();
         bool ret = false;
         action = DatabaseConstant.Action.DUYET;
         ret    = LockData();
         List <int> lst = new List <int>();
         objHDTC         = new TDTD_HOP_DONG_TCHAP();
         objHDTC.ID      = idHDTC;
         objHDTC.MA_HDTC = maHDTC;
         lst.Add(idHDTC);
         objHDTC.DSACH_ID_XOA = lst.ToArray();
         if (ret)
         {
             ret = processTSDB.HopDongTheChapTDTD(action, ref objHDTC, ref listClientResponseDetail);
         }
         AfterApprove(ret, listClientResponseDetail);
     }
     catch (Exception ex)
     {
         LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex);
         throw ex;
     }
     finally
     {
         Mouse.OverrideCursor = Cursors.Arrow;
     }
 }
        void LoadDuLieu()
        {
            try
            {
                string sMaTrangThaiNVu = ucTrangThaiNVu.GetItemsSelected();
                if (sMaTrangThaiNVu.Equals("NULL"))
                {
                    sMaTrangThaiNVu = "(''CDU'',''DDU'',''TCD'',''THD'')";
                }
                #region Điều kiện tìm kiếm
                RadTreeViewItem item = tvwTaiSan.SelectedItem as RadTreeViewItem;
                if (item == null)
                {
                    Mouse.OverrideCursor = Cursors.Arrow;
                    return;
                }
                string loaiDonVi = item.Uid.ToString();
                string maDonVi   = item.Tag.ToString();
                #endregion

                // Phân trang
                int       StartRow       = 1;
                int       EndRow         = ClientInformation.SoLuongBanGhi;
                int       CurrentPagging = 1;
                int       PaggingSize    = ClientInformation.SoLuongBanGhi;
                DataTable dt             = null;
                LDatatable.MakeParameterTable(ref dt);
                LDatatable.AddParameter(ref dt, "@INP_MA_TRANG_THAI_NGHIEP_VU", "string", sMaTrangThaiNVu);
                LDatatable.AddParameter(ref dt, "@INP_SO_HDTC", "string", txtSoHD.Text);
                LDatatable.AddParameter(ref dt, "@INP_MA_KHANG", "string", txtMaKH.Text);
                LDatatable.AddParameter(ref dt, "@INP_TEN_KHANG", "string", txtTenKH.Text);
                LDatatable.AddParameter(ref dt, "@INP_NGAY_HOP_DONG", "string", raddtNgayHopDong.Value == null? "":raddtNgayHopDong.Value.Value.ToString("yyyyMMdd"));
                LDatatable.AddParameter(ref dt, "@INP_USER", "string", ClientInformation.TenDangNhap);
                LDatatable.AddParameter(ref dt, "@MA_DVI_QLY", "string", ClientInformation.MaDonViQuanLy);
                LDatatable.AddParameter(ref dt, "@MA_NNGU", "string", ClientInformation.NgonNgu);
                LDatatable.AddParameter(ref dt, "@StartRow", "string", StartRow.ToString());
                LDatatable.AddParameter(ref dt, "@EndRow", "string", EndRow.ToString());
                DataSet ds = new TaiSanDamBaoProcess().GetDanhSachHopDongTheChapTDTD(dt);

                if (ds != null && ds.Tables.Count > 0)
                {
                    grDSTaiSan.DataContext = ds.Tables[0].DefaultView;
                }
                else
                {
                    grDSTaiSan.Items.Clear();
                }
            }
            catch (System.Exception ex)
            {
                LMessage.ShowMessage("M.DungChung.LoiChung", LMessage.MessageBoxType.Error);
                LLogging.WriteLog(ex.TargetSite.Name, LLogging.LogType.ERR, ex);
            }
            finally
            {
                Cursor = Cursors.Arrow;
            }
        }
        private void SetFormData()
        {
            Mouse.OverrideCursor = Cursors.Wait;
            //lstTSDB = new List<TDTD_TAI_SAN_DAM_BAO>();
            try
            {
                DataTable dt = null;
                LDatatable.MakeParameterTable(ref dt);
                LDatatable.AddParameter(ref dt, "@INP_IDHDTC", "string", idHDTC.ToString());
                DataSet ds = new TaiSanDamBaoProcess().GetHopDongTheChapTDTD(dt);
                if (!ds.IsNullOrEmpty() && ds.Tables.Count > 1)
                {
                    dt = ds.Tables[0];

                    idHDTC               = Convert.ToInt32(dt.Rows[0]["ID"]);
                    txtSoHopDong.Text    = dt.Rows[0]["MA_HDTC"].ToString();
                    txtMaKH.Text         = dt.Rows[0]["MA_KHANG"].ToString();
                    lblTTinKHang.Content = dt.Rows[0]["TEN_KHANG"].ToString();
                    teldtNgayCNhat.Value = LDateTime.StringToDate(dt.Rows[0]["NGAY_HDTC"].ToString(), ApplicationConstant.defaultDateTimeFormat);
                    txtDienGiai.Text     = dt.Rows[0]["DIEN_GIAI"].ToString();
                    tThai_NVu            = dt.Rows[0]["TTHAI_NVU"].ToString();
                    lblTrangThai.Content = BusinessConstant.layNgonNguNghiepVu(tThai_NVu);
                    maDviQLy             = dt.Rows[0]["MA_DVI_QLY"].ToString();
                    maDViTao             = dt.Rows[0]["MA_DVI_TAO"].ToString();
                    txtNguoiLap.Text     = dt.Rows[0]["NGUOI_NHAP"].ToString();
                    if (dt.Rows[0]["NGUOI_CNHAT"] != DBNull.Value)
                    {
                        txtNguoiCapNhat.Text = dt.Rows[0]["NGUOI_CNHAT"].ToString();
                    }
                    teldtNgayNhap.Value = LDateTime.StringToDate(dt.Rows[0]["NGAY_NHAP"].ToString(), ApplicationConstant.defaultDateTimeFormat);
                    if (dt.Rows[0]["NGAY_CNHAT"] != DBNull.Value)
                    {
                        teldtNgayCNhat.Value = LDateTime.StringToDate(dt.Rows[0]["NGAY_CNHAT"].ToString(), ApplicationConstant.defaultDateTimeFormat);
                    }
                    txtTrangThai.Text = BusinessConstant.layNgonNguSuDung(dt.Rows[0]["TTHAI_BGHI"].ToString());
                    dt = ds.Tables[1];

                    lstTSDB = dt.Rows.OfType <DataRow>().ToList();

                    raddgrDSachTSDB.ItemsSource = null;
                    raddgrDSachTSDB.ItemsSource = lstTSDB;

                    SetGtriTong(lstTSDB);
                }
            }
            catch (Exception ex)
            {
                LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex);
                throw ex;
            }
            finally
            {
                Mouse.OverrideCursor = Cursors.Arrow;
            }
        }
Exemple #4
0
        void LoadDuLieu()
        {
            TaiSanDamBaoProcess tsdbProcess = new TaiSanDamBaoProcess();

            this.Cursor = Cursors.Wait;
            try
            {
                string slstDonVi = "NULL";
                if (lstDonVi.Count > 0)
                {
                    slstDonVi = "";
                    foreach (string sDonVi in lstDonVi)
                    {
                        slstDonVi += ",''" + sDonVi + "''";
                    }
                    slstDonVi = slstDonVi.Substring(1);
                }
                string TThaiNvu = ucTrangThaiNVu.GetItemsSelected();
                string SoHDTC   = txtSoHDTD.Text;
                string NgayHDTu = teldtNgayHopDongTu.Value != null?LDateTime.DateToString((DateTime)teldtNgayHopDongTu.Value, ApplicationConstant.defaultDateTimeFormat) : "";

                string NgayHDDen = teldtNgayHopDongDen.Value != null?LDateTime.DateToString((DateTime)teldtNgayHopDongDen.Value, ApplicationConstant.defaultDateTimeFormat) : "";

                string MaTS       = txtMaTaiSan.Text;
                string TenTS      = txtTenTaiSan.Text;
                string TongGTriTu = txtGiaTriTu.Value != null?txtGiaTriTu.Value.ToString() : "0";

                string TongGTriDen = txtGiaTriDen.Value != null?txtGiaTriDen.Value.ToString() : "0";

                string  MaKHang    = txtMaKhachHang.Text;
                string  TenKHang   = txtTenKhachHang.Text;
                string  LoaiGiayTo = lstLoaiGTo.ElementAt(cmbLoaiGiayTo.SelectedIndex).KeywordStrings.FirstOrDefault();
                string  SoGiayTo   = txtSoGiayTo.Text;
                string  DienThoai  = txtDienThoai.Text;
                string  Email      = txtEmail.Text;
                DataSet ds         = tsdbProcess.getDanhSachHopDongTC(TThaiNvu, SoHDTC, NgayHDTu, NgayHDDen, MaTS, TenTS, TongGTriTu, TongGTriDen, MaKHang, TenKHang, LoaiGiayTo, SoGiayTo, DienThoai, Email, slstDonVi);
                if (ds != null)
                {
                    raddgrHopDongTheChapDS.ItemsSource = null;
                    raddgrHopDongTheChapDS.ItemsSource = ds.Tables[0];
                }
            }
            catch (Exception ex)
            {
                LLogging.WriteLog(ex.TargetSite.Name, LLogging.LogType.ERR, ex);
                LMessage.ShowMessage("M.DungChung.LoiChung", LMessage.MessageBoxType.Error);
            }
            finally
            {
                tsdbProcess = null;
                this.Cursor = Cursors.Arrow;
            }
        }
        void LoadDuLieuPhanTrang()
        {
            try
            {
                string sMaTrangThaiNVu = ucTrangThaiNVu.GetItemsSelected();
                #region Điều kiện tìm kiếm
                RadTreeViewItem item      = tvwTaiSan.SelectedItem as RadTreeViewItem;
                string          loaiDonVi = item.Uid.ToString();
                string          maDonVi   = item.Tag.ToString();
                #endregion

                // Phân trang
                DataTable dt = null;
                LDatatable.MakeParameterTable(ref dt);
                LDatatable.AddParameter(ref dt, "@INP_MA_TRANG_THAI_NGHIEP_VU", "string", sMaTrangThaiNVu);
                LDatatable.AddParameter(ref dt, "@INP_SO_HDTC", "string", txtSoHD.Text);
                LDatatable.AddParameter(ref dt, "@INP_MA_KHANG", "string", txtMaKH.Text);
                LDatatable.AddParameter(ref dt, "@INP_TEN_KHANG", "string", txtTenKH.Text);
                LDatatable.AddParameter(ref dt, "@INP_USER", "string", ClientInformation.TenDangNhap);
                LDatatable.AddParameter(ref dt, "@MA_DVI_QLY", "string", ClientInformation.MaDonViQuanLy);
                LDatatable.AddParameter(ref dt, "@StartRow", "string", StartRow.ToString());
                LDatatable.AddParameter(ref dt, "@EndRow", "string", EndRow.ToString());
                DataSet ds = new TaiSanDamBaoProcess().GetDanhSachHopDongTheChap(dt);

                if (ds != null && ds.Tables.Count > 0)
                {
                    DataTable serverDataTable = ds.Tables[0];
                    int       totalRecord     = Int32.Parse(ds.Tables[1].Rows[0][0].ToString());
                    decimal   totalSum        = Decimal.Parse(ds.Tables[2].Rows[0][0].ToString());
                    DataTable clientDataTable = CommonFunction.BuildClientDataTable(serverDataTable, CurrentPagging, PaggingSize, totalRecord);

                    //grdKheUocDS.ItemsSource = ds.Tables["DANH_SACH"].DefaultView;
                    grDSTaiSan.ItemsSource = clientDataTable.DefaultView;
                    grDSTaiSan.SelectedItems.Clear();
                    lblSumKhachHang.Content = totalRecord.ToString();
                    lblSumDuNo.Content      = totalSum.ToString("N0");
                }
            }
            catch (System.Exception ex)
            {
                LMessage.ShowMessage("M.DungChung.LoiChung", LMessage.MessageBoxType.Error);
                LLogging.WriteLog(ex.TargetSite.Name, LLogging.LogType.ERR, ex);
            }
            finally
            {
                Cursor = Cursors.Arrow;
            }
        }
        public void OnSave()
        {
            if (!Validation())
            {
                return;
            }
            GetFormData(ref objHDTC, BusinessConstant.layTrangThaiNghiepVu(tThai_NVu));
            TaiSanDamBaoProcess         processTSDB = new TaiSanDamBaoProcess();
            List <ClientResponseDetail> listClientResponseDetail = new List <ClientResponseDetail>();
            bool ret = false;

            if (idHDTC == 0)
            {
                ret = processTSDB.HopDongTheChapTDTD(DatabaseConstant.Action.THEM, ref objHDTC, ref listClientResponseDetail);
            }
            else
            {
                ret = processTSDB.HopDongTheChapTDTD(DatabaseConstant.Action.SUA, ref objHDTC, ref listClientResponseDetail);
            }
            AfterSave(ret, listClientResponseDetail);
        }