private void LoadDuLieu()
 {
     Cursor = Cursors.Wait;
     try
     {
         TinDungProcess tindungProcess = new TinDungProcess();
         maDonVi = lstSourceDonVi.ElementAt(cmbDonVi.SelectedIndex).KeywordStrings.ElementAt(0);
         string MaTTNVu             = ucCheckBoxList.GetItemsSelected();
         string MaLoaiSP            = lstLoaiSanPham.ElementAt(cmbLoaiSanPham.SelectedIndex).KeywordStrings.FirstOrDefault();
         string MaTinhTrangHLuc     = lstHieuLuc.ElementAt(cmbTinhTrang.SelectedIndex).KeywordStrings.FirstOrDefault();
         string MaMucDichVay        = lstMucDichSuDung.ElementAt(cmbMucDich.SelectedIndex).KeywordStrings.FirstOrDefault();
         string MaNguonVon          = lstNguonVon.ElementAt(cmbLoaiVay.SelectedIndex).KeywordStrings.FirstOrDefault();
         string MaPhuongThucTinhLai = lstPhuongThucTinhLai.ElementAt(cmbPhuongThucTinhLai.SelectedIndex).KeywordStrings.FirstOrDefault();
         string MaLoaiLSuat         = lstLoaiLaiSuat.ElementAt(cmbLoaiLaiSuat.SelectedIndex).KeywordStrings.FirstOrDefault();
         string MaSanPham           = txtMaSanPham.Text;
         string TenSanPham          = txtTenSanPham.Text;
         string NgayADungTu         = "";
         if (teldtNgayADungTu.Value != null)
         {
             NgayADungTu = LDateTime.DateToString((DateTime)teldtNgayADungTu.Value, ApplicationConstant.defaultDateTimeFormat);
         }
         string NgayADungDen = "";
         if (teldtNgayADungDen.Value != null)
         {
             NgayADungDen = LDateTime.DateToString((DateTime)teldtNgayADungDen.Value, ApplicationConstant.defaultDateTimeFormat);
         }
         string NgayHetHanTu = "";
         if (teldtNgayHetHanTu.Value != null)
         {
             NgayHetHanTu = LDateTime.DateToString((DateTime)teldtNgayHetHanTu.Value, ApplicationConstant.defaultDateTimeFormat);
         }
         string NgayHetHanDen = "";
         if (teldtNgayHetHanDen.Value != null)
         {
             NgayHetHanDen = LDateTime.DateToString((DateTime)teldtNgayHetHanDen.Value, ApplicationConstant.defaultDateTimeFormat);
         }
         string ListPThucVay = "";
         foreach (RadTreeViewItem item in tvwLoaiVay.CheckedItems)
         {
             ListPThucVay += ",''" + item.Tag.ToString() + "''";
         }
         if (ListPThucVay.Length > 0)
         {
             ListPThucVay = "(" + ListPThucVay.Substring(1) + ")";
         }
         string UserName = "";
         grdDangKySanPhamDS.ItemsSource = tindungProcess.getDanhSachSanPhamTinDung(MaTTNVu, MaLoaiSP, MaTinhTrangHLuc, MaMucDichVay, MaNguonVon, MaPhuongThucTinhLai, MaLoaiLSuat, MaSanPham, TenSanPham, NgayADungTu, NgayADungDen, NgayHetHanTu, NgayHetHanDen, ListPThucVay, UserName, maDonVi).Tables["DANH_SACH"].DefaultView;
         if (!LObject.IsNullOrEmpty(grdDangKySanPhamDS.SelectedItems))
         {
             grdDangKySanPhamDS.SelectedItems.Clear();
         }
     }
     catch (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 Luu()
        {
            //Mouse.OverrideCursor = Cursors.Wait;
            try
            {
                string loaiDoiTuong = null;
                int    idDoiTuong   = 0;
                string maDoiTuong   = null;
                string maDonVi      = null;
                loaiDoiTuong = lstSourceLoaiDTuong.ElementAt(cmbDoiTuong.SelectedIndex).KeywordStrings.First();
                DataRow dr = (DataRow)grDSDoiTuong.SelectedItem;
                if (dr != null)
                {
                    idDoiTuong = int.Parse(dr["ID"].ToString());
                    maDoiTuong = dr[2].ToString();
                    maDonVi    = dr[5].ToString();
                }
                else
                {
                    LMessage.ShowMessage("Choose object for role setting", LMessage.MessageBoxType.Warning);
                    return;
                }

                // Khởi tạo biến ArrayList để chứa nội dung cập nhật phân quyền
                ArrayList lstCheckBox = new ArrayList();

                // Đọc dữ liệu trên lưới đưa vào dữ liệu cập nhật
                foreach (int id in dsTNangAll.Select(e => e.ID))
                {
                    // Nếu là phân quyền tính năng,
                    // ngoài việc khởi tạo List thì gán ID tính năng vào item đầu tiên của List
                    List <string> lstItem = new List <string>();
                    lstItem.Add(id.ToString());
                    lstCheckBox.Add(lstItem);
                }
                foreach (DataRow r in dt.Rows)
                {
                    // Lấy vị trí của fullcontrol
                    int fullControllPos = 3 + dsTNangAll.Count - 1;

                    if ((bool)r[fullControllPos] == true)
                    {
                        ((List <string>)lstCheckBox[dsTNangAll.Count - 1]).Add(r[1].ToString());
                    }
                    else
                    {
                        for (int i = 0; i < dsTNangAll.Count; i++)
                        {
                            if (r[i + 3] != null && r[i + 3].ToString() != "")
                            {
                                if ((bool)r[i + 3] == true)
                                {
                                    ((List <string>)lstCheckBox[i]).Add(r[1].ToString());
                                }
                            }
                        }
                    }
                }

                if (lstCheckBox != null)
                {
                    // Tìm các thông tin CNangTNang được check cho phân quyền
                    List <HT_CNANG_TNANG> dsCNangTNangCheckBox = new List <HT_CNANG_TNANG>();
                    foreach (HT_CNANG_TNANG item in dsCNangTNangAll)
                    {
                        for (int i = 0; i < dsTNangAll.Count; i++)
                        {
                            List <string> listCNangByTNang = (List <string>)lstCheckBox[i];
                            for (int j = 0; j < listCNangByTNang.Count; j++)
                            {
                                if (listCNangByTNang[j].Equals(item.MA_CNANG) && item.ID_TNANG == dsTNangAll[i].ID)
                                {
                                    dsCNangTNangCheckBox.Add(item);
                                }
                            }
                        }
                    }
                    // Tìm các thông tin được thêm và xóa
                    List <HT_CNANG_TNANG>  dsCNangTNangThem         = new List <HT_CNANG_TNANG>();
                    List <HT_CNANG_PQUYEN> dsCNangPQuyenXoa         = new List <HT_CNANG_PQUYEN>();
                    List <int>             lstIdCNangPQuyenDoiTuong = dsCNangPQuyenDoiTuong.Select(e => e.ID_CNANG_TNANG.Value).ToList();
                    List <int>             lstIdCNangTNangCheckBox  = dsCNangTNangCheckBox.Select(e => e.ID).ToList();
                    foreach (HT_CNANG_TNANG item in dsCNangTNangCheckBox)
                    {
                        if (!lstIdCNangPQuyenDoiTuong.Contains(item.ID))
                        {
                            dsCNangTNangThem.Add(item);
                        }
                    }
                    foreach (HT_CNANG_PQUYEN item in dsCNangPQuyenDoiTuong)
                    {
                        if (!lstIdCNangTNangCheckBox.Contains(item.ID_CNANG_TNANG.Value))
                        {
                            dsCNangPQuyenXoa.Add(item);
                        }
                    }

                    if ((dsCNangTNangThem != null &&
                         dsCNangTNangThem.Count > 0) ||
                        (dsCNangPQuyenXoa != null &&
                         dsCNangPQuyenXoa.Count > 0))
                    {
                        // Thực hiện lưu phân quyền
                        bool ret = qtht.luuPhanQuyenChucNang(
                            loaiDoiTuong,
                            idDoiTuong,
                            maDoiTuong,
                            maDonVi,
                            dsCNangPQuyenXoa,
                            dsCNangTNangThem);
                        if (ret)
                        {
                            LMessage.ShowMessage("M.DungChung.LuuDuLieuThanhCong", LMessage.MessageBoxType.Information);
                        }
                        else
                        {
                            LMessage.ShowMessage("M.DungChung.LuuDuLieuKhongThanhCong", LMessage.MessageBoxType.Warning);
                        }
                    }
                    else
                    {
                        LMessage.ShowMessage("No changed data for role setting", LMessage.MessageBoxType.Information);
                    }
                }
                else
                {
                    LMessage.ShowMessage("No changed data for role setting", LMessage.MessageBoxType.Warning);
                }
            }
            catch (System.Exception ex)
            {
                CommonFunction.ThongBaoLoi(ex);
                LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex);
            }
            //Mouse.OverrideCursor = Cursors.Arrow;
        }
        /// <summary>
        /// Thuc hien tong hop
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void tlbView_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                Mouse.OverrideCursor = Cursors.Wait;
                // Lấy dữ liệu từ form điều kiện
                List <HT_BAOCAO_TSO>    listHtBaoCaoTso  = lstHtBaoCaoTso;
                List <ThamSoBaoCao>     listThamSoBaoCao = new List <ThamSoBaoCao>();
                DatabaseConstant.Action action           = DatabaseConstant.Action.IN;

                listThamSoBaoCao = this.GetParameters();

                int soNgayTongHop = LDateTime.CountDayBetweenDates(
                    LDateTime.StringToDate(TuNgay, ApplicationConstant.defaultDateTimeFormat),
                    LDateTime.StringToDate(DenNgay, ApplicationConstant.defaultDateTimeFormat));
                progbarTongHop.Minimum = 0;
                progbarTongHop.Maximum = soNgayTongHop + INT_ONE;
                progbarTongHop.Value   = 0;
                UpdateProgressBarDelegate updatePbDelegate = new UpdateProgressBarDelegate(progbarTongHop.SetValue);
                string tuNgay = TuNgay;
                double value  = INT_ZERO;
                progbarPercent.Content = "0%";
                do
                {
                    processDate.Content = LDateTime.StringToDate(tuNgay, ApplicationConstant.defaultDateTimeFormat).DateToString("dd/MM/yyyy");
                    DataSet ds = new DataSet();
                    // Chuẩn bị điều kiện cho báo cáo
                    if (listThamSoBaoCao != null && listThamSoBaoCao.Count > 0)
                    {
                        listHtBaoCaoTso = new List <HT_BAOCAO_TSO>();
                        foreach (ThamSoBaoCao thamSoBaoCao in listThamSoBaoCao)
                        {
                            HT_BAOCAO_TSO tso = new HT_BAOCAO_TSO();
                            tso.MA_TSO   = thamSoBaoCao.MaThamSo;
                            tso.LOAI_TSO = thamSoBaoCao.LoaiThamSo;
                            if (tso.MA_TSO != "@TuNgay" && tso.MA_TSO != "@DenNgay")
                            {
                                tso.GTRI_TSO = thamSoBaoCao.GiaTriThamSo;
                            }
                            else
                            {
                                tso.GTRI_TSO = tuNgay;
                            }

                            listHtBaoCaoTso.Add(tso);
                            if (!LObject.IsNullOrEmpty(thamSoBaoCao.DsThamSo))
                            {
                                ds = thamSoBaoCao.DsThamSo;
                            }
                        }
                    }
                    ApplicationConstant.ResponseStatus retStatus = ApplicationConstant.ResponseStatus.KHONG_THANH_CONG;
                    FileBase        fileResponse    = new FileBase();
                    List <FileBase> lstFileResponse = new List <FileBase>();
                    string          responseMessage = null;

                    retStatus = process.LayDuLieu(htBaoCao, listHtBaoCaoTso, ref fileResponse, ref responseMessage, ds, action);

                    if (retStatus == ApplicationConstant.ResponseStatus.THANH_CONG)
                    {
                        value++;
                        Dispatcher.Invoke(updatePbDelegate,
                                          System.Windows.Threading.DispatcherPriority.Background,
                                          new object[] { ProgressBar.ValueProperty, value });
                        progbarPercent.Content = LNumber.Rounding((decimal)((progbarTongHop.Value / progbarTongHop.Maximum) * 100), 0).ToString() + "%";
                        tuNgay = LDateTime.PlusDays(LDateTime.StringToDate(tuNgay, ApplicationConstant.defaultDateTimeFormat), INT_ONE)
                                 .DateToString(ApplicationConstant.defaultDateTimeFormat);
                    }
                    else
                    {
                        LMessage.ShowMessage("M.DungChung.LoiChung", LMessage.MessageBoxType.Error);
                        return;
                    }
                }while (progbarTongHop.Value != progbarTongHop.Maximum);
                Mouse.OverrideCursor = Cursors.Arrow;
                LMessage.ShowMessage("M.DungChung.Result.ThanhCong", LMessage.MessageBoxType.Information);
            }
            catch (System.Exception ex)
            {
                Mouse.OverrideCursor = Cursors.Arrow;
                CommonFunction.ThongBaoLoi(ex);
                LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex);
            }
        }
Exemple #4
0
        public static void ValidResponse <T, U>(T request, U response) where T : class
        {
            if (ClientInformation.ClientType.Equals(ApplicationConstant.ClientType.DESKTOP.layGiaTri()))
            {
                if ((response == null))
                {
                    // Set trạng thái xử lý cho client
                    ClientInformation.OperationStatus = ApplicationConstant.OperationStatus.NoResponse.layGiaTri();

                    // Ghi log
                    LLogging.WriteLog(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString(), LLogging.LogType.SYS, "No response from Server");
                    throw new CustomException("M.ResponseMessage.Common.NoResponse", null);
                }
                // Nếu có thông tin trả về
                else
                {
                    // Kiểm tra ResponseId
                    if (response.GetType().GetProperty("ResponseId").GetValue(response, null).ToString() != request.GetType().GetProperty("RequestId").GetValue(request, null).ToString())
                    {
                        // Ghi log
                        LLogging.WriteLog(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString(), LLogging.LogType.SYS, "ResponseId and RequestId do not match");
                        throw new CustomException("M.ResponseMessage.Common.ResponseIdIsNotMatch", null);
                    }

                    // Kiểm tra ResposeSecurityKey
                    if (response.GetType().GetProperty("ResponseSecurityKey").GetValue(response, null).ToString() != ClientInformation.ResponsetSecurityKey)
                    {
                        // Ghi log
                        LLogging.WriteLog(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString(), LLogging.LogType.SYS, "Invalid SecurityResponseKey");
                        throw new CustomException("M.ResponseMessage.Common.InvalidSecurityResponseKey", null);
                    }
                    //// Kiểm tra ResponseMessage
                    //if (response.GetType().GetProperty("ResponseMessage").GetValue(response, null) != null &&
                    //    response.GetType().GetProperty("ResponseMessage").GetValue(response, null).ToString() == ApplicationConstant.CommonResponseMessage.M_ResponseMessage_Common_InvalidOrExpiredOperationSession.layGiaTri())
                    //{
                    //    // Ghi log
                    //    LLogging.WriteLog(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString(), LLogging.LogType.SYS, response.GetType().GetProperty("ResponseMessage").GetValue(response, null).ToString());
                    //    throw new CustomException("M.ResponseMessage.Common.InvalidOrExpiredOperationSession", null);
                    //}

                    // Nếu không thành công
                    if (response.GetType().GetProperty("ResponseStatus").GetValue(response, null).ToString() == ApplicationConstant.ResponseStatus.KHONG_THANH_CONG.ToString())
                    {
                        object responseMessage = response.GetType().GetProperty("ResponseMessage").GetValue(response, null);
                        byte[] exception       = (byte[])response.GetType().GetProperty("ExceptionObject").GetValue(response, null);

                        if ((responseMessage != null) && (responseMessage.ToString() == ApplicationConstant.CommonResponseMessage.M_ResponseMessage_Common_InvalidOrExpiredOperationSession.layGiaTri()))
                        {
                            // Set trạng thái xử lý cho client
                            ClientInformation.OperationStatus = ApplicationConstant.OperationStatus.InvalidOrExpiredOperationSession.layGiaTri();
                            // Ghi log
                            LLogging.WriteLog(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString(), LLogging.LogType.SYS, response.GetType().GetProperty("ResponseMessage").GetValue(response, null).ToString());
                            throw new CustomException(responseMessage.ToString(), null);
                        }
                        else if ((responseMessage != null) && (responseMessage.ToString() == ApplicationConstant.CommonResponseMessage.M_ResponseMessage_Common_LoseSession.layGiaTri()))
                        {
                            // Set trạng thái xử lý cho client
                            ClientInformation.OperationStatus = ApplicationConstant.OperationStatus.LoseSession.layGiaTri();
                            // Ghi log
                            LLogging.WriteLog(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString(), LLogging.LogType.SYS, response.GetType().GetProperty("ResponseMessage").GetValue(response, null).ToString());
                            throw new CustomException(responseMessage.ToString(), null);
                        }
                        else if ((responseMessage != null) && (responseMessage.ToString() == ApplicationConstant.CommonResponseMessage.M_ResponseMessage_Common_InvalidWorkingDay.layGiaTri()))
                        {
                            // Set trạng thái xử lý cho client
                            ClientInformation.OperationStatus = ApplicationConstant.OperationStatus.InvalidWorkingDay.layGiaTri();
                            // Ghi log
                            LLogging.WriteLog(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString(), LLogging.LogType.SYS, response.GetType().GetProperty("ResponseMessage").GetValue(response, null).ToString());
                            //throw new CustomException(responseMessage.ToString(), null);
                            LMessage.ShowMessage("M.ResponseMessage.Common.InvalidWorkingDay", LMessage.MessageBoxType.Warning);
                            System.Windows.Application.Current.Shutdown();
                        }

                        /*
                         * else if ((responseMessage != null) && (responseMessage.ToString() == ApplicationConstant.LoginResponseMessage.M_ResponseMessage_Login_LoadUserRolesFailed.layGiaTri()))
                         * {
                         *  // Ghi log
                         *  LLogging.WriteLog(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString(), LLogging.LogType.SYS, response.GetType().GetProperty("ResponseMessage").GetValue(response, null).ToString());
                         *  throw new CustomException(responseMessage.ToString(), null);
                         * }
                         * else if ((responseMessage != null) && (responseMessage.ToString() == ApplicationConstant.LoginResponseMessage.M_ResponseMessage_Login_LoadUserBranchesFailed.layGiaTri()))
                         * {
                         *  // Ghi log
                         *  LLogging.WriteLog(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString(), LLogging.LogType.SYS, response.GetType().GetProperty("ResponseMessage").GetValue(response, null).ToString());
                         *  throw new CustomException(responseMessage.ToString(), null);
                         * }
                         * else if ((responseMessage != null) && (responseMessage.ToString() == ApplicationConstant.LoginResponseMessage.M_ResponseMessage_Login_YeuCauDoiMatKhauLanDau.layGiaTri()))
                         * {
                         *  // Ghi log
                         *  LLogging.WriteLog(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString(), LLogging.LogType.SYS, response.GetType().GetProperty("ResponseMessage").GetValue(response, null).ToString());
                         *  throw new CustomException(responseMessage.ToString(), null);
                         * }
                         */
                        else if ((responseMessage != null) && (exception != null))
                        {
                            // Ghi log
                            LLogging.WriteLog(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString(), LLogging.LogType.SYS, response.GetType().GetProperty("ResponseMessage").GetValue(response, null).ToString());
                            throw new CustomException(responseMessage.ToString(), exception != null ? LCollection.Deserialize(exception) : null);
                        }

                        /*
                         * else
                         * {
                         *  // Ghi log
                         *  LLogging.WriteLog(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString(), LLogging.LogType.SYS, "M.ResponseMessage.Common.KhongThanhCong");
                         *  //throw new CustomException("M.ResponseMessage.Common.KhongThanhCong", null);
                         *  //throw new CustomException("M.ResponseMessage.Common.KhongThanhCong", LCollection.Deserialize(response.GetType().GetProperty("ExceptionObject").GetValue(response, null)));
                         * }
                         */
                    }
                }
            }
            else
            {
            }
        }
Exemple #5
0
 public override void InitMessageConfig(LMessage message)
 {
 }
Exemple #6
0
        private void tlbProcess_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                Mouse.OverrideCursor = Cursors.Wait;
                // Lấy dữ liệu từ form điều kiện
                DatabaseConstant.Action action = DatabaseConstant.Action.IN;
                MethodInfo mi;
                if (uc != null)
                {
                    mi = uc.GetType().GetMethod("GetParameters");
                }
                else
                {
                    Mouse.OverrideCursor = Cursors.Arrow;
                    LMessage.ShowMessage("Chưa chọn vấn đề cần thao tác", LMessage.MessageBoxType.Error);
                    return;
                }

                object    ret = mi.Invoke(uc, null);
                DataTable dt  = null;
                if (ret != null)
                {
                    dt = (DataTable)ret;
                }
                else
                {
                    Mouse.OverrideCursor = Cursors.Arrow;
                    return;
                }

                DataSet ds = new HoTroProcess().ThucHien(dataQuerySet, dt);

                if (ds != null && ds.Tables.Count > 0)
                {
                    int    i  = ds.Tables.Count;
                    string kq = ds.Tables[i - 1].Rows[0][0].ToString();
                    if (kq == "THANH_CONG")
                    {
                        LMessage.ShowMessage("Xử lý thành công", LMessage.MessageBoxType.Information);
                    }
                    else
                    {
                        CommonFunction.ThongBaoKetQua(ds.Tables[i - 1]);
                    }
                }
                else
                {
                    LMessage.ShowMessage("Xử lý không thành công", LMessage.MessageBoxType.Warning);
                }
            }
            catch (System.Exception ex)
            {
                Mouse.OverrideCursor = Cursors.Arrow;
                CommonFunction.ThongBaoLoi(ex);
                LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex);
            }
            finally
            {
                Mouse.OverrideCursor = Cursors.Arrow;
            }
        }
Exemple #7
0
        public List <ThamSoBaoCao> GetParameters()
        {
            if (!Validation())
            {
                LMessage.ShowMessage("Thiếu tham số cho báo cáo.", LMessage.MessageBoxType.Information);
                return(null);
            }

            GetFormData();

            List <ThamSoBaoCao> listThamSoBaoCao = new List <ThamSoBaoCao>();

            //listThamSoBaoCao.Add(new ThamSoBaoCao("P_TenNguoiLap", TenNguoiLap, ApplicationConstant.LoaiThamSoBaoCao.GUI.layGiaTri()));
            listThamSoBaoCao.Add(new ThamSoBaoCao("P_TenChiNhanh", TenChiNhanh, ApplicationConstant.LoaiThamSoBaoCao.GUI.layGiaTri()));
            //listThamSoBaoCao.Add(new ThamSoBaoCao("P_TenPGD", TenPhongGiaoDich, ApplicationConstant.LoaiThamSoBaoCao.GUI.layGiaTri()));
            listThamSoBaoCao.Add(new ThamSoBaoCao("P_TuNgay", TuNgay, ApplicationConstant.LoaiThamSoBaoCao.GUI.layGiaTri()));
            listThamSoBaoCao.Add(new ThamSoBaoCao("P_DenNgay", DenNgay, ApplicationConstant.LoaiThamSoBaoCao.GUI.layGiaTri()));
            //listThamSoBaoCao.Add(new ThamSoBaoCao("P_NgayMoSo", TuNgay, ApplicationConstant.LoaiThamSoBaoCao.GUI.layGiaTri()));
            listThamSoBaoCao.Add(new ThamSoBaoCao("P_NguoiLap", ClientInformation.HoTen, ApplicationConstant.LoaiThamSoBaoCao.GUI.layGiaTri()));
            listThamSoBaoCao.Add(new ThamSoBaoCao("P_NgayBaoCao", NgayBaoCao, ApplicationConstant.LoaiThamSoBaoCao.GUI.layGiaTri()));

            listThamSoBaoCao.Add(new ThamSoBaoCao("@MaChiNhanh", MaChiNhanh, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));

            foreach (string PhongGD in MaPhongGiaoDich)
            {
                listThamSoBaoCao.Add(new ThamSoBaoCao("@MaPhongGiaoDich", PhongGD, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));
            }

            foreach (string CanBo in IDCanBo)
            {
                listThamSoBaoCao.Add(new ThamSoBaoCao("@MaCanBo", CanBo, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));
            }

            foreach (string Xa in IDXa)
            {
                listThamSoBaoCao.Add(new ThamSoBaoCao("@IdKhuVuc", Xa, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));
            }

            foreach (string Ap in IDAp)
            {
                listThamSoBaoCao.Add(new ThamSoBaoCao("@IdCum", Ap, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));
            }

            foreach (string Nhom in IDNhom)
            {
                listThamSoBaoCao.Add(new ThamSoBaoCao("@IdNhom", Nhom, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));
            }

            listThamSoBaoCao.Add(new ThamSoBaoCao("@TenChiNhanh", TenChiNhanh, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));
            listThamSoBaoCao.Add(new ThamSoBaoCao("@TenPhongGiaoDich", TenPhongGiaoDich, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));
            listThamSoBaoCao.Add(new ThamSoBaoCao("@NgayPhatVon", TuNgay, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));
            listThamSoBaoCao.Add(new ThamSoBaoCao("@DenNgay", DenNgay, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));
            //listThamSoBaoCao.Add(new ThamSoBaoCao("@MaLoaiTien", MaLoaiTien, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));
            listThamSoBaoCao.Add(new ThamSoBaoCao("@LoaiTK", "TKTH", ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));
            listThamSoBaoCao.Add(new ThamSoBaoCao("@NguoiLap", ClientInformation.HoTen, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));
            listThamSoBaoCao.Add(new ThamSoBaoCao("@NgayBaoCao", NgayBaoCao, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));

            listThamSoBaoCao.Add(new ThamSoBaoCao("@P_MaDonVi", ClientInformation.MaDonVi, ApplicationConstant.LoaiThamSoBaoCao.GUIPARAM.layGiaTri()));

            listThamSoBaoCao.Add(new ThamSoBaoCao("MaNgonNgu", MaNgonNgu, ApplicationConstant.LoaiThamSoBaoCao.LANG.layGiaTri()));
            listThamSoBaoCao.Add(new ThamSoBaoCao("MaDinhDang", MaDinhDang, ApplicationConstant.LoaiThamSoBaoCao.FORMAT.layGiaTri()));

            return(listThamSoBaoCao);
        }
        private void Login()
        {
            try
            {
                // @TrườngNX on 20120905
                // Lựa chọn ngôn ngữ của phiên làm việc
                // Căn cứ vào ngôn ngữ, load file language resources tương ứng
                //this.Cursor = Cursors.Wait;

                //var process = new ZAMainAppProcess();
                string userName = txtUsername.Text;
                string txtMD5   = LSecurity.MD5Encrypt(txtPassword.Password);
                //process.createSession();
                string       responseMessage = "";
                NGON_NGU_DTO ngonNguDTO      = null;
                bool         ret             = process.doLoginWithSession(userName, txtMD5, ref ngonNguDTO, ref responseMessage);

                LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, "ret value: " + ret.ToString());
                LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, "responseMessage value: " + responseMessage);
                // Nếu thành công
                if (ret)
                {
                    // Nếu yêu cầu cập nhật phiên bản
                    if (responseMessage != null &&
                        responseMessage.Equals(ApplicationConstant.CommonResponseMessage.M_ResponseMessage_Common_NotLatestVersion.layGiaTri())
                        )
                    {
                        //MessageBoxResult retQuestion = LMessage.ShowMessage(responseMessage, LMessage.MessageBoxType.Question);
                        //if (retQuestion == MessageBoxResult.Yes)
                        //{
                        //    // Cập nhật phiên bản
                        //}
                        //else
                        //{
                        //}

                        MessageBoxResult retMessage = LMessage.ShowMessage(responseMessage, LMessage.MessageBoxType.Question);
                        if (retMessage == MessageBoxResult.Yes)
                        {
                            UserControl p             = null;
                            bool        stretchWindow = false;
                            p = new PresentationWPF.QuanTriHeThong.PhienBan.ucPhienBanCapNhat();

                            if (p != null)
                            {
                                Window window = new Window
                                {
                                    Title = LLanguage.SearchResourceByKey("MENU.152_CAP_NHAT_PB"),
                                    WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
                                    //Icon = (rmb.ImageSource == null ? this.Icon : rmb.ImageSource),
                                    Width   = (Double.IsNaN(p.Width) ? 1024 : p.Width),
                                    Height  = (Double.IsNaN(p.Height) ? 700 : p.Height),
                                    Content = p,
                                };
                                if (stretchWindow == true)
                                {
                                    window.WindowState = WindowState.Maximized;
                                }
                                window.Width      = 500;
                                window.Height     = 150;
                                window.ResizeMode = ResizeMode.NoResize;

                                //Mouse.OverrideCursor = Cursors.Arrow;
                                this.Close();
                                window.ShowDialog();
                            }
                            else
                            {
                                Mouse.OverrideCursor = Cursors.Arrow;
                                LMessage.ShowMessage("Không tìm thấy chức năng này", LMessage.MessageBoxType.Warning);
                            }
                        }
                    }


                    #region Ghi ngôn ngữ ra file UIResources
                    if (ngonNguDTO != null)
                    {
                        List <string> lstResource_vi = new List <string>();
                        List <string> lstResource_en = new List <string>();
                        List <string> lstResource_gl = new List <string>();
                        List <string> lstMessage_vi  = new List <string>();
                        List <string> lstMessage_en  = new List <string>();
                        List <string> lstMessage_gl  = new List <string>();

                        string pathFileResource_vi = ClientInformation.LanguagesDir + "\\UIResources_vi.xaml";
                        string pathFileResource_en = ClientInformation.LanguagesDir + "\\UIResources_en.xaml";
                        string pathFileResource_gl = ClientInformation.LanguagesDir + "\\UIResources_gl.xaml";
                        string pathFileMessage_vi  = ClientInformation.LanguagesDir + "\\MessageResources_vi.xaml";
                        string pathFileMessage_en  = ClientInformation.LanguagesDir + "\\MessageResources_en.xaml";
                        string pathFileMessage_gl  = ClientInformation.LanguagesDir + "\\MessageResources_gl.xaml";


                        string begin = "<ResourceDictionary xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\""
                                       + "\n                " + "xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\""
                                       + "\n                " + "xmlns:my=\"clr-namespace:System;assembly=mscorlib\">";
                        string end = "\n\n</ResourceDictionary>";



                        if (!ngonNguDTO.checkResource && ngonNguDTO.lstResource != null)
                        {
                            lstResource_vi.Add(begin);
                            lstResource_en.Add(begin);
                            lstResource_gl.Add(begin);

                            foreach (var item in ngonNguDTO.lstResource)
                            {
                                lstResource_vi.Add("\n    <my:String x:Key=\"" + item.MA + "\">" + item.VIET_NAM + "</my:String>");
                                lstResource_en.Add("\n    <my:String x:Key=\"" + item.MA + "\">" + item.ENGLISH + "</my:String>");
                                lstResource_gl.Add("\n    <my:String x:Key=\"" + item.MA + "\">" + item.GLOBAL + "</my:String>");
                            }

                            lstResource_vi.Add(end);
                            lstResource_en.Add(end);
                            lstResource_gl.Add(end);

                            LFile.DeleteFile(pathFileResource_vi);
                            LFile.DeleteFile(pathFileResource_en);
                            LFile.DeleteFile(pathFileResource_gl);

                            LFile.WriteListTextToFile(pathFileResource_vi, true, lstResource_vi);
                            LFile.WriteListTextToFile(pathFileResource_en, true, lstResource_en);
                            LFile.WriteListTextToFile(pathFileResource_gl, true, lstResource_gl);
                        }

                        if (!ngonNguDTO.checkMessage && ngonNguDTO.lstMessage != null)
                        {
                            lstMessage_vi.Add(begin);
                            lstMessage_en.Add(begin);
                            lstMessage_gl.Add(begin);

                            foreach (var item in ngonNguDTO.lstMessage)
                            {
                                lstMessage_vi.Add("\n    <my:String x:Key=\"" + item.MA + "\">" + item.VIET_NAM + "</my:String>");
                                lstMessage_en.Add("\n    <my:String x:Key=\"" + item.MA + "\">" + item.ENGLISH + "</my:String>");
                                lstMessage_gl.Add("\n    <my:String x:Key=\"" + item.MA + "\">" + item.GLOBAL + "</my:String>");
                            }

                            lstMessage_vi.Add(end);
                            lstMessage_en.Add(end);
                            lstMessage_gl.Add(end);

                            LFile.DeleteFile(pathFileMessage_vi);
                            LFile.DeleteFile(pathFileMessage_en);
                            LFile.DeleteFile(pathFileMessage_gl);

                            LFile.WriteListTextToFile(pathFileMessage_vi, true, lstMessage_vi);
                            LFile.WriteListTextToFile(pathFileMessage_en, true, lstMessage_en);
                            LFile.WriteListTextToFile(pathFileMessage_gl, true, lstMessage_gl);
                        }

                        ChangeLanguage();
                    }
                    #endregion


                    ClientInformation.NgonNgu = ((RadComboBoxItem)cboLanguage.SelectedItem).Tag.ToString();

                    // @Truonglq set Culture ngôn ngữ cho  Coltrol (telerik)
                    //CultureInfo culture = new CultureInfo(((RadComboBoxItem)cboLanguage.SelectedItem).Tag.ToString());
                    //System.Threading.Thread.CurrentThread.CurrentCulture = culture;
                    //System.Threading.Thread.CurrentThread.CurrentUICulture = culture;
                    InitializeCultures();
                    //InitializeCulturesTelerik();
                    LocalizationManager.Manager = new LocalizationManager()
                    {
                        ResourceManager = LocalizationRadControl.ResourceManager
                    };

                    // Khởi tạo phiên làm việc, chọn đơn vị nghiệp vụ cần thao tác dữ liệu
                    if (!ClientInformation.LoaiNguoiSuDung.Equals(BusinessConstant.LoaiNguoiSuDung.CAP_SA.layGiaTri()))
                    {
                        LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, "BeforeInitSession");
                        InitSession initSession = new InitSession(ClientInformation.ListPhongGD);
                        LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, "AfterInitSession");

                        initSession.ResizeMode            = ResizeMode.NoResize;
                        initSession.Height                = 250;
                        initSession.Width                 = 600;
                        initSession.WindowStartupLocation = WindowStartupLocation.CenterScreen;

                        initSession.lblNguoiDungValue.Content = "(" + ClientInformation.TenDangNhap + ") " + ClientInformation.HoTen;
                        initSession.lblChiNhanhValue.Content  = "(" + ClientInformation.MaDonVi + ") " + ClientInformation.TenDonVi;
                        //initSession.ListPhongGD = ClientInformation.ListPhongGD;

                        LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, "BeforeInitSession Show");
                        initSession.Show();
                        LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, "AfterInitSession Show");
                        this.Cursor = Cursors.Arrow;
                        Close();
                    }
                    else
                    {
                        ClientInformation.TenDonViGiaoDich   = ClientInformation.TenDonVi;
                        ClientInformation.MaDonViGiaoDich    = ClientInformation.MaDonVi;
                        ClientInformation.IdDonViGiaoDich    = ClientInformation.IdDonVi;
                        ClientInformation.PhuongPhapHachToan = null;

                        MainWindow mainwindow = new MainWindow();
                        mainwindow.Show();
                        this.Cursor = Cursors.Arrow;
                        Close();
                    }
                }
                else
                {
                    ImageBehavior.SetAnimatedSource(imgWaiting, null);

                    // Nếu yêu cầu đổi mật khẩu
                    if (responseMessage != null &&
                        (
                            responseMessage.Equals(ApplicationConstant.LoginResponseMessage.M_ResponseMessage_Login_YeuCauDoiMatKhauLanDau.layGiaTri()) ||
                            responseMessage.Equals(ApplicationConstant.LoginResponseMessage.M_ResponseMessage_Login_YeuCauDoiMatKhau.layGiaTri())
                        )
                        )
                    {
                        LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, "IF M_ResponseMessage_Login_YeuCauDoiMatKhau");
                        MessageBoxResult retQuestion = LMessage.ShowMessage(responseMessage, LMessage.MessageBoxType.Question);
                        if (retQuestion == MessageBoxResult.Yes)
                        {
                            txtPassword.Clear();

                            ChangePassword changePassword = new ChangePassword();
                            Window         window         = new Window();

                            window.ResizeMode            = ResizeMode.NoResize;
                            window.Height                = 180;
                            window.Width                 = 500;
                            window.WindowStartupLocation = WindowStartupLocation.CenterScreen;
                            window.Title                 = LLanguage.SearchResourceByKey("U.ZAMainApp.ChangePassword.Title");
                            window.Content               = changePassword;

                            changePassword.userName = userName;
                            window.ShowDialog();
                            //LMessage.ShowMessage("Change pass", LMessage.MessageBoxType.Warning);
                        }
                        else
                        {
                            return;
                        }
                    }
                    else
                    {
                        LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, "ELSE M_ResponseMessage_Login_YeuCauDoiMatKhau");
                        LMessage.ShowMessage(responseMessage, LMessage.MessageBoxType.Warning);
                    }
                }
            }
            //else
            catch (Exception ex)
            {
                LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, "Login() Exception");
                ImageBehavior.SetAnimatedSource(imgWaiting, null);

                //this.Close();
                //Application.Current.Shutdown();
                this.Cursor = Cursors.Arrow;
                if (ex.GetType() == typeof(CustomException))
                {
                    new frmThongBaoLoi(ex.Message, ex.InnerException).ShowDialog();
                }
                else
                {
                    if (ex.InnerException != null)
                    {
                        if (ex.InnerException.GetType() == typeof(CustomException))
                        {
                            new frmThongBaoLoi(ex.InnerException.Message, ex.InnerException).ShowDialog();
                        }
                        else
                        {
                            new frmThongBaoLoi("M.ResponseMessage.Login.KhongThanhCong", ex).ShowDialog();
                        }
                    }
                    else
                    {
                        new frmThongBaoLoi("M.ResponseMessage.Login.KhongThanhCong", ex).ShowDialog();
                    }
                }
                LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex);
            }
        }
Exemple #9
0
        /// <summary>
        /// Lưu dữ liệu
        /// </summary>
        private void Luu(BusinessConstant.TrangThaiNghiepVu nghiepvu, string nguoi_cnhat)
        {
            if (Validation())
            {
                DanhMucProcess danhmucProcess = new DanhMucProcess();
                try
                {
                    // Lấy dữ liệu từ giao diện đưa vào object
                    Presentation.Process.DanhMucServiceRef.DM_PHAN_HE_GD obj = new Presentation.Process.DanhMucServiceRef.DM_PHAN_HE_GD();
                    obj = LayDuLieu(nghiepvu, nguoi_cnhat);

                    // Lưu dữ liệu
                    if (idPhanHeGD == 0)
                    {
                        if (!danhmucProcess.checkMaDonViDaSuDung(obj.MA_LOAI_GDICH))
                        {
                            if (danhmucProcess.ThemPhanHeGD(obj) != null)
                            {
                                LMessage.ShowMessage("M.DanhMuc.ucPhanHeGDCT.LuuDuLieuThanhCong", LMessage.MessageBoxType.Information);
                                idPhanHeGD = obj.ID;
                                if (cbMultiAdd.IsChecked == true)
                                {
                                    ResetForm();
                                    idPhanHeGD = 0;
                                }
                                else
                                {
                                    Dong();
                                }
                            }
                            else
                            {
                                LMessage.ShowMessage("M.DanhMuc.ucPhanHeGDCT.LuuDuLieuKoThanhCong", LMessage.MessageBoxType.Error);
                            }
                        }

                        else
                        {
                            LMessage.ShowMessage("M.DanhMuc.ucPhanHeGDCT.MaDonViDaDuocSuDung", LMessage.MessageBoxType.Warning);
                            txtMaLoaiGD.Focus();
                        }
                    }
                    else
                    {
                        if (danhmucProcess.SuaPhanHeGD(obj) != null)
                        {
                            LMessage.ShowMessage("M.DanhMuc.ucPhanHeGDCT.LuuDuLieuThanhCong", LMessage.MessageBoxType.Information);
                        }
                        else
                        {
                            LMessage.ShowMessage("M.DanhMuc.ucPhanHeGDCT.LuuDuLieuKoThanhCong", LMessage.MessageBoxType.Error);
                        }
                        Dong();
                    }
                }
                catch (System.Exception ex)
                {
                    LMessage.ShowMessage("M.DanhMuc.ucPhanHeGDCT.LoiLuuDuLieu", LMessage.MessageBoxType.Error);
                    LLogging.WriteLog(ex.TargetSite.Name, LLogging.LogType.ERR, ex);
                }
                finally
                {
                    danhmucProcess = null;
                }
            }
        }
Exemple #10
0
        public List <ThamSoBaoCao> GetParameters()
        {
            if (!Validation())
            {
                LMessage.ShowMessage("Thiếu tham số cho báo cáo.", LMessage.MessageBoxType.Information);
                return(null);
            }

            GetFormData();

            List <ThamSoBaoCao> listThamSoBaoCao = new List <ThamSoBaoCao>();

            if (MaChiNhanh.Equals("%"))
            {
                foreach (AutoCompleteEntry item in lstSourceChiNhanh)
                {
                    string ma = item.KeywordStrings.First();
                    if (!ma.Equals("%"))
                    {
                        listThamSoBaoCao.Add(new ThamSoBaoCao("@DSChiNhanh", ma, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));
                    }
                }
            }
            else
            {
                listThamSoBaoCao.Add(new ThamSoBaoCao("@DSChiNhanh", MaChiNhanh, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));
            }
            if (MaPhongGiaoDich.Equals("%"))
            {
                foreach (AutoCompleteEntry item in lstSourcePhongGD_Select)
                {
                    string ma = item.KeywordStrings.First();
                    if (!ma.Equals("%"))
                    {
                        listThamSoBaoCao.Add(new ThamSoBaoCao("@DSPhongGD", ma, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));
                    }
                }
            }
            else
            {
                listThamSoBaoCao.Add(new ThamSoBaoCao("@DSPhongGD", MaPhongGiaoDich, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));
            }
            if (grSoTienGuiDS.SelectedItems.Count > 0)
            {
                for (int i = 0; i < grSoTienGuiDS.SelectedItems.Count; i++)
                {
                    DataRow dr = (DataRow)grSoTienGuiDS.SelectedItems[i];
                    listThamSoBaoCao.Add(new ThamSoBaoCao("@DSDoiTuong", dr["MA_DTUONG"].ToString(), ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));
                }
            }

            listThamSoBaoCao.Add(new ThamSoBaoCao("@DSTaiKhoan", SoTaiKhoan, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));
            listThamSoBaoCao.Add(new ThamSoBaoCao("@LoaiTien", MaLoaiTien, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));
            listThamSoBaoCao.Add(new ThamSoBaoCao("@NgayBaoCao", NgayBaoCao, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));
            listThamSoBaoCao.Add(new ThamSoBaoCao("@TuNgay", TuNgay, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));
            listThamSoBaoCao.Add(new ThamSoBaoCao("@DenNgay", DenNgay, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));
            listThamSoBaoCao.Add(new ThamSoBaoCao("@NguoiGhiSo", ClientInformation.HoTen, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));

            listThamSoBaoCao.Add(new ThamSoBaoCao("MaNgonNgu", MaNgonNgu, ApplicationConstant.LoaiThamSoBaoCao.LANG.layGiaTri()));
            listThamSoBaoCao.Add(new ThamSoBaoCao("MaDinhDang", MaDinhDang, ApplicationConstant.LoaiThamSoBaoCao.FORMAT.layGiaTri()));

            return(listThamSoBaoCao);
        }
Exemple #11
0
        public List <ThamSoBaoCao> GetParameters()
        {
            string msg = "";

            if (!Validation(ref msg))
            {
                if (msg.Equals(""))
                {
                    LMessage.ShowMessage("Thiếu tham số cho báo cáo.", LMessage.MessageBoxType.Information);
                }
                else
                {
                    LMessage.ShowMessage(msg, LMessage.MessageBoxType.Information);
                }
                return(null);
            }

            GetFormData();

            List <ThamSoBaoCao> listThamSoBaoCao = new List <ThamSoBaoCao>();

            listThamSoBaoCao.Add(new ThamSoBaoCao("@MaDonVi", MaDonVi, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));

            if (MaChiNhanh.Equals("%"))
            {
                foreach (AutoCompleteEntry item in lstSourceChiNhanh)
                {
                    string ma = item.KeywordStrings.First();
                    if (!ma.Equals("%"))
                    {
                        listThamSoBaoCao.Add(new ThamSoBaoCao("@MaChiNhanh", ma, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));
                    }
                }
            }
            else
            {
                listThamSoBaoCao.Add(new ThamSoBaoCao("@MaChiNhanh", MaChiNhanh, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));
            }
            if (MaPhongGiaoDich.Equals("%"))
            {
                if (MaChiNhanh.Equals("%"))
                {
                    foreach (AutoCompleteEntry item in lstSourcePhongGD)
                    {
                        string ma = item.KeywordStrings.First();
                        if (!ma.Equals("%"))
                        {
                            listThamSoBaoCao.Add(new ThamSoBaoCao("@MaPhongGD", ma, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));
                        }
                    }
                }
                else
                {
                    foreach (AutoCompleteEntry item in lstSourcePhongGD_Select)
                    {
                        string ma = item.KeywordStrings.First();
                        if (!ma.Equals("%"))
                        {
                            listThamSoBaoCao.Add(new ThamSoBaoCao("@MaPhongGD", ma, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));
                        }
                    }
                }
            }
            else
            {
                listThamSoBaoCao.Add(new ThamSoBaoCao("@MaPhongGD", MaPhongGiaoDich, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));
            }
            if (MaCum.Equals("%"))
            {
                if (MaChiNhanh.Equals("%"))
                {
                    foreach (AutoCompleteEntry item in lstSourceCum)
                    {
                        string ma = item.KeywordStrings.First();
                        if (!ma.Equals("%"))
                        {
                            listThamSoBaoCao.Add(new ThamSoBaoCao("@MaCum", ma, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));
                        }
                    }
                }
                else
                {
                    if (MaPhongGiaoDich.Equals("%"))
                    {
                        string maChiNhanh = lstSourceChiNhanh.ElementAt(cmbChiNhanh.SelectedIndex).KeywordStrings.First();
                        foreach (AutoCompleteEntry item in lstSourceCum.Where(e => e.KeywordStrings.ElementAt(1).Substring(0, maChiNhanh.Length).Equals(maChiNhanh)).ToList())
                        {
                            string ma = item.KeywordStrings.First();
                            if (!ma.Equals("%"))
                            {
                                listThamSoBaoCao.Add(new ThamSoBaoCao("@MaCum", ma, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));
                            }
                        }
                    }
                    else
                    {
                        foreach (AutoCompleteEntry item in lstSourceCum_Select)
                        {
                            string ma = item.KeywordStrings.First();
                            if (!ma.Equals("%"))
                            {
                                listThamSoBaoCao.Add(new ThamSoBaoCao("@MaCum", ma, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));
                            }
                        }
                    }
                }
            }
            else
            {
                listThamSoBaoCao.Add(new ThamSoBaoCao("@MaCum", MaCum, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));
            }

            for (int i = 0; i < grSanPham.SelectedItems.Count; i++)
            {
                DataRow dr = (DataRow)grSanPham.SelectedItems[i];
                listThamSoBaoCao.Add(new ThamSoBaoCao("@MaSanPham", dr["MA_SAN_PHAM"].ToString(), ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));
            }
            listThamSoBaoCao.Add(new ThamSoBaoCao("@MauBaoCao", MauBaoCao, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));
            listThamSoBaoCao.Add(new ThamSoBaoCao("@TenBaoCao", TenMauBaoCao, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));
            listThamSoBaoCao.Add(new ThamSoBaoCao("@NgayChotDL", NgayChotDL, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));
            listThamSoBaoCao.Add(new ThamSoBaoCao("@NgayBaoCao", NgayBaoCao, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));
            listThamSoBaoCao.Add(new ThamSoBaoCao("@NguoiLap", ClientInformation.HoTen, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));

            listThamSoBaoCao.Add(new ThamSoBaoCao("MaNgonNgu", MaNgonNgu, ApplicationConstant.LoaiThamSoBaoCao.LANG.layGiaTri()));
            listThamSoBaoCao.Add(new ThamSoBaoCao("MaDinhDang", MaDinhDang, ApplicationConstant.LoaiThamSoBaoCao.FORMAT.layGiaTri()));


            return(listThamSoBaoCao);
        }
Exemple #12
0
 public abstract void InitMessageConfig(LMessage message);
Exemple #13
0
        private void InitDesktop()
        {
            if (desktop != null && sprites != null)
            {
                return;
            }
            this.desktop = new Desktop(this, GetWidth(), GetHeight());
            this.sprites = new Sprites(GetWidth(), GetHeight());
            if (dialog == null)
            {
                LImage tmp = LImage.CreateImage(GetWidth() - 20,
                                                GetHeight() / 2 - 20, true);
                LGraphics g = tmp.GetLGraphics();
                g.SetColor(0, 0, 0, 125);
                g.FillRect(0, 0, tmp.GetWidth(), tmp.GetHeight());
                g.Dispose();
                g      = null;
                dialog = new LTexture(GLLoader.GetTextureData(tmp));
                if (tmp != null)
                {
                    tmp.Dispose();
                    tmp = null;
                }
            }
            this.message = new LMessage(dialog, 0, 0);
            this.message.SetFontColor(LColor.white);
            int size = message.GetWidth() / (message.GetMessageFont().GetSize());

            if (LSystem.scaleWidth != 1 || LSystem.scaleHeight != 1)
            {
                if (size % 2 != 0)
                {
                    size = size + 2;
                }
                else
                {
                    size = size + 3;
                }
            }
            else
            {
                if (size % 2 != 0)
                {
                    size = size - 3;
                }
                else
                {
                    size = size - 4;
                }
            }
            this.message.SetMessageLength(size);
            this.message.SetLocation((GetWidth() - message.GetWidth()) / 2,
                                     GetHeight() - message.GetHeight() - 10);
            this.message.SetVisible(false);
            this.select = new LSelect(dialog, 0, 0);
            this.select.SetLocation(message.X(), message.Y());
            this.scrCG = new AVGCG();
            this.desktop.Add(message);
            this.desktop.Add(select);
            this.select.SetVisible(false);
        }
Exemple #14
0
 public void SetMessage(LMessage message)
 {
     this.message = message;
 }
        public List <ThamSoBaoCao> GetParameters()
        {
            if (!Validation())
            {
                LMessage.ShowMessage("Thiếu tham số cho báo cáo.", LMessage.MessageBoxType.Information);
                return(null);
            }

            GetFormData();

            List <ThamSoBaoCao> listThamSoBaoCao = new List <ThamSoBaoCao>();

            if (MaChiNhanh.Equals("%"))
            {
                foreach (AutoCompleteEntry item in lstSourceChiNhanh)
                {
                    string ma = item.KeywordStrings.First();
                    if (!ma.Equals("%"))
                    {
                        listThamSoBaoCao.Add(new ThamSoBaoCao("@MaChiNhanh", ma, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));
                    }
                }
            }
            else
            {
                listThamSoBaoCao.Add(new ThamSoBaoCao("@MaChiNhanh", MaChiNhanh, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));
            }
            if (MaPhongGiaoDich.Equals("%"))
            {
                foreach (AutoCompleteEntry item in lstSourcePhongGD_Select)
                {
                    string ma = item.KeywordStrings.First();
                    if (!ma.Equals("%"))
                    {
                        listThamSoBaoCao.Add(new ThamSoBaoCao("@DSPhongGD", ma, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));
                    }
                }
            }
            else
            {
                listThamSoBaoCao.Add(new ThamSoBaoCao("@DSPhongGD", MaPhongGiaoDich, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));
            }
            if (grNhomTS.SelectedItems.Count > 0)
            {
                for (int i = 0; i < grNhomTS.SelectedItems.Count; i++)
                {
                    DataRowView dr = (DataRowView)grNhomTS.SelectedItems[i];
                    listThamSoBaoCao.Add(new ThamSoBaoCao("@DSNhom", dr["MA_NHOM"].ToString(), ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));
                }
            }
            listThamSoBaoCao.Add(new ThamSoBaoCao("@Quy", Quy, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));
            listThamSoBaoCao.Add(new ThamSoBaoCao("@Nam", Nam, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));
            if (Quy.StringToInt32() == 1)
            {
                listThamSoBaoCao.Add(new ThamSoBaoCao("@KyKhauHaoTu", Nam + "01", ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));
                listThamSoBaoCao.Add(new ThamSoBaoCao("@KyKhauHaoDen", Nam + "03", ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));
            }
            else if (Quy.StringToInt32() == 2)
            {
                listThamSoBaoCao.Add(new ThamSoBaoCao("@KyKhauHaoTu", Nam + "04", ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));
                listThamSoBaoCao.Add(new ThamSoBaoCao("@KyKhauHaoDen", Nam + "06", ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));
            }
            else if (Quy.StringToInt32() == 3)
            {
                listThamSoBaoCao.Add(new ThamSoBaoCao("@KyKhauHaoTu", Nam + "07", ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));
                listThamSoBaoCao.Add(new ThamSoBaoCao("@KyKhauHaoDen", Nam + "09", ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));
            }
            else if (Quy.StringToInt32() == 4)
            {
                listThamSoBaoCao.Add(new ThamSoBaoCao("@KyKhauHaoTu", Nam + "10", ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));
                listThamSoBaoCao.Add(new ThamSoBaoCao("@KyKhauHaoDen", Nam + "12", ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));
            }
            listThamSoBaoCao.Add(new ThamSoBaoCao("@LoaiTien", MaLoaiTien, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));
            listThamSoBaoCao.Add(new ThamSoBaoCao("@NgayBaoCao", NgayBaoCao, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));
            listThamSoBaoCao.Add(new ThamSoBaoCao("@MaBaoCao", MaBaoCao, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));
            listThamSoBaoCao.Add(new ThamSoBaoCao("@NguoiLap", ClientInformation.HoTen, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));

            listThamSoBaoCao.Add(new ThamSoBaoCao("MaNgonNgu", MaNgonNgu, ApplicationConstant.LoaiThamSoBaoCao.LANG.layGiaTri()));
            listThamSoBaoCao.Add(new ThamSoBaoCao("MaDinhDang", MaDinhDang, ApplicationConstant.LoaiThamSoBaoCao.FORMAT.layGiaTri()));

            return(listThamSoBaoCao);
        }
        /// <summary>
        /// Tìm kiếm nâng cao
        /// </summary>
        private void TimKiem()
        {
            Mouse.OverrideCursor = Cursors.Wait;

            KeToanProcess process = new KeToanProcess();
            AutoComboBox  au      = new AutoComboBox();

            try
            {
                if (cmbDonVi.SelectedIndex < 0)
                {
                    return;
                }

                AutoCompleteEntry auDonVi = au.getEntryByDisplayName(lstSourceDonVi, ref cmbDonVi);

                string maDonVi    = "(";
                string ngayDL     = "";
                string maPhanLoai = "(";
                string tinhChatTK = "";


                string maChon = lstSourceDonVi.ElementAt(cmbDonVi.SelectedIndex).KeywordStrings.ElementAt(0);
                string donVi  = "";
                foreach (AutoCompleteEntry item in lstSourceDonVi)
                {
                    donVi = item.KeywordStrings.ElementAt(0);
                    if (donVi.Contains(maChon))
                    {
                        maDonVi += "''" + donVi + "'',";
                    }
                }
                maDonVi = maDonVi.Substring(0, maDonVi.Length - 1) + ")";


                foreach (object item in trvPhanLoai.CheckedItems)
                {
                    DataRowView dr = item as DataRowView;
                    if (dr["MA_PLOAI"].ToString().Length != 1)
                    {
                        maPhanLoai += "''" + dr["MA_PLOAI"].ToString() + "'',";
                    }
                }

                if (trvPhanLoai.CheckedItems.Count > 0)
                {
                    maPhanLoai = maPhanLoai.Substring(0, maPhanLoai.Length - 1) + ")";
                }
                else
                {
                    maPhanLoai = "";
                }

                if (raddtSoDuNgay.Value != null)
                {
                    ngayDL = Convert.ToDateTime(raddtSoDuNgay.Value).ToString("yyyyMMdd");
                }

                DataTable dtThamSo = null;
                LDatatable.MakeParameterTable(ref dtThamSo);
                LDatatable.AddParameter(ref dtThamSo, "@MaDonVi", "STRING", maDonVi);
                LDatatable.AddParameter(ref dtThamSo, "@MaPhanLoai", "STRING", maPhanLoai);
                LDatatable.AddParameter(ref dtThamSo, "@MaTK", "STRING", txtMaPhanLoaiTK.Text);
                LDatatable.AddParameter(ref dtThamSo, "@TenTK", "STRING", "");
                LDatatable.AddParameter(ref dtThamSo, "@NgayDL", "STRING", ngayDL);
                LDatatable.AddParameter(ref dtThamSo, "@SoDuTu", "DECIMAL", "0");
                LDatatable.AddParameter(ref dtThamSo, "@SoDuDen", "DECIMAL", "0");
                LDatatable.AddParameter(ref dtThamSo, "@TinhChat", "STRING", tinhChatTK);

                DataSet ds = process.getDanhSachTaiKhoanChiTiet(dtThamSo, "DANH_SACH");
                raddgrDanhSachTK.ItemsSource = null;
                if (ds != null && ds.Tables.Count > 0)
                {
                    raddgrDanhSachTK.ItemsSource = ds.Tables[0].DefaultView;
                    lblSumSoTK.Content           = ds.Tables[0].Rows.Count.ToString("###,###,###");

                    decimal tongSoDu = 0;
                    foreach (DataRow dr in ds.Tables[0].Rows)
                    {
                        tongSoDu += Convert.ToDecimal(dr["SODU"]);
                    }
                    lblSumSoDu.Content = tongSoDu.ToString("###,###,###,###,###,###");
                }
            }
            catch (System.Exception ex)
            {
                LMessage.ShowMessage("M.DungChung.LoiLoadDuLieu", LMessage.MessageBoxType.Error);
                LLogging.WriteLog(ex.TargetSite.Name, LLogging.LogType.ERR, ex);
            }
            finally
            {
                process = null;
                au      = null;
            }

            Mouse.OverrideCursor = Cursors.Arrow;
        }
Exemple #17
0
        public List <ThamSoBaoCao> GetParameters()
        {
            if (!Validation())
            {
                LMessage.ShowMessage("Thiếu tham số cho báo cáo.", LMessage.MessageBoxType.Information);
                return(null);
            }

            GetFormData();

            List <ThamSoBaoCao> listThamSoBaoCao = new List <ThamSoBaoCao>();

            if (MaChiNhanh.Equals("%"))
            {
                foreach (AutoCompleteEntry item in lstSourceChiNhanh)
                {
                    string ma = item.KeywordStrings.First();
                    if (!ma.Equals("%"))
                    {
                        listThamSoBaoCao.Add(new ThamSoBaoCao("@DSChiNhanh", ma, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));
                    }
                }
            }
            else
            {
                listThamSoBaoCao.Add(new ThamSoBaoCao("@DSChiNhanh", MaChiNhanh, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));
            }
            if (MaPhongGiaoDich.Equals("%") && MaChiNhanh.Equals("%"))
            {
                foreach (AutoCompleteEntry item in lstSourcePhongGD)
                {
                    string ma = item.KeywordStrings.First();
                    if (!ma.Equals("%"))
                    {
                        listThamSoBaoCao.Add(new ThamSoBaoCao("@DSPhongGD", ma, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));
                    }
                }
            }
            else if (MaPhongGiaoDich.Equals("%") && !MaChiNhanh.Equals("%"))
            {
                foreach (AutoCompleteEntry item in lstSourcePhongGD_Select)
                {
                    string ma = item.KeywordStrings.First();
                    if (!ma.Equals("%"))
                    {
                        listThamSoBaoCao.Add(new ThamSoBaoCao("@DSPhongGD", ma, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));
                    }
                }
            }
            else
            {
                listThamSoBaoCao.Add(new ThamSoBaoCao("@DSPhongGD", MaPhongGiaoDich, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));
            }
            listThamSoBaoCao.Add(new ThamSoBaoCao("@NgayDuLieu", NgayBaoCao, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));
            listThamSoBaoCao.Add(new ThamSoBaoCao("@NguoiLap", ClientInformation.HoTen, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));

            listThamSoBaoCao.Add(new ThamSoBaoCao("MaNgonNgu", MaNgonNgu, ApplicationConstant.LoaiThamSoBaoCao.LANG.layGiaTri()));
            listThamSoBaoCao.Add(new ThamSoBaoCao("MaDinhDang", MaDinhDang, ApplicationConstant.LoaiThamSoBaoCao.FORMAT.layGiaTri()));

            return(listThamSoBaoCao);
        }
Exemple #18
0
        private void onView()
        {
            try
            {
                Mouse.OverrideCursor = Cursors.Wait;
                // Lấy dữ liệu từ form điều kiện
                List <HT_BAOCAO_TSO>    listHtBaoCaoTso  = lstHtBaoCaoTso;
                List <ThamSoBaoCao>     listThamSoBaoCao = new List <ThamSoBaoCao>();
                DatabaseConstant.Action action           = DatabaseConstant.Action.IN;
                listThamSoBaoCao = GetParameters();
                DataSet ds = new DataSet();
                // Chuẩn bị điều kiện cho báo cáo
                if (listThamSoBaoCao != null && listThamSoBaoCao.Count > 0)
                {
                    if (listHtBaoCaoTso.Where(t => t.LOAI_TSO == ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri() && t.MA_TSO.Equals("@DT_THAMSO")).Count() > 0)
                    {
                        listHtBaoCaoTso = new List <HT_BAOCAO_TSO>();
                        foreach (ThamSoBaoCao thamSoBaoCao in listThamSoBaoCao)
                        {
                            HT_BAOCAO_TSO tso = new HT_BAOCAO_TSO();
                            tso.MA_TSO   = thamSoBaoCao.MaThamSo;
                            tso.LOAI_TSO = thamSoBaoCao.LoaiThamSo;
                            tso.GTRI_TSO = thamSoBaoCao.GiaTriThamSo;
                            listHtBaoCaoTso.Add(tso);
                        }
                    }
                    else
                    {
                        foreach (HT_BAOCAO_TSO htBaoCaoTso in listHtBaoCaoTso)
                        {
                            foreach (ThamSoBaoCao thamSoBaoCao in listThamSoBaoCao)
                            {
                                if (htBaoCaoTso.MA_TSO.Equals(thamSoBaoCao.MaThamSo) &&
                                    htBaoCaoTso.LOAI_TSO.Equals(thamSoBaoCao.LoaiThamSo))
                                {
                                    htBaoCaoTso.GTRI_TSO = thamSoBaoCao.GiaTriThamSo;
                                    break;
                                }
                                if (!LObject.IsNullOrEmpty(thamSoBaoCao.DsThamSo))
                                {
                                    ds = thamSoBaoCao.DsThamSo;
                                }
                            }
                        }
                    }
                }

                ApplicationConstant.ResponseStatus retStatus = ApplicationConstant.ResponseStatus.KHONG_THANH_CONG;
                FileBase        fileResponse    = new FileBase();
                List <FileBase> lstFileResponse = new List <FileBase>();
                string          responseMessage = null;

                if (htBaoCao.MA_BAOCAO.Equals(DatabaseConstant.DanhSachBaoCaoTheoDinhKy.TDVM_PHIEU_THEO_DOI_HOAN_TRA_TVIEN.layMaBaoCao()))
                {
                    retStatus = process.LayDuLieu(htBaoCao, listHtBaoCaoTso, ref lstFileResponse, ref responseMessage, ds, action);
                }
                else
                {
                    retStatus = process.LayDuLieu(htBaoCao, listHtBaoCaoTso, ref fileResponse, ref responseMessage, ds, action);
                }

                if (retStatus == ApplicationConstant.ResponseStatus.THANH_CONG)
                {
                    string fileReport   = "";
                    string folderReport = ClientInformation.TempDir;
                    if (!lstFileResponse.IsNullOrEmpty() && lstFileResponse.Count > 0)
                    {
                        folderReport = ClientInformation.TempDir + "\\Hoan_Tra_TV";
                        if (Directory.Exists(folderReport))
                        {
                            LFile.DeleteFolder(folderReport);
                            Directory.CreateDirectory(folderReport);
                        }
                        else
                        {
                            Directory.CreateDirectory(folderReport);
                        }
                        foreach (FileBase item in lstFileResponse)
                        {
                            ShowFile(ref folderReport, ref fileReport, false, item, listThamSoBaoCao);
                        }
                    }
                    else
                    {
                        ShowFile(ref folderReport, ref fileReport, true, fileResponse, listThamSoBaoCao);
                    }
                    if (htBaoCao.MA_BAOCAO.Equals(DatabaseConstant.DanhSachBaoCaoTheoDinhKy.GDKT_KET_XUAT_BCDKT_THEO_CAU_TRUC.layMaBaoCao()))
                    {
                        folderReport = System.Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
                    }
                }
                else
                {
                    Mouse.OverrideCursor = Cursors.Arrow;
                    LMessage.ShowMessage(responseMessage, LMessage.MessageBoxType.Error);
                    return;
                }

                /*
                 * FileBase fileResponse = process.LayDuLieuBaoCao();
                 * string fileReport = ClientInformation.TempDir + "\\" + fileResponse.FileName + ".pdf";
                 * LFile.WriteFileFromByteArray(fileResponse.FileData, fileReport);
                 *
                 * // show file
                 * Stream stream = LFile.ConvertByteArrayToStream(fileResponse.FileData);
                 *
                 * System.Diagnostics.Process.Start(fileReport);
                 */
            }
            catch (System.Exception ex)
            {
                Mouse.OverrideCursor = Cursors.Arrow;
                CommonFunction.ThongBaoLoi(ex);
                LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex);
            }
        }
Exemple #19
0
        public List <ThamSoBaoCao> GetParameters()
        {
            if (!Validation())
            {
                LMessage.ShowMessage("Thiếu tham số cho báo cáo.", LMessage.MessageBoxType.Information);
                return(null);
            }

            GetFormData();

            List <ThamSoBaoCao> listThamSoBaoCao = new List <ThamSoBaoCao>();

            //listThamSoBaoCao.Add(new ThamSoBaoCao("P_TenNguoiLap", TenNguoiLap, ApplicationConstant.LoaiThamSoBaoCao.GUI.layGiaTri()));
            listThamSoBaoCao.Add(new ThamSoBaoCao("P_TenChiNhanh", TenChiNhanh, ApplicationConstant.LoaiThamSoBaoCao.GUI.layGiaTri()));
            //listThamSoBaoCao.Add(new ThamSoBaoCao("P_TenPGD", TenPhongGiaoDich, ApplicationConstant.LoaiThamSoBaoCao.GUI.layGiaTri()));
            listThamSoBaoCao.Add(new ThamSoBaoCao("P_TuNgay", TuNgay, ApplicationConstant.LoaiThamSoBaoCao.GUI.layGiaTri()));
            listThamSoBaoCao.Add(new ThamSoBaoCao("P_DenNgay", DenNgay, ApplicationConstant.LoaiThamSoBaoCao.GUI.layGiaTri()));
            //listThamSoBaoCao.Add(new ThamSoBaoCao("P_NgayMoSo", TuNgay, ApplicationConstant.LoaiThamSoBaoCao.GUI.layGiaTri()));
            listThamSoBaoCao.Add(new ThamSoBaoCao("P_NguoiLap", ClientInformation.HoTen, ApplicationConstant.LoaiThamSoBaoCao.GUI.layGiaTri()));
            listThamSoBaoCao.Add(new ThamSoBaoCao("P_NgayBaoCao", NgayBaoCao, ApplicationConstant.LoaiThamSoBaoCao.GUI.layGiaTri()));

            foreach (string ChiNhanh in MaChiNhanh)
            {
                listThamSoBaoCao.Add(new ThamSoBaoCao("@MaChiNhanh", ChiNhanh, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));
            }
            foreach (string PhongGD in MaPhongGiaoDich)
            {
                listThamSoBaoCao.Add(new ThamSoBaoCao("@MaPhongGiaoDich", PhongGD, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));
            }

            foreach (string CanBo in IDCanBo)
            {
                listThamSoBaoCao.Add(new ThamSoBaoCao("@MaCanBo", CanBo, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));
            }

            foreach (string Xa in IDXa)
            {
                listThamSoBaoCao.Add(new ThamSoBaoCao("@MaKhuVuc", Xa, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));
            }

            foreach (string Ap in IDAp)
            {
                listThamSoBaoCao.Add(new ThamSoBaoCao("@MaCum", Ap, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));
            }

            foreach (string Nhom in IDNhom)
            {
                listThamSoBaoCao.Add(new ThamSoBaoCao("@MaNhom", Nhom, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));
            }

            //foreach (string KHang in IDKhang)
            //{
            //    listThamSoBaoCao.Add(new ThamSoBaoCao("@MaKHang", KHang, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));
            //}
            foreach (DataRowView drv in grSoTienGuiDS.SelectedItems)
            {
                listThamSoBaoCao.Add(new ThamSoBaoCao("@MaKhachHang", drv["ID"].ToString() + "#" + drv["MA_KHANG"].ToString() + "#" +
                                                      drv["TEN_KHANG"].ToString() + "#" + drv["SO_TIEN"].ToString(), ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));
            }

            listThamSoBaoCao.Add(new ThamSoBaoCao("@TenChiNhanh", TenChiNhanh, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));
            listThamSoBaoCao.Add(new ThamSoBaoCao("@TenPhongGiaoDich", TenPhongGiaoDich, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));
            listThamSoBaoCao.Add(new ThamSoBaoCao("@NgayPhatVon", TuNgay, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));
            listThamSoBaoCao.Add(new ThamSoBaoCao("@DenNgay", DenNgay, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));
            //listThamSoBaoCao.Add(new ThamSoBaoCao("@MaLoaiTien", MaLoaiTien, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));
            listThamSoBaoCao.Add(new ThamSoBaoCao("@LoaiTK", "TKTH", ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));
            listThamSoBaoCao.Add(new ThamSoBaoCao("@NguoiLap", ClientInformation.HoTen, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));
            listThamSoBaoCao.Add(new ThamSoBaoCao("@NgayBaoCao", NgayBaoCao, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));

            listThamSoBaoCao.Add(new ThamSoBaoCao("@P_MaDonVi", ClientInformation.MaDonVi, ApplicationConstant.LoaiThamSoBaoCao.GUIPARAM.layGiaTri()));
            IDNhom = new List <string>();
            AutoCompleteEntry auNhom = lstSourceNhom.ElementAt(cmbNhom.SelectedIndex);

            IDNhom.Add(auNhom.KeywordStrings[3]);


            listThamSoBaoCao.Add(new ThamSoBaoCao("MaNgonNgu", MaNgonNgu, ApplicationConstant.LoaiThamSoBaoCao.LANG.layGiaTri()));
            listThamSoBaoCao.Add(new ThamSoBaoCao("MaDinhDang", MaDinhDang, ApplicationConstant.LoaiThamSoBaoCao.FORMAT.layGiaTri()));

            return(listThamSoBaoCao);
        }
Exemple #20
0
        public List <ThamSoBaoCao> GetParameters()
        {
            string msg = "";

            if (!Validation(ref msg))
            {
                if (msg.IsNullOrEmptyOrSpace())
                {
                    LMessage.ShowMessage("Thiếu tham số cho báo cáo.", LMessage.MessageBoxType.Information);
                }
                else
                {
                    LMessage.ShowMessage(msg, LMessage.MessageBoxType.Information);
                }
                return(null);
            }

            GetFormData();

            List <ThamSoBaoCao> listThamSoBaoCao = new List <ThamSoBaoCao>();

            if (MaChiNhanh.Equals("%"))
            {
                foreach (AutoCompleteEntry item in lstSourceChiNhanh)
                {
                    string ma = item.KeywordStrings.First();
                    if (!ma.Equals("%"))
                    {
                        listThamSoBaoCao.Add(new ThamSoBaoCao("@DSChiNhanh", ma, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));
                    }
                }
            }
            else
            {
                listThamSoBaoCao.Add(new ThamSoBaoCao("@DSChiNhanh", MaChiNhanh, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));
            }
            if (MaPhongGiaoDich.Equals("%"))
            {
                foreach (AutoCompleteEntry item in lstSourcePhongGD_Select)
                {
                    string ma = item.KeywordStrings.First();
                    if (!ma.Equals("%"))
                    {
                        listThamSoBaoCao.Add(new ThamSoBaoCao("@DSPhongGD", ma, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));
                    }
                }
            }
            else
            {
                listThamSoBaoCao.Add(new ThamSoBaoCao("@DSPhongGD", MaPhongGiaoDich, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));
            }
            if (MaCum.Equals("%"))
            {
                foreach (AutoCompleteEntry item in lstSourceCum_Select)
                {
                    string ma = item.KeywordStrings.First();
                    if (!ma.Equals("%"))
                    {
                        listThamSoBaoCao.Add(new ThamSoBaoCao("@DSCum", ma, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));
                    }
                }
            }
            else
            {
                listThamSoBaoCao.Add(new ThamSoBaoCao("@DSCum", MaCum, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));
            }
            listThamSoBaoCao.Add(new ThamSoBaoCao("@NgayBaoCao", NgayBaoCao, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));
            listThamSoBaoCao.Add(new ThamSoBaoCao("@MaKhachHang", txtMaKhachHang.Text, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));

            listThamSoBaoCao.Add(new ThamSoBaoCao("MaNgonNgu", MaNgonNgu, ApplicationConstant.LoaiThamSoBaoCao.LANG.layGiaTri()));
            listThamSoBaoCao.Add(new ThamSoBaoCao("MaDinhDang", MaDinhDang, ApplicationConstant.LoaiThamSoBaoCao.FORMAT.layGiaTri()));

            return(listThamSoBaoCao);
        }
        public List <ThamSoBaoCao> GetParameters()
        {
            if (!Validation())
            {
                LMessage.ShowMessage("Thiếu tham số cho báo cáo.", LMessage.MessageBoxType.Information);
                return(null);
            }

            GetFormData();

            List <ThamSoBaoCao> listThamSoBaoCao = new List <ThamSoBaoCao>();

            //listThamSoBaoCao.Add(new ThamSoBaoCao("P_TenNguoiLap", TenNguoiLap, ApplicationConstant.LoaiThamSoBaoCao.GUI.layGiaTri()));
            listThamSoBaoCao.Add(new ThamSoBaoCao("P_TenChiNhanh", TenChiNhanh, ApplicationConstant.LoaiThamSoBaoCao.GUI.layGiaTri()));
            //listThamSoBaoCao.Add(new ThamSoBaoCao("P_TenPGD", TenPhongGiaoDich, ApplicationConstant.LoaiThamSoBaoCao.GUI.layGiaTri()));
            listThamSoBaoCao.Add(new ThamSoBaoCao("P_NgayChotDL", NgayChotDL, ApplicationConstant.LoaiThamSoBaoCao.GUI.layGiaTri()));
            //listThamSoBaoCao.Add(new ThamSoBaoCao("P_NgayMoSo", TuNgay, ApplicationConstant.LoaiThamSoBaoCao.GUI.layGiaTri()));
            listThamSoBaoCao.Add(new ThamSoBaoCao("P_NguoiLap", ClientInformation.HoTen, ApplicationConstant.LoaiThamSoBaoCao.GUI.layGiaTri()));
            listThamSoBaoCao.Add(new ThamSoBaoCao("P_NgayBaoCao", NgayBaoCao, ApplicationConstant.LoaiThamSoBaoCao.GUI.layGiaTri()));

            foreach (string ChiNhanh in MaChiNhanh)
            {
                listThamSoBaoCao.Add(new ThamSoBaoCao("@MaChiNhanh", ChiNhanh, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));
            }
            foreach (string PhongGD in MaPhongGiaoDich)
            {
                listThamSoBaoCao.Add(new ThamSoBaoCao("@MaPhongGiaoDich", PhongGD, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));
            }

            foreach (string Xa in IDXa)
            {
                listThamSoBaoCao.Add(new ThamSoBaoCao("@IDKhuVuc", Xa, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));
            }

            foreach (string Ap in IDAp)
            {
                listThamSoBaoCao.Add(new ThamSoBaoCao("@IDCum", Ap, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));
            }

            foreach (string Nhom in IDNhom)
            {
                listThamSoBaoCao.Add(new ThamSoBaoCao("@IDNhom", Nhom, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));
            }

            foreach (string NguonVon in lstNguonVon)
            {
                listThamSoBaoCao.Add(new ThamSoBaoCao("@MaNguonVon", NguonVon, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));
            }

            foreach (string LoaiSP in lstMaLoaiSP)
            {
                listThamSoBaoCao.Add(new ThamSoBaoCao("@MaLoaiSP", LoaiSP, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));
            }

            for (int i = 0; i < lstMaSanPham.Count; i++)
            {
                listThamSoBaoCao.Add(new ThamSoBaoCao("@MaSanPham", lstMaSanPham[i], ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));
            }

            foreach (string NhomNo in lstNhomNo)
            {
                listThamSoBaoCao.Add(new ThamSoBaoCao("@MaNhomNo", NhomNo, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));
            }

            listThamSoBaoCao.Add(new ThamSoBaoCao("@TenChiNhanh", TenChiNhanh, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));
            listThamSoBaoCao.Add(new ThamSoBaoCao("@TenPhongGiaoDich", TenPhongGiaoDich, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));
            listThamSoBaoCao.Add(new ThamSoBaoCao("@NguoiLap", ClientInformation.HoTen, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));
            listThamSoBaoCao.Add(new ThamSoBaoCao("@NgayBaoCao", NgayBaoCao, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));
            listThamSoBaoCao.Add(new ThamSoBaoCao("@NgayChotDL", NgayChotDL, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri()));

            listThamSoBaoCao.Add(new ThamSoBaoCao("@P_MaDonVi", ClientInformation.MaDonVi, ApplicationConstant.LoaiThamSoBaoCao.GUIPARAM.layGiaTri()));
            IDNhom = new List <string>();



            listThamSoBaoCao.Add(new ThamSoBaoCao("MaNgonNgu", MaNgonNgu, ApplicationConstant.LoaiThamSoBaoCao.LANG.layGiaTri()));
            listThamSoBaoCao.Add(new ThamSoBaoCao("MaDinhDang", MaDinhDang, ApplicationConstant.LoaiThamSoBaoCao.FORMAT.layGiaTri()));

            return(listThamSoBaoCao);
        }
        private void Login()
        {
            try
            {
                // @TrườngNX on 20120905
                // Lựa chọn ngôn ngữ của phiên làm việc
                // Căn cứ vào ngôn ngữ, load file language resources tương ứng
                //this.Cursor = Cursors.Wait;

                //var process = new ZAMainAppProcess();
                string userName = txtUsername.Text;
                string txtMD5   = LSecurity.MD5Encrypt(txtPassword.Password);
                //process.createSession();
                string       responseMessage = "";
                NGON_NGU_DTO ngonNguDTO      = null;
                bool         ret             = process.doLoginWithSession(userName, txtMD5, ref ngonNguDTO, ref responseMessage);

                // Nếu thành công
                if (ret)
                {
                    // Nếu yêu cầu cập nhật phiên bản
                    if (responseMessage != null &&
                        responseMessage.Equals(ApplicationConstant.CommonResponseMessage.M_ResponseMessage_Common_NotLatestVersion.layGiaTri())
                        )
                    {
                        //MessageBoxResult retQuestion = LMessage.ShowMessage(responseMessage, LMessage.MessageBoxType.Question);
                        //if (retQuestion == MessageBoxResult.Yes)
                        //{
                        //    // Cập nhật phiên bản
                        //}
                        //else
                        //{
                        //}

                        MessageBoxResult retMessage = LMessage.ShowMessage(responseMessage, LMessage.MessageBoxType.Question);
                        if (retMessage == MessageBoxResult.Yes)
                        {
                            UserControl p             = null;
                            bool        stretchWindow = false;
                            p = new PresentationWPF.QuanTriHeThong.PhienBan.ucPhienBanCapNhat();

                            if (p != null)
                            {
                                Window window = new Window
                                {
                                    Title = LLanguage.SearchResourceByKey("MENU.152_CAP_NHAT_PB"),
                                    WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
                                    //Icon = (rmb.ImageSource == null ? this.Icon : rmb.ImageSource),
                                    Width   = (Double.IsNaN(p.Width) ? 1024 : p.Width),
                                    Height  = (Double.IsNaN(p.Height) ? 700 : p.Height),
                                    Content = p,
                                };
                                if (stretchWindow == true)
                                {
                                    window.WindowState = WindowState.Maximized;
                                }
                                window.Width      = 500;
                                window.Height     = 150;
                                window.ResizeMode = ResizeMode.NoResize;

                                //Mouse.OverrideCursor = Cursors.Arrow;
                                this.Close();
                                window.ShowDialog();
                            }
                            else
                            {
                                Mouse.OverrideCursor = Cursors.Arrow;
                                LMessage.ShowMessage("Không tìm thấy chức năng này", LMessage.MessageBoxType.Warning);
                            }
                        }
                    }

                    ClientInformation.NgonNgu = ((RadComboBoxItem)cboLanguage.SelectedItem).Tag.ToString();

                    // @Truonglq set Culture ngôn ngữ cho  Coltrol (telerik)
                    //CultureInfo culture = new CultureInfo(((RadComboBoxItem)cboLanguage.SelectedItem).Tag.ToString());
                    //System.Threading.Thread.CurrentThread.CurrentCulture = culture;
                    //System.Threading.Thread.CurrentThread.CurrentUICulture = culture;
                    InitializeCultures();
                    //InitializeCulturesTelerik();
                    LocalizationManager.Manager = new LocalizationManager()
                    {
                        ResourceManager = LocalizationRadControl.ResourceManager
                    };

                    // Khởi tạo phiên làm việc, chọn đơn vị nghiệp vụ cần thao tác dữ liệu
                    if (!ClientInformation.LoaiNguoiSuDung.Equals(BusinessConstant.LoaiNguoiSuDung.CAP_SA.layGiaTri()))
                    {
                        InitSession initSession = new InitSession(ClientInformation.ListPhongGD);

                        initSession.ResizeMode            = ResizeMode.NoResize;
                        initSession.Height                = 250;
                        initSession.Width                 = 600;
                        initSession.WindowStartupLocation = WindowStartupLocation.CenterScreen;

                        initSession.lblNguoiDungValue.Content = "(" + ClientInformation.TenDangNhap + ") " + ClientInformation.HoTen;
                        initSession.lblChiNhanhValue.Content  = "(" + ClientInformation.MaDonVi + ") " + ClientInformation.TenDonVi;
                        //initSession.ListPhongGD = ClientInformation.ListPhongGD;

                        initSession.Show();
                        this.Cursor = Cursors.Arrow;
                        Close();
                    }
                    else
                    {
                        ClientInformation.TenDonViGiaoDich   = ClientInformation.TenDonVi;
                        ClientInformation.MaDonViGiaoDich    = ClientInformation.MaDonVi;
                        ClientInformation.IdDonViGiaoDich    = ClientInformation.IdDonVi;
                        ClientInformation.PhuongPhapHachToan = null;

                        MainWindow mainwindow = new MainWindow();
                        mainwindow.Show();
                        this.Cursor = Cursors.Arrow;
                        Close();
                    }
                }
                else
                {
                    ImageBehavior.SetAnimatedSource(imgWaiting, null);

                    // Nếu yêu cầu đổi mật khẩu
                    if (responseMessage != null &&
                        (
                            responseMessage.Equals(ApplicationConstant.LoginResponseMessage.M_ResponseMessage_Login_YeuCauDoiMatKhauLanDau.layGiaTri()) ||
                            responseMessage.Equals(ApplicationConstant.LoginResponseMessage.M_ResponseMessage_Login_YeuCauDoiMatKhau.layGiaTri())
                        )
                        )
                    {
                        MessageBoxResult retQuestion = LMessage.ShowMessage(responseMessage, LMessage.MessageBoxType.Question);
                        if (retQuestion == MessageBoxResult.Yes)
                        {
                            txtPassword.Clear();

                            ChangePassword changePassword = new ChangePassword();
                            Window         window         = new Window();

                            window.ResizeMode            = ResizeMode.NoResize;
                            window.Height                = 180;
                            window.Width                 = 500;
                            window.WindowStartupLocation = WindowStartupLocation.CenterScreen;
                            window.Title                 = LLanguage.SearchResourceByKey("U.ZAMainApp.ChangePassword.Title");
                            window.Content               = changePassword;

                            changePassword.userName = userName;
                            window.ShowDialog();
                            //LMessage.ShowMessage("Change pass", LMessage.MessageBoxType.Warning);
                        }
                        else
                        {
                            return;
                        }
                    }
                    else
                    {
                        LMessage.ShowMessage(responseMessage, LMessage.MessageBoxType.Warning);
                    }
                }
            }
            //else
            catch (Exception ex)
            {
                ImageBehavior.SetAnimatedSource(imgWaiting, null);

                //this.Close();
                //Application.Current.Shutdown();
                this.Cursor = Cursors.Arrow;
                if (ex.GetType() == typeof(CustomException))
                {
                    new frmThongBaoLoi(ex.Message, ex.InnerException).ShowDialog();
                }
                else
                {
                    if (ex.InnerException != null)
                    {
                        if (ex.InnerException.GetType() == typeof(CustomException))
                        {
                            new frmThongBaoLoi(ex.InnerException.Message, ex.InnerException).ShowDialog();
                        }
                        else
                        {
                            new frmThongBaoLoi("M.ResponseMessage.Login.KhongThanhCong", ex).ShowDialog();
                        }
                    }
                    else
                    {
                        new frmThongBaoLoi("M.ResponseMessage.Login.KhongThanhCong", ex).ShowDialog();
                    }
                }
                LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex);
            }
        }
Exemple #23
0
        public static void SaveConfiguration(string name, string ip, string port, string companyCode)
        {
            try
            {
                string ApplicationPath = AppDomain.CurrentDomain.BaseDirectory;
                //  Create new DataTable.
                DataTable dt = new DataTable("Config");
                DataSet   ds = new DataSet("Framework");
                //  Declare DataColumn and DataRow variables.
                DataColumn dc;
                DataRow    dr;

                dc            = new DataColumn();
                dc.DataType   = System.Type.GetType("System.String");
                dc.ColumnName = "Company";
                dt.Columns.Add(dc);

                dc            = new DataColumn();
                dc.DataType   = System.Type.GetType("System.String");
                dc.ColumnName = "ClientType";
                dt.Columns.Add(dc);

                dc            = new DataColumn();
                dc.DataType   = System.Type.GetType("System.String");
                dc.ColumnName = "WorkingDir";
                dt.Columns.Add(dc);

                dc            = new DataColumn();
                dc.DataType   = Type.GetType("System.String");
                dc.ColumnName = "ConfigDir";
                dt.Columns.Add(dc);

                dc            = new DataColumn();
                dc.DataType   = Type.GetType("System.String");
                dc.ColumnName = "DataDir";
                dt.Columns.Add(dc);

                dc            = new DataColumn();
                dc.DataType   = Type.GetType("System.String");
                dc.ColumnName = "HelpDir";
                dt.Columns.Add(dc);

                dc            = new DataColumn();
                dc.DataType   = Type.GetType("System.String");
                dc.ColumnName = "ImagesDir";
                dt.Columns.Add(dc);

                dc            = new DataColumn();
                dc.DataType   = Type.GetType("System.String");
                dc.ColumnName = "LanguagesDir";
                dt.Columns.Add(dc);

                dc            = new DataColumn();
                dc.DataType   = Type.GetType("System.String");
                dc.ColumnName = "TempDir";
                dt.Columns.Add(dc);

                dc            = new DataColumn();
                dc.DataType   = Type.GetType("System.String");
                dc.ColumnName = "IconName";
                dt.Columns.Add(dc);

                dc            = new DataColumn();
                dc.DataType   = Type.GetType("System.String");
                dc.ColumnName = "ShortName";
                dt.Columns.Add(dc);

                dc            = new DataColumn();
                dc.DataType   = Type.GetType("System.String");
                dc.ColumnName = "FullName";
                dt.Columns.Add(dc);

                dc            = new DataColumn();
                dc.DataType   = Type.GetType("System.String");
                dc.ColumnName = "Theme";
                dt.Columns.Add(dc);

                dc            = new DataColumn();
                dc.DataType   = Type.GetType("System.String");
                dc.ColumnName = "LanguageList";
                dt.Columns.Add(dc);

                dc            = new DataColumn();
                dc.DataType   = Type.GetType("System.String");
                dc.ColumnName = "VersionDir";
                dt.Columns.Add(dc);

                dc            = new DataColumn();
                dc.DataType   = Type.GetType("System.String");
                dc.ColumnName = "BackupVersionDir";
                dt.Columns.Add(dc);

                dc            = new DataColumn();
                dc.DataType   = Type.GetType("System.String");
                dc.ColumnName = "CurrentVersionDir";
                dt.Columns.Add(dc);

                dc            = new DataColumn();
                dc.DataType   = Type.GetType("System.String");
                dc.ColumnName = "DefaultVersionDir";
                dt.Columns.Add(dc);

                dc            = new DataColumn();
                dc.DataType   = Type.GetType("System.String");
                dc.ColumnName = "OtaVersionDir";
                dt.Columns.Add(dc);

                dc            = new DataColumn();
                dc.DataType   = Type.GetType("System.String");
                dc.ColumnName = "Log4NetConfig";
                dt.Columns.Add(dc);

                dc            = new DataColumn();
                dc.DataType   = Type.GetType("System.String");
                dc.ColumnName = "Log4NetUpdConfig";
                dt.Columns.Add(dc);

                dc            = new DataColumn();
                dc.DataType   = Type.GetType("System.String");
                dc.ColumnName = "Log4NetOutput";
                dt.Columns.Add(dc);

                dc            = new DataColumn();
                dc.DataType   = Type.GetType("System.String");
                dc.ColumnName = "ServerList";
                dt.Columns.Add(dc);

                dc            = new DataColumn();
                dc.DataType   = Type.GetType("System.String");
                dc.ColumnName = "ServerName";
                dt.Columns.Add(dc);

                dc            = new DataColumn();
                dc.DataType   = Type.GetType("System.String");
                dc.ColumnName = "ServerIP";
                dt.Columns.Add(dc);

                dc            = new DataColumn();
                dc.DataType   = Type.GetType("System.String");
                dc.ColumnName = "ServerPort";
                dt.Columns.Add(dc);

                dc            = new DataColumn();
                dc.DataType   = Type.GetType("System.String");
                dc.ColumnName = "License";
                dt.Columns.Add(dc);

                dc            = new DataColumn();
                dc.DataType   = Type.GetType("System.String");
                dc.ColumnName = "Version";
                dt.Columns.Add(dc);

                //  Create new DataRow objects and add to DataTable.
                DataTable dtConfig = ClientInformation.DataTableConfig;
                dr                      = dt.NewRow();
                dr["Company"]           = companyCode.Equals("") ? dtConfig.Rows[0]["Company"].ToString() : companyCode;
                dr["ClientType"]        = dtConfig.Rows[0]["ClientType"].ToString();
                dr["WorkingDir"]        = dtConfig.Rows[0]["WorkingDir"].ToString();
                dr["ConfigDir"]         = dtConfig.Rows[0]["ConfigDir"].ToString();
                dr["DataDir"]           = dtConfig.Rows[0]["DataDir"].ToString();
                dr["HelpDir"]           = dtConfig.Rows[0]["HelpDir"].ToString();
                dr["ImagesDir"]         = dtConfig.Rows[0]["ImagesDir"].ToString();
                dr["LanguagesDir"]      = dtConfig.Rows[0]["LanguagesDir"].ToString();
                dr["TempDir"]           = dtConfig.Rows[0]["TempDir"].ToString();
                dr["IconName"]          = dtConfig.Rows[0]["IconName"].ToString();
                dr["ShortName"]         = dtConfig.Rows[0]["ShortName"].ToString();
                dr["FullName"]          = dtConfig.Rows[0]["FullName"].ToString();
                dr["Theme"]             = dtConfig.Rows[0]["Theme"].ToString();
                dr["LanguageList"]      = dtConfig.Rows[0]["LanguageList"].ToString();
                dr["VersionDir"]        = dtConfig.Rows[0]["VersionDir"].ToString();
                dr["BackupVersionDir"]  = dtConfig.Rows[0]["BackupVersionDir"].ToString();
                dr["CurrentVersionDir"] = dtConfig.Rows[0]["CurrentVersionDir"].ToString();
                dr["DefaultVersionDir"] = dtConfig.Rows[0]["DefaultVersionDir"].ToString();
                dr["OtaVersionDir"]     = dtConfig.Rows[0]["OtaVersionDir"].ToString();
                dr["Log4NetConfig"]     = dtConfig.Rows[0]["Log4NetConfig"].ToString();
                dr["Log4NetUpdConfig"]  = dtConfig.Rows[0]["Log4NetUpdConfig"].ToString();
                dr["Log4NetOutput"]     = dtConfig.Rows[0]["Log4NetOutput"].ToString();
                dr["ServerList"]        = dtConfig.Rows[0]["ServerList"].ToString();
                dr["ServerName"]        = name; ClientInformation.ServerName = name;
                dr["ServerIP"]          = ip; ClientInformation.ServerIP = ip;
                dr["ServerPort"]        = port; ClientInformation.ServerPort = port;
                dr["License"]           = dtConfig.Rows[0]["License"].ToString();
                dr["Version"]           = dtConfig.Rows[0]["Version"].ToString();

                dt.Rows.Add(dr);
                ds.Tables.Add(dt);

                string systemPath   = AppDomain.CurrentDomain.SetupInformation.ApplicationBase;
                string filePath     = systemPath + "config\\config.conf";
                string filePathTemp = systemPath + "config\\config.conf_";
                ds.WriteXml(filePathTemp);

                string keyEncrypt = "!=Q|A'Z?";
                if (LSecurity.DESEncryptFile(filePathTemp, filePath, keyEncrypt))
                {
                    new ClientInitProcess().docLaiThongTinCauHinhClient(dt);
                    LMessage.ShowMessage("Thay đổi thông tin kết nối thành công", LMessage.MessageBoxType.Information);
                }
                else
                {
                }
                LFile.DeleteFile(filePathTemp);
            }
            catch (Exception ex)
            {
                LMessage.ShowMessage("SaveConfiguration", LMessage.MessageBoxType.Warning);
                LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex);
            }
        }
Exemple #24
0
 public override void RegisterEvent()
 {
     base.RegisterEvent();
     LMessage.AddListener <int, int>(LoadEvent.LoadProgressUpdate, OnLoadUpdate);
 }
Exemple #25
0
        /// <summary>
        /// Load dữ liệu
        /// </summary>
        private void LoadDuLieu()
        {
            Cursor = Cursors.Wait;
            try
            {
                TinDungProcess tindungProcess = new TinDungProcess();
                string         lstTrangThai   = ucTrangThai.GetItemsSelected();
                string         sMaVongVay     = txtMaVongVay.Text;
                string         sNgayLapTu     = teldtNgayLapTu.Value != null?LDateTime.DateToString((DateTime)teldtNgayLapTu.Value, ApplicationConstant.defaultDateTimeFormat) : "";

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

                string sHanMucGocVay = lstHanMucGocVay.ElementAt(cmbTinhChatGocVay.SelectedIndex).KeywordStrings.First();
                string sHanMucKyHan  = lstHanMucKyHan.ElementAt(cmbTinhChatKyHan.SelectedIndex).KeywordStrings.First();
                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 if (((RadTreeViewItem)tvwKhuVuc.SelectedItem).Tag.ToString().Substring(0, 3).Equals("CNH"))
                {
                    ListKVuc = ((RadTreeViewItem)tvwKhuVuc.SelectedItem).Tag.ToString();
                }
                else if (((RadTreeViewItem)tvwKhuVuc.SelectedItem).Tag.ToString().Substring(0, 3).Equals("PGD"))
                {
                    ListKVuc = ((RadTreeViewItem)((RadTreeViewItem)tvwKhuVuc.SelectedItem).Parent).Tag.ToString();
                }
                else if (((RadTreeViewItem)tvwKhuVuc.SelectedItem).Tag.ToString().Substring(0, 3).Equals("CUM"))
                {
                    ListKVuc = ((RadTreeViewItem)((RadTreeViewItem)((RadTreeViewItem)tvwKhuVuc.SelectedItem).Parent).Parent).Tag.ToString();
                }
                DataSet ds = tindungProcess.getDanhSachVongVonVay(lstTrangThai, sMaVongVay, sNgayLapTu, sNgayLapDen, sHanMucGocVay, sHanMucKyHan, "%", ListKVuc);
                if (ds != null & ds.Tables[0].Columns.Count > 0)
                {
                    dgrVongVayDS.ItemsSource = null;
                    dgrVongVayDS.ItemsSource = ds.Tables[0].DefaultView;
                    if (!LObject.IsNullOrEmpty(dgrVongVayDS.SelectedItems))
                    {
                        dgrVongVayDS.SelectedItems.Clear();
                    }
                }
            }
            catch (Exception ex)
            {
                LMessage.ShowMessage("M.DanhMuc.LoiChung", LMessage.MessageBoxType.Error);
                LLogging.WriteLog(ex.TargetSite.Name, LLogging.LogType.ERR, ex);
            }
            Cursor = Cursors.Arrow;
        }
Exemple #26
0
 public _Runnable(LLKScreen s, LMessage m)
 {
     this.screen  = s;
     this.message = m;
 }
Exemple #27
0
        /// <summary>
        /// Trước khi xóa
        /// </summary>
        private void BeforeDelete()
        {
            try
            {
                List <DataRowView> listDataRow = getListSeletedDataRow();

                if (listDataRow != null)
                {
                    if (listDataRow.Count == 0)
                    {
                        LMessage.ShowMessage("M.DungChung.ChuaChonBanGhi", LMessage.MessageBoxType.Warning);
                        return;
                    }
                    else
                    {
                        // Lấy danh sách dữ liệu cần xử lý
                        List <int> listId = new List <int>();
                        foreach (DataRowView dr in listDataRow)
                        {
                            int id = int.Parse(dr["id"].ToString());
                            listId.Add(id);
                        }

                        // Cảnh báo người dùng
                        MessageBoxResult ret = LMessage.ShowMessage("M.DungChung.HoiXoa", LMessage.MessageBoxType.Question);
                        if (ret == MessageBoxResult.Yes)
                        {
                            // Yêu cầu lock bản ghi cần xử lý
                            UtilitiesProcess process      = new UtilitiesProcess();
                            List <int>       listLockedId = new List <int>();

                            bool retLockData = process.LockData(DatabaseConstant.Module.DMDC,
                                                                DatabaseConstant.Function.DC_DM_NHOM_DS,
                                                                DatabaseConstant.Table.DM_NHOM,
                                                                DatabaseConstant.Action.XOA,
                                                                listId);

                            // Nếu lock thành công >> cho phép xử lý
                            if (retLockData)
                            {
                                OnDelete(listId);
                            }
                            else
                            {
                                LMessage.ShowMessage("M.ResponseMessage.Common.LockDataInvalid", LMessage.MessageBoxType.Information);
                            }
                        }
                    }
                }
                else
                {
                    LMessage.ShowMessage("M.DungChung.LoiChonDuLieu", LMessage.MessageBoxType.Warning);
                    return;
                }
            }
            catch (Exception ex)
            {
                CommonFunction.ThongBaoLoi(ex);
                LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex);
            }
        }
Exemple #28
0
        private void Luu()
        {
            //Mouse.OverrideCursor = Cursors.Wait;
            try
            {
                string loaiDoiTuong = null;
                loaiDoiTuong = lstSourceLoaiDTuong.ElementAt(cmbDoiTuong.SelectedIndex).KeywordStrings.First();
                DataRow dr = (DataRow)grDSDoiTuong.SelectedItem;
                if (dr != null)
                {
                    PHAM_VI objPhamVi = new PHAM_VI();
                    objPhamVi.ID_DTUONG      = int.Parse(dr["ID"].ToString());
                    objPhamVi.MA_DTUONG      = dr[2].ToString();
                    objPhamVi.MA_DVI_QLY     = dr[5].ToString();
                    objPhamVi.MA_DVI_TAO     = ClientInformation.MaDonViGiaoDich;
                    objPhamVi.MA_DTUONG_LOAI = loaiDoiTuong;
                    objPhamVi.MA_PVI_LOAI    = lstSourceLoaiPhamVi.ElementAt(cmbLoaiPhamVi.SelectedIndex).KeywordStrings.First();
                    int           idxMA_PVI   = 0;
                    List <string> lstMaPhamVi = new List <string>();
                    foreach (RadTreeViewItem item in trvTreeDonVi.CheckedItems)
                    {
                        //if (item.Level == 2)
                        //{
                        //    lstMaPhamVi.Add(item.Tag.ToString());
                        //}
                        lstMaPhamVi.Add(item.Tag.ToString());
                    }

                    objPhamVi.MA_PVI    = new string[lstMaPhamVi.Count];
                    objPhamVi.ID_PVI    = new int[lstMaPhamVi.Count];
                    objPhamVi.PHAN_LOAI = new string[lstMaPhamVi.Count];
                    foreach (string item in lstMaPhamVi)
                    {
                        string[] tag = item.Split('#');
                        objPhamVi.MA_PVI[idxMA_PVI]    = tag[0];
                        objPhamVi.PHAN_LOAI[idxMA_PVI] = tag[1];
                        objPhamVi.ID_PVI[idxMA_PVI]    = Int32.Parse(tag[2]);
                        idxMA_PVI++;
                    }
                    objPhamVi.NGUOI_NHAP  = ClientInformation.TenDangNhap;
                    objPhamVi.NGUOI_CNHAT = ClientInformation.TenDangNhap;
                    objPhamVi.NGAY_NHAP   = ClientInformation.NgayLamViecHienTai;
                    objPhamVi.NGAY_CNHAT  = ClientInformation.NgayLamViecHienTai;
                    QuanTriHeThongProcess process             = new QuanTriHeThongProcess();
                    string responseMessage                    = string.Empty;
                    ApplicationConstant.ResponseStatus status = process.LuuPhanQuyenPhamVi(ref objPhamVi, ref responseMessage);
                    if (status == ApplicationConstant.ResponseStatus.THANH_CONG)
                    {
                        LoadDuLieuPhanQuyen(objPhamVi);
                        LMessage.ShowMessage("M.DungChung.LuuDuLieuThanhCong", LMessage.MessageBoxType.Information);
                        //LMessage.ShowMessage(responseMessage, LMessage.MessageBoxType.Information);
                    }
                    else
                    {
                        LMessage.ShowMessage("M.DungChung.LuuDuLieuKhongThanhCong", LMessage.MessageBoxType.Warning);
                    }
                }
                else
                {
                    LMessage.ShowMessage("Choose object for role setting", LMessage.MessageBoxType.Warning);
                    return;
                }
            }
            catch (System.Exception ex)
            {
                CommonFunction.ThongBaoLoi(ex);
                LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex);
            }
            //Mouse.OverrideCursor = Cursors.Arrow;
        }