Example #1
0
        /// <summary>
        /// Xoa du lieu
        /// </summary>
        void Xoa()
        {
            DanhMucProcess danhmucProcess = new Presentation.Process.DanhMucProcess();

            try
            {
                if (idTinhTP == null)
                {
                    LMessage.ShowMessage("M.DungChung.XoaKhongThanhCong", LMessage.MessageBoxType.Warning);
                }
                else
                {
                    int[] listID = new int[1];
                    List <ClientResponseDetail> listResponseDetail = new List <ClientResponseDetail>();

                    listID[0] = idTinhTP;
                    if (danhmucProcess.XoaTinhTP(listID.ToArray(), ref listResponseDetail))
                    {
                        LMessage.ShowMessage("M.DungChung.XoaThanhCong", LMessage.MessageBoxType.Information);
                        if (OnSavingComleted != null)
                        {
                            OnSavingComleted(null, EventArgs.Empty);
                        }
                        PresentationWPF.CustomControl.CommonFunction.CloseUserControl(this);
                    }
                    else
                    {
                        LMessage.ShowMessage("M.DungChung.XoaKhongThanhCong", LMessage.MessageBoxType.Error);
                    }
                }
            }
            catch (Exception ex)
            {
                LLogging.WriteLog(ex.TargetSite.Name, LLogging.LogType.ERR, ex);
            }
        }
        private void LoadDSTaiKhoan()
        {
            try
            {
                string MaChiNhanh = "";
                string MaPhongGD  = "";
                string MaLoaiTien = "";
                if (cmbChiNhanh.Items.Count == 0)
                {
                    return;
                }
                if (cmbLoaiTien.Items.Count == 0)
                {
                    return;
                }
                if (cmbPhongGD.Items.Count == 0 || lstSourcePhongGD_Select.Count == 0)
                {
                    return;
                }
                MaChiNhanh = lstSourceChiNhanh.ElementAt(cmbChiNhanh.SelectedIndex).KeywordStrings.FirstOrDefault();
                MaPhongGD  = lstSourcePhongGD_Select.ElementAt(cmbPhongGD.SelectedIndex).KeywordStrings.FirstOrDefault();
                MaLoaiTien = lstSourceLoaiTien.ElementAt(cmbLoaiTien.SelectedIndex).KeywordStrings.FirstOrDefault();

                DataSet       dsTaiKhoan = new DataSet();
                BaoCaoProcess bcProcess  = new BaoCaoProcess();
                dsTaiKhoan = bcProcess.LayDanhSachTKhoanTGNH(MaChiNhanh, MaLoaiTien);
                if (dsTaiKhoan != null && dsTaiKhoan.Tables.Count > 0)
                {
                    grid.DataContext = dsTaiKhoan.Tables[0].DefaultView;
                }
            }
            catch (Exception ex)
            {
                LLogging.WriteLog(ex.TargetSite.Name, LLogging.LogType.ERR, ex);
            }
        }
        /// <summary>
        /// Xóa
        /// </summary>
        /// <param name="listId"></param>
        private void OnDelete(List <int> listId)
        {
            NhanSuProcess processNhanSu = new NhanSuProcess();

            Mouse.OverrideCursor = Cursors.Wait;
            try
            {
                List <ClientResponseDetail> listClientResponseDetail = new List <ClientResponseDetail>();
                List <NS_DM_QUAN_HUYEN>     lstDMQuanHuyen           = new List <NS_DM_QUAN_HUYEN>();
                NS_DM_QUAN_HUYEN            obj = null;
                foreach (int id in listId)
                {
                    obj    = new NS_DM_QUAN_HUYEN();
                    obj.ID = id;
                    lstDMQuanHuyen.Add(obj);
                }
                bool ret = processNhanSu.DanhSachQuanHuyen(DatabaseConstant.Action.XOA, ref lstDMQuanHuyen, ref listClientResponseDetail);

                AfterDelete(ret, listId, listClientResponseDetail);
            }
            catch (System.Exception ex)
            {
                // Yêu cầu unlock dữ liệu
                UtilitiesProcess process = new UtilitiesProcess();

                bool retUnlockData = process.UnlockData(DatabaseConstant.Module.NSTL,
                                                        DatabaseConstant.Function.NS_DM_QUAN_HUYEN_DS,
                                                        DatabaseConstant.Table.NS_DM_QUAN_HUYEN,
                                                        DatabaseConstant.Action.XOA,
                                                        listId);
                this.Cursor = Cursors.Arrow;
                CommonFunction.ThongBaoLoi(ex);
                LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex);
            }
            Mouse.OverrideCursor = Cursors.Arrow;
        }
        private bool Validation()
        {
            try
            {
                if (cmbLoaiPhuCap.SelectedIndex < 0)
                {
                    CommonFunction.ThongBaoChuaChon(lblLoaiPhuCap.Content.ToString());
                    cmbLoaiPhuCap.Focus();
                    return(false);
                }

                if (loaiPhuCap.Equals(BusinessConstant.LOAI_PHU_CAP.BO_SUNG.layGiaTri()))
                {
                    if (cmbPhuCapCho.SelectedIndex < 0)
                    {
                        CommonFunction.ThongBaoChuaChon(lblPhuCapCho.Content.ToString());
                        cmbPhuCapCho.Focus();
                        return(false);
                    }

                    string message = "";
                    if (KiemTraGridBoSung(ref message) == false)
                    {
                        LMessage.ShowMessage(message, LMessage.MessageBoxType.Warning);
                        return(false);
                    }
                }

                return(true);
            }
            catch (Exception ex)
            {
                LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex);
                return(false);
            }
        }
        private void LoaiBoKhachHang()
        {
            Mouse.OverrideCursor = Cursors.Wait;
            try
            {
                DataRow dr;
                for (int i = 0; i < grKhachHang.SelectedItems.Count; i++)
                {
                    dr = (DataRow)grKhachHang.SelectedItems[i];
                    dtKhachHang.Rows.Remove(dr);
                }

                grKhachHang.ItemsSource = null;
                grKhachHang.ItemsSource = dtKhachHang;
            }
            catch (Exception ex)
            {
                LLogging.WriteLog(ex.TargetSite.Name, LLogging.LogType.ERR, ex);
            }
            finally
            {
                Mouse.OverrideCursor = Cursors.Arrow;
            }
        }
Example #6
0
        private bool Validation()
        {
            try
            {
                if (cmbChiNhanh.SelectedIndex == -1)
                {
                    LMessage.ShowMessage("M.ResponseMessage.BaoCao.ChuaChonChiNhanh", LMessage.MessageBoxType.Warning);
                    cmbChiNhanh.Focus();
                    return(false);
                }

                if (lstSourceChiNhanh.Where(e => e.CheckedMember == true).ToList().Count < 1)
                {
                    LMessage.ShowMessage("M.ResponseMessage.BaoCao.ChuaChonChiNhanh", LMessage.MessageBoxType.Warning);
                    return(false);
                }
                if (lstSourceNguonVon.Where(e => e.CheckedMember == true).ToList().Count < 1)
                {
                    LMessage.ShowMessage("Chưa chọn nguồn vốn", LMessage.MessageBoxType.Warning);
                    return(false);
                }

                if (LObject.IsNullOrEmpty(ngaybaocao) || ngaybaocao.Equals(""))
                {
                    LMessage.ShowMessage("M.ResponseMessage.BaoCao.ChuaChonNgayBaoCao", LMessage.MessageBoxType.Warning);
                    raddtNgayBaoCao.Focus();
                    return(false);
                }
            }
            catch (Exception ex)
            {
                LLogging.WriteLog(ex.TargetSite.Name, LLogging.LogType.ERR, ex);
                return(false);
            }
            return(true);
        }
 private void AfterGetKhachHang(DataRow row)
 {
     try
     {
         if (row != null)
         {
             idKhachHang         = Convert.ToInt32(row["ID"]);
             txtMaKhachHang.Text = row["MA_KHANG"].ToString();
             lblTenKH.Content    = row["TEN_KHANG"].ToString();
             txtDiaChi.Text      = row["DIA_CHI"].ToString();
             txtSDT.Text         = row["SO_DTHOAI"].ToString();
             if (row["DD_GTLQ_LOAI"].ToString().Equals("CHUNG_MINH_ND"))
             {
                 txtCMND.Text = row["DD_GTLQ_SO"].ToString();
                 if (LDateTime.IsDate(row["DD_GTLQ_NGAY_CAP"].ToString(), "yyyyMMdd"))
                 {
                     raddtNgayCap.Value = LDateTime.StringToDate(row["DD_GTLQ_NGAY_CAP"].ToString(), "yyyyMMdd");
                 }
                 else
                 {
                     raddtNgayCap.Value = null;
                 }
                 txtNoiCap.Text = row["DD_GTLQ_NOI_CAP"].ToString();
             }
             GetSoPhu();
         }
         else
         {
             ResetThongTinKhachHang();
         }
     }
     catch (Exception ex)
     {
         LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex);
     }
 }
Example #8
0
 private void Window_Closed(object sender, EventArgs e)
 {
     if (isProcess == true || _action == DatabaseConstant.Action.XOA)
     {
         Presentation.Process.KeToanProcess process           = new Presentation.Process.KeToanProcess();
         List <ClientResponseDetail>        lstResponseDetail = new List <ClientResponseDetail>();
         ApplicationConstant.ResponseStatus status            = ApplicationConstant.ResponseStatus.KHONG_THANH_CONG;
         try
         {
             status = process.KiemSoatGiaoDich(GetFormData(), _action, ref lstResponseDetail);
             GetData(_action, status, lstResponseDetail);
         }
         catch (Exception ex)
         {
             LMessage.ShowMessage("M.DungChung.LoiChung", LMessage.MessageBoxType.Error);
             LLogging.WriteLog(ex.TargetSite.Name, LLogging.LogType.ERR, ex);
         }
         finally
         {
             ProcessUnlockData(_action);
             process = null;
         }
     }
 }
Example #9
0
        public bool ThemTheoList(List <HT_SO_TT> lst)
        {
            bool     kq       = true;
            Entities entities = ContextFactory.GetInstance();

            try
            {
                foreach (HT_SO_TT obj in lst)
                {
                    entities.HT_SO_TT.AddObject(obj);
                }
                entities.SaveChanges();
            }
            catch (System.Exception ex)
            {
                kq = false;
                LLogging.WriteLog(ex.TargetSite.Name, LLogging.LogType.ERR, ex);
            }
            finally
            {
                entities = null;
            }
            return(kq);
        }
Example #10
0
 private bool Validation()
 {
     try
     {
         if (cmbMaDonVi.SelectedIndex == -1 || cmbMaDonVi.Text.IsNullOrEmptyOrSpace())
         {
             CommonFunction.ThongBaoChuaChon(lblMaDonVi.Content.ToString());
             lblMaDonVi.Focus();
             return(false);
         }
         else if (cmbLoaiBCTK.SelectedIndex == -1 || cmbLoaiBCTK.Text.IsNullOrEmptyOrSpace())
         {
             CommonFunction.ThongBaoChuaChon(lblLoaiBCTK.Content.ToString());
             lblLoaiBCTK.Focus();
             return(false);
         }
         return(true);
     }
     catch (Exception ex)
     {
         LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex);
         return(false);
     }
 }
        public void OnSave()
        {
            try
            {
                if (!Validation())
                {
                    return;
                }

                string trangThai = "";
                if (sTrangThaiNVu.Equals(BusinessConstant.TrangThaiNghiepVu.DA_DUYET.layGiaTri()))
                {
                    trangThai = BusinessConstant.TrangThaiNghiepVu.DA_DUYET.layGiaTri();
                }
                else
                {
                    trangThai = CommonFunction.LayTrangThaiBanGhi(DatabaseConstant.Action.LUU, BusinessConstant.layTrangThaiNghiepVu(sTrangThaiNVu));
                }

                GetFormData(trangThai);

                if (action == DatabaseConstant.Action.THEM)
                {
                    OnAddNew();
                }
                else if (action == DatabaseConstant.Action.SUA)
                {
                    OnModify();
                }
            }
            catch (Exception ex)
            {
                CommonFunction.ThongBaoLoi(ex);
                LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex);
            }
        }
        /// <summary>
        /// Xu ly nghiep vu
        /// </summary>
        #region Xu ly nghiep vu
        private void OnAction()
        {
            Cursor = Cursors.Wait;
            int iret = 1;
            List <ClientResponseDetail> lstClientResponseDetail = new List <ClientResponseDetail>();

            try
            {
                if (!Validation())
                {
                    return;
                }
                if (objLichThuGocLai.IsNullOrEmpty())
                {
                    objLichThuGocLai = new TDVM_LICH_THU_GOC_LAI();
                }
                AutoCompleteEntry au   = lstSourceBDauTra.ElementAt(cmbThangBDTra.SelectedIndex);
                AutoCompleteEntry auNN = lstNguyenNhanTDoi.ElementAt(cbbNguyenNhanThayDoi.SelectedIndex);
                objLichThuGocLai.DSACH_KUOCVM     = lstDanhSachKUOC.ToArray();
                objLichThuGocLai.ID_CUM           = idCum;
                objLichThuGocLai.MA_CUM           = maCum;
                objLichThuGocLai.NGAY_BAT_DAU     = au.KeywordStrings[2];
                objLichThuGocLai.NGUYEN_NHAN_TDOI = auNN.KeywordStrings.FirstOrDefault();
                iret = new TinDungProcess().LapLichThuGocLai(DatabaseConstant.Action.TINH_TOAN_LICH_TRA_NO, ref objLichThuGocLai, ref lstClientResponseDetail);
                CommonFunction.ThongBaoKetQua(lstClientResponseDetail);
            }
            catch (Exception ex)
            {
                LLogging.WriteLog(ex.TargetSite.Name, LLogging.LogType.ERR, ex);
                LMessage.ShowMessage("M.DungChung.LoiChung", LMessage.MessageBoxType.Error);
            }
            finally
            {
                Cursor = Cursors.Arrow;
            }
        }
Example #13
0
        private void LoadgrdDSDKien(string dkien)
        {
            Mouse.OverrideCursor = Cursors.Wait;
            try
            {
                Presentation.Process.KhaiThacDuLieuProcess process = new Presentation.Process.KhaiThacDuLieuProcess();
                DataSet ds = process.GetDanhSachDKien(dkien);
                if (ds != null && ds.Tables.Count > 0)
                {
                    grdDSDKien.ItemsSource = ds.Tables[0].DefaultView;
                }
                else
                {
                    grdDSDKien.ItemsSource = null;
                }
            }
            catch (Exception ex)
            {
                CommonFunction.ThongBaoLoi(ex);
                LLogging.WriteLog(ex.TargetSite.Name, LLogging.LogType.ERR, ex);
            }

            Mouse.OverrideCursor = Cursors.Arrow;
        }
        /// <summary>
        /// Duyệt dữ liệu
        /// </summary>
        private void onApprove()
        {
            DanhMucProcess danhMucProcess = new DanhMucProcess();

            int[] arrayID = new int[0];
            Mouse.OverrideCursor = Cursors.Wait;
            try
            {
                Array.Resize(ref arrayID, arrayID.Length + 1);
                arrayID[arrayID.Length - 1] = Id;

                List <ClientResponseDetail> listClientResponseDetail = new List <ClientResponseDetail>();
                bool ret = danhMucProcess.DuyetTanSuat(arrayID, ref listClientResponseDetail);

                afterApprove(ret);
            }
            catch (System.Exception ex)
            {
                this.Cursor = Cursors.Arrow;
                CommonFunction.ThongBaoLoi(ex);
                LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex);
            }
            Mouse.OverrideCursor = Cursors.Arrow;
        }
Example #15
0
        public List <HT_NHNSD> GetByIdNSD(int id_NSD)
        {
            List <HT_NHNSD> kq       = null;
            Entities        entities = ContextFactory.GetInstance();

            try
            {
                var query = from a in entities.HT_NHNSD
                            join b in entities.HT_NHNSD_NSD on a.ID equals b.ID_NHNSD
                            where b.ID_NSD == id_NSD
                            select a;
                kq = query.ToList();
            }
            catch (System.Exception ex)
            {
                kq = null;
                LLogging.WriteLog(ex.TargetSite.Name, LLogging.LogType.ERR, ex);
            }
            finally
            {
                entities = null;
            }
            return(kq);
        }
Example #16
0
        public void InitCombobox()
        {
            AutoComboBox  au          = new AutoComboBox();
            List <string> lstDieuKien = new List <string>();

            try
            {
                //List<string> lstDK = new List<string>();
                //lstDK.Add(Presentation.Process.Common.ClientInformation.IdDonViGiaoDich.ToString());
                //au.GenAutoComboBox(ref lstSourceDonVi, ref cmbDonVi, DatabaseConstant.DanhSachTruyVan.COMBOBOX_CHI_NHANH.getValue(), lstDK);

                au.GenAutoComboBox(ref lstSourceDonVi, ref cmbDonVi, "COMBOBOX_HE_THONG_TKHOAN_TH", null);
            }
            catch (System.Exception ex)
            {
                LMessage.ShowMessage("M.DungChung.LoiLoadDuLieu", LMessage.MessageBoxType.Error);
                LLogging.WriteLog(ex.TargetSite.Name, LLogging.LogType.ERR, ex);
            }
            finally
            {
                au          = null;
                lstDieuKien = null;
            }
        }
Example #17
0
 private void LoadData()
 {
     try
     {
         LayThongTinKheUoc(_objKUocXLN.ID_KHE_UOC, _objKUocXLN.MA_KHE_UOC, "GetByID");
         txtChiPhi.Value       = Convert.ToDouble(_objKUocXLN.CHI_PHI);
         txtDuPhongCuThe.Value = Convert.ToDouble(_objKUocXLN.DU_PHONG_CHUNG);
         txtDuPhongChung.Value = Convert.ToDouble(_objKUocXLN.DU_PHONG_CU_THE);
         txtXuKyDuNoGoc.Value  = Convert.ToDouble(_objKUocXLN.GOC_DUOC_XU_LY);
         txtXuKyDuNoLai.Value  = Convert.ToDouble(_objKUocXLN.LAI_DUOC_XU_LY);
         if (_objKUocXLN.XUAT_GOC_NGOAI_BANG.Equals(BusinessConstant.CoKhong.CO.layGiaTri()))
         {
             chkTDNBGoc.IsChecked = true;
         }
         if (_objKUocXLN.XUAT_LAI_NGOAI_BANG.Equals(BusinessConstant.CoKhong.CO.layGiaTri()))
         {
             chkTDNBLai.IsChecked = true;
         }
     }
     catch (Exception ex)
     {
         LLogging.WriteLog(ex.TargetSite.Name, LLogging.LogType.ERR, ex);
     }
 }
Example #18
0
        public bool LayDanhMucTaiSanTheoLoai(ref List <DMUC_TSAN_DTO> lstDanhMucDto, List <DatabaseConstant.LOAI_DMUC_TSAN> lstMaLoai)
        {
            //Kiểm tra kết nối, server, service trước khi request
            Common.Utilities.IsRequestAllow(ApplicationConstant.SystemService.TaiSanService.layGiaTri());
            TaiSanRequest  request  = Common.Utilities.PrepareRequest(new TaiSanServiceRef.TaiSanRequest());
            TaiSanResponse response = new TaiSanServiceRef.TaiSanResponse();

            try
            {
                //Khoi tao request
                request.lstMaLoai     = lstMaLoai.ToArray();
                request.lstDanhMucDto = lstDanhMucDto.ToArray();


                // make a call to service client
                response = Client.LayDanhMucTheoLoai(request);

                //Kiem tra ket qua tra ve
                Common.Utilities.ValidResponse(request, response);

                if (response != null && response.ResponseStatus == ApplicationConstant.ResponseStatus.THANH_CONG)
                {
                    lstDanhMucDto = response.lstDanhMucDto.ToList();
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                LLogging.WriteLog(ex.TargetSite.Name, LLogging.LogType.ERR, ex);
                return(false);
            }
        }
        /// <summary>
        /// Lấy thông tin ngày làm việc của đơn vị
        /// </summary>
        public HT_NGAY_LVIEC getNgayLamViecTheoDonVi(string maDonVi)
        {
            Entities      entities      = ContextFactory.GetInstance();
            HT_NGAY_LVIEC htNgayLamViec = null;

            try
            {
                htNgayLamViec = entities.HT_NGAY_LVIEC.FirstOrDefault(e => e.MA_DVI.Equals(maDonVi));
                if (htNgayLamViec != null)
                {
                    return(htNgayLamViec);
                }
            }
            catch (System.Exception ex)
            {
                htNgayLamViec = null;
                LLogging.WriteLog(ex.TargetSite.Name, LLogging.LogType.ERR, ex);
            }
            finally
            {
                entities = null;
            }
            return(htNgayLamViec);
        }
Example #20
0
        public DataSet GetDanhSachTaiBanGiao(string sMaDonVi, string sTrangThaiNVu, string sMaTS, string sTenTS,
                                             string sSoBienBan, string sNgaySDTu, string sNgaySDDen, string sMaDonViSD, string sTenDonViSD,
                                             string sStartRow = "0", string sEndRow = "0")
        {
            //Kiểm tra kết nối, server, service trước khi request
            Common.Utilities.IsRequestAllow(ApplicationConstant.SystemService.TaiSanService.layGiaTri());
            TaiSanRequest  request  = Common.Utilities.PrepareRequest(new TaiSanServiceRef.TaiSanRequest());
            TaiSanResponse response = new TaiSanServiceRef.TaiSanResponse();

            try
            {
                //Khoi tao request
                request.Function = DatabaseConstant.Function.TS_BAN_GIAO_DS;
                request.Action   = DatabaseConstant.Action.XEM;

                // make a call to service client
                response = Client.QuanLyTaiSan(request);

                //Kiem tra ket qua tra ve
                Common.Utilities.ValidResponse(request, response);

                if (response != null && response.ResponseStatus == ApplicationConstant.ResponseStatus.THANH_CONG)
                {
                    return(new DataSet());
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception ex)
            {
                LLogging.WriteLog(ex.TargetSite.Name, LLogging.LogType.ERR, ex);
                return(null);
            }
        }
 private void LoadDsDXVVMoi()
 {
     try
     {
         machinhanh = lstSourceChiNhanh.ElementAt(cmbChiNhanh.SelectedIndex).KeywordStrings.FirstOrDefault();
         maphonggd  = lstSourcePhongGD_Select.ElementAt(cmbPhongGD.SelectedIndex).KeywordStrings.FirstOrDefault();
         idKhuVuc   = lstSourceKhuVuc.ElementAt(cmbKhuVuc.SelectedIndex).KeywordStrings[1];
         idCum      = lstSourceCum.ElementAt(cmbCum.SelectedIndex).KeywordStrings[1];
         manhom     = lstSourceNhom.ElementAt(cmbNhom.SelectedIndex).KeywordStrings[0];
         macum      = lstSourceCum.ElementAt(cmbCum.SelectedIndex).KeywordStrings[0];
         makhuvuc   = lstSourceKhuVuc.ElementAt(cmbKhuVuc.SelectedIndex).KeywordStrings[0];
         DataSet       dsDXVV    = new DataSet();
         BaoCaoProcess bcProcess = new BaoCaoProcess();
         dsDXVV = bcProcess.GetDXVVMoiTheoNhom(manhom);
         if (dsDXVV != null && dsDXVV.Tables.Count > 0)
         {
             grdDXVV.DataContext = dsDXVV.Tables[0].DefaultView;
         }
     }
     catch (Exception ex)
     {
         LLogging.WriteLog(ex.TargetSite.Name, LLogging.LogType.ERR, ex);
     }
 }
        /// <summary>
        /// Namnt - 20120912
        /// Thay đổi ngôn ngữ
        /// </summary>
        private void ChangeLanguage()
        {
            try
            {
                // Tìm đường dẫn tới folder chứa các file language
                if (string.IsNullOrEmpty(pathFolderLanguages))
                {
                    //pathFolderLanguages = LFile.GetPropertyInXml(Environment.CurrentDirectory + "\\config\\config.conf", "LanguagesDir").ToString();
                    // Truongnx, đổi thông tin load đường dẫn languages
                    pathFolderLanguages = Environment.CurrentDirectory + "\\languages";
                }

                // Thay đổi ngôn ngữ
                if (!LLanguage.ApplyLanguage(pathFolderLanguages, cboLanguage.SelectedValue.ToString().Substring(0, 2)))
                {
                    new frmThongBaoLoi("M.ZAMainApp.LoginWindow.LoiDoiNgonNgu", null).ShowDialog();
                }
            }
            catch (Exception ex)
            {
                new frmThongBaoLoi("M.ZAMainApp.LoginWindow.LoiDoiNgonNgu", ex).ShowDialog();
                LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex);
            }
        }
 /// <summary>
 /// Xử lý xóa dữ liệu
 /// </summary>
 private void Xoa()
 {
     try
     {
         DanhMucProcess danhmucProcess = new Presentation.Process.DanhMucProcess();
         if (grNhom.SelectedItems.Count > 0)
         {
             int[] arrid = new int[grNhom.SelectedItems.Count];
             List <ClientResponseDetail> listResponseDetail = new List <ClientResponseDetail>();
             for (int i = 0; i < grNhom.SelectedItems.Count; i++)
             {
                 DataRow dtr = (DataRow)grNhom.SelectedItems[i];
                 arrid[i] = int.Parse(dtr[1].ToString());
             }
             if (danhmucProcess.XoaNhom(arrid, ref listResponseDetail))
             {
                 LMessage.ShowMessage("M.DungChung.XoaThanhCong", LMessage.MessageBoxType.Information);
                 LoadTree();
             }
             else
             {
                 LMessage.ShowMessage("M.DungChung.XoaKhongThanhCong", LMessage.MessageBoxType.Error);
             }
         }
         else
         {
             LMessage.ShowMessage("M.DungChung.ChuaChonBanGhi", LMessage.MessageBoxType.Warning);
             return;
         }
     }
     catch (Exception ex)
     {
         LMessage.ShowMessage("M.DungChung.LoiXoaDuLieu", LMessage.MessageBoxType.Error);
         LLogging.WriteLog(ex.TargetSite.Name, LLogging.LogType.ERR, ex);
     }
 }
        private void BuildGridDoiTuong()
        {
            Mouse.OverrideCursor = Cursors.Wait;
            try
            {
                string maLoaiDTuong = lstSourceLoaiDTuong.ElementAt(cmbDoiTuong.SelectedIndex).KeywordStrings.First();
                if (maLoaiDTuong.IsNullOrEmptyOrSpace())
                {
                    dtDoiTuong = null;
                    grDSDoiTuong.ItemsSource = null;
                    return;
                }

                DataSet ds = new HanMucProcess().GetHanMucChung(maLoaiDTuong, ClientInformation.MaDonVi);
                if (ds != null && ds.Tables.Count > 0)
                {
                    dtDoiTuong = ds.Tables[0];
                    grDSDoiTuong.ItemsSource = null;
                    grDSDoiTuong.ItemsSource = dtDoiTuong.DefaultView;
                }
                else
                {
                    dtDoiTuong = null;
                    grDSDoiTuong.ItemsSource = null;
                }
            }
            catch (System.Exception ex)
            {
                CommonFunction.ThongBaoLoi(ex);
                LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex);
            }
            finally
            {
                Mouse.OverrideCursor = Cursors.Arrow;
            }
        }
 private void LoadComboboxNhom()
 {
     try
     {
         lstSourceNhom = new List <AutoCompleteEntry>();
         AutoComboBox  auto        = new AutoComboBox();
         List <string> lstDieuKien = new List <string>();
         machinhanh = lstSourceChiNhanh.ElementAt(cmbChiNhanh.SelectedIndex).KeywordStrings[1];
         maphonggd  = lstSourcePhongGD_Select.ElementAt(cmbPhongGD.SelectedIndex).KeywordStrings[3];
         makhuvuc   = lstSourceKhuVuc.ElementAt(cmbKhuVuc.SelectedIndex).KeywordStrings[1];
         macum      = lstSourceCum.ElementAt(cmbCum.SelectedIndex).KeywordStrings[1];
         lstDieuKien.Add(maphonggd);
         lstDieuKien.Add(makhuvuc);
         lstDieuKien.Add(macum);
         cmbNhom.Items.Clear();
         auto.GenAutoComboBox(ref lstSourceNhom, ref cmbNhom, "COMBOBOX_NHOM_NQL", lstDieuKien);
         isLoad = true;
         LoadThongTinBoSung();
     }
     catch (Exception ex)
     {
         LLogging.WriteLog(ex.TargetSite.Name, LLogging.LogType.ERR, ex);
     }
 }
Example #26
0
        protected void BuildTree(RadTreeViewItem item, DataTable dt)
        {
            try
            {
                //Cấu trúc của Tag: GiaTri#Level  ( VD:  MaSP001#2 hoặc CUM001#3#DON_VI)
                string sTag = item.Tag.ToString();
                int    i    = sTag.IndexOf("#");

                string sValue = sTag.Substring(0, i);
                int    iLevel = Convert.ToInt32(sTag.Substring(i + 1));

                List <DataRow> lstDataRow = null;
                lstDataRow = dt.Select().OrderBy(row => row[2]).ToList();

                foreach (DataRow row in lstDataRow)
                {
                    if (iLevel < Convert.ToInt32(row["LEVEL"]))
                    {
                        if (row["NODE_PARENT"].ToString() == sValue)
                        {
                            RadTreeViewItem subItem = new RadTreeViewItem();
                            subItem.Header     = row["NODE_NAME"].ToString();
                            subItem.Tag        = row["NODE"].ToString() + "#" + row["LEVEL"].ToString();
                            subItem.IsExpanded = false;
                            item.Items.Add(subItem);
                            BuildTree(subItem, dt);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex);
                throw ex;
            }
        }
 private bool Validation()
 {
     try
     {
         if (txtMa.Text.IsNullOrEmptyOrSpace())
         {
             CommonFunction.ThongBaoChuaNhap(lblMa.Content.ToString());
             txtMa.Focus();
             return(false);
         }
         else if (txtTen.Text.IsNullOrEmptyOrSpace())
         {
             CommonFunction.ThongBaoChuaNhap(lblTen.Content.ToString());
             txtTen.Focus();
             return(false);
         }
         return(true);
     }
     catch (Exception ex)
     {
         LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex);
         return(false);
     }
 }
        public void OnSave()
        {
            try
            {
                if (!Validation()) return;

                obj = new NS_DM_LOAI_TNHAP();
                GetFormData(ref obj);

                if (action == DatabaseConstant.Action.THEM)
                {
                    OnAddNew(obj);
                }
                else if (action == DatabaseConstant.Action.SUA)
                {
                    OnModify(obj);
                }
            }
            catch (Exception ex)
            {
                CommonFunction.ThongBaoLoi(ex);
                LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex);
            }
        }
        public HT_MATRIX_DUYET GetByMa(string loaiDuLieu, string maDuLieu, string maChucNang)
        {
            HT_MATRIX_DUYET kq       = null;
            Entities        entities = ContextFactory.GetInstance();

            try
            {
                kq = entities.HT_MATRIX_DUYET.OrderByDescending(f => f.ID).
                     FirstOrDefault(e => e.LOAI_DULIEU.Equals(loaiDuLieu) &&
                                    e.MA_DULIEU.Equals(maDuLieu) &&
                                    e.MA_CNANG.Equals(maChucNang));
                return(kq);
            }
            catch (System.Exception ex)
            {
                kq = null;
                LLogging.WriteLog(ex.TargetSite.Name, LLogging.LogType.ERR, ex);
            }
            finally
            {
                entities = null;
            }
            return(kq);
        }
Example #30
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.NSTL,
                                                                DatabaseConstant.Function.NS_DM_LOAI_HDLD_DS,
                                                                DatabaseConstant.Table.NS_DM_LOAI_HDLD,
                                                                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);
            }
        }