Пример #1
0
        /// <summary>
        /// Xử lý sự kiện thêm
        /// </summary>
        private void Them()
        {
            UserControl userControl = null;
            string      tittle      = DatabaseConstant.layNgonNguTieuDeForm(this.function);
            Window      frm         = new Window();

            frm.Title = tittle;
            frm.WindowStartupLocation = WindowStartupLocation.CenterScreen;
            ApplicationConstant.DonViSuDung company = ApplicationConstant.layDonViSuDung(ClientInformation.Company);
            switch (company)
            {
            case ApplicationConstant.DonViSuDung.BANTAYVANG:
                userControl = new ucKhuVucCT_01();
                break;

            default:
                userControl = new ucKhuVucCT_01();
                break;
            }
            FieldInfo fieldAction = userControl.GetType().GetField("action");

            fieldAction.SetValue(userControl, DatabaseConstant.Action.THEM);
            //MethodInfo mi = userControl.GetType().GetMethod("SetDataForm");
            //object[] para = new object[1] { id };
            //mi.Invoke(userControl, para);
            //LoadDuLieuCT dlgLoadDuLieuCT = new LoadDuLieuCT(userControl.beforeViewFromList);
            //dlgLoadDuLieuCT();
            frm.Content = userControl;
            frm.WindowStartupLocation = WindowStartupLocation.CenterScreen;
            frm.ShowDialog();
        }
Пример #2
0
        /// <summary>
        /// Xem dữ liệu
        /// </summary>
        private void onView(int id)
        {
            UserControl userControl = null;
            string      tittle      = DatabaseConstant.layNgonNguTieuDeForm(this.Function);
            Window      frm         = new Window();

            frm.Title = tittle;
            frm.WindowStartupLocation = WindowStartupLocation.CenterScreen;
            ApplicationConstant.DonViSuDung company = ApplicationConstant.layDonViSuDung(ClientInformation.Company);
            switch (company)
            {
            case ApplicationConstant.DonViSuDung.BANTAYVANG:
                userControl = new ucNhomCT_01();
                break;

            default:
                userControl = new ucNhomCT_01();
                break;
            }
            PropertyInfo fieldAction = userControl.GetType().GetProperty("Action");

            fieldAction.SetValue(userControl, DatabaseConstant.Action.XEM, null);
            fieldAction = userControl.GetType().GetProperty("Id");
            fieldAction.SetValue(userControl, id, null);
            MethodInfo mi = userControl.GetType().GetMethod("beforeViewFromList");

            mi.Invoke(userControl, null);
            //LoadTreeCT dlgLoadTreeCT = new LoadTreeCT(userControl.beforeViewFromList);
            //dlgLoadTreeCT();
            frm.Content = userControl;
            frm.WindowStartupLocation = WindowStartupLocation.CenterScreen;
            frm.ShowDialog();
        }
Пример #3
0
 private void loadWidthColumn()
 {
     if (grDanhSach.Items.Count > 0)
     {
         int idx = 1;
         foreach (HeaderDto item in lstHeader)
         {
             double width = (double)item.WidthValue;
             if (width > 0)
             {
                 Telerik.Windows.Controls.GridViewLengthUnitType unit = new Telerik.Windows.Controls.GridViewLengthUnitType();
                 if (item.WidthUnit.Equals(ApplicationConstant.layGiaTri(ApplicationConstant.UnitWidth.Pixel)))
                 {
                     unit = Telerik.Windows.Controls.GridViewLengthUnitType.Pixel;
                 }
                 else if (item.WidthUnit.Equals(ApplicationConstant.layGiaTri(ApplicationConstant.UnitWidth.Star)))
                 {
                     unit = Telerik.Windows.Controls.GridViewLengthUnitType.Star;
                 }
                 else if (item.WidthUnit.Equals(ApplicationConstant.layGiaTri(ApplicationConstant.UnitWidth.Percent)))
                 {
                     unit = Telerik.Windows.Controls.GridViewLengthUnitType.Auto;
                 }
                 grDanhSach.Columns[idx].Width      = new Telerik.Windows.Controls.GridViewLength(width, unit);
                 grDanhSach.Columns[idx].IsReadOnly = true;
             }
             else
             {
                 grDanhSach.Columns[idx].IsVisible = false;
             }
             idx = idx + 1;
         }
         columnsWidthLoad = true;
     }
 }
Пример #4
0
        /// <summary>
        /// 创建视图模型项
        /// </summary>
        /// <param name="item"></param>
        /// <returns></returns>
        private DeviceSyncItem CreateSyncItemViewModel(DeviceSyncItem item)
        {
            var viewItem = new DeviceSyncItem
            {
                NameView   = item.NameView,
                FolderView = item.FolderView,
                SourceView = item.SourceView
            };

            if (null != item.ImgByte)
            {
                try
                {
                    //有真实预览图则显示预览图
                    viewItem.BitImg = ImageUtil.GetBitmapImage(item.ImgByte);
                    item.ImgByte    = null;
                    return(viewItem);
                }
                catch (Exception) { }
            }
            //没有预览图/获取失败则根据文件类型显示默认图标
            switch (item.ContentType)
            {
            case SyncContentType.AUDIO: viewItem.BitImg = ApplicationConstant.GetDefaultAudioIcon(); break;

            case SyncContentType.IMAGE: viewItem.BitImg = ApplicationConstant.GetDefaultImageIcon(); break;

            case SyncContentType.VIDEO: viewItem.BitImg = ApplicationConstant.GetDefaultVideoIcon(); break;

            case SyncContentType.OTHER: viewItem.BitImg = ApplicationConstant.GetDefaultFileIcon(); break;
            }
            return(viewItem);
        }
Пример #5
0
        private void btnCheckSoHoKhau_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                UtilitiesProcess process = new UtilitiesProcess();
                string           objType = "GIA_DINH";
                ApplicationConstant.UtilitesResponseMessage resMessage = ApplicationConstant.UtilitesResponseMessage.M_ResponseMessage_Utilities_ExistSoHoKhau;
                List <ClientResponseDetail> listClientResponseDetail   = new List <ClientResponseDetail>();
                bool ret = false;

                if (txtSoHoKhau.IsNullOrEmpty())
                {
                    CommonFunction.ThongBaoChuaNhap(lblSoHoKhau.Content.ToString());
                    txtSoHoKhau.Focus();
                    return;
                }

                //if (!LObject.IsNullOrEmpty(txtSoHoKhau.Text))
                //{
                //    if (!CommonFunction.IsValidFormat(ApplicationConstant.FormatType.HOKHAU,
                //        txtSoHoKhau.Text))
                //    {
                //        txtSoHoKhau.Focus();
                //        return;
                //    }
                //}

                Mouse.OverrideCursor = Cursors.Wait;

                if (txtSoHoKhau.Text.IsNullOrEmptyOrSpace())
                {
                    return;
                }

                ret = process.Utilites(DatabaseConstant.Action.KIEM_TRA, ApplicationConstant.FormatType.HOKHAU, txtSoHoKhau.Text, objType, ref resMessage, ref listClientResponseDetail);

                if (ret)
                {
                    //LMessage.ShowMessage("M.ResponseMessage.Common.NotExistSoHoKhau", LMessage.MessageBoxType.Information);
                    LMessage.ShowMessage(ApplicationConstant.layGiaTri(resMessage), LMessage.MessageBoxType.Information);
                }
                else
                {
                    LMessage.ShowMessage("M.ResponseMessage.Common.NoResponse", LMessage.MessageBoxType.Warning);
                }
            }
            catch (Exception ex)
            {
                LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex);
                throw ex;
            }
            finally
            {
                Mouse.OverrideCursor = Cursors.Arrow;
            }
        }
Пример #6
0
 // シーン間共有データ
 public void Initialize()
 {
     inputSystem = new InputSystem();
     inputSystem.Initialize();
     inputSystem.SetDisplaySize(ApplicationConstant.GetDisplayWidth(), ApplicationConstant.GetDisplayHeight());
     gameTemporaryData = new GameTemporaryData();
     gameTemporaryData.Initialize();
     gameConstantData = new GameConstantData();
     gameConstantData.Initialize();
     stgEnemyConstantData = new StgEnemyConstantData();
     stgEnemyConstantData.Initialize();
     stgEnemyConstantData.InitializeValue();
     gameResourcePathData = new GameResourcePathData();
     gameResourcePathData.Initialize();
     gameResourcePathData.InitializeValue();
 }
Пример #7
0
        /// <summary>
        /// Set các thông tin cơ bản của một request
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="request"></param>
        /// <returns></returns>
        public static T PrepareRequest <T>(T request, UserInformation userInformation) where T : class
        {
            request.GetType().GetProperty("RequestId").SetValue(request, Guid.NewGuid().ToString(), null);
            request.GetType().GetProperty("Company").SetValue(request, ApplicationConstant.layDonViSuDung(userInformation.Company), null);
            request.GetType().GetProperty("UserId").SetValue(request, userInformation.IdNguoiSuDung, null);
            request.GetType().GetProperty("UserName").SetValue(request, userInformation.TenDangNhap, null);
            request.GetType().GetProperty("ClientIP").SetValue(request, userInformation.IpAddress, null);
            request.GetType().GetProperty("ClientMAC").SetValue(request, userInformation.MacAddress, null);
            request.GetType().GetProperty("RequestSecurityKey").SetValue(request, userInformation.RequestSecurityKey, null);
            request.GetType().GetProperty("SessionId").SetValue(request, userInformation.SessionId, null);
            request.GetType().GetProperty("DeptCode").SetValue(request, userInformation.MaDonVi, null);
            request.GetType().GetProperty("OprDeptCode").SetValue(request, userInformation.MaDonViGiaoDich, null);
            request.GetType().GetProperty("MngDeptCode").SetValue(request, userInformation.MaDonViQuanLy, null);
            request.GetType().GetProperty("NgayLamViec").SetValue(request, userInformation.NgayLamViecHienTai, null);

            return(request);
        }
Пример #8
0
 /// <summary>
 /// Set các thông tin cơ bản của một request
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="request"></param>
 /// <returns></returns>
 public static T PrepareRequest <T>(T request) where T : class
 {
     request.GetType().GetProperty("RequestId").SetValue(request, Guid.NewGuid().ToString(), null);
     request.GetType().GetProperty("Company").SetValue(request, ApplicationConstant.layDonViSuDung(ClientInformation.Company), null);
     if (ClientInformation.ClientType.Equals(ApplicationConstant.ClientType.DESKTOP.layGiaTri()))
     {
         request.GetType().GetProperty("UserId").SetValue(request, ClientInformation.IdNguoiSuDung, null);
         request.GetType().GetProperty("UserName").SetValue(request, ClientInformation.TenDangNhap, null);
         request.GetType().GetProperty("ClientIP").SetValue(request, ClientInformation.IpAddress, null);
         request.GetType().GetProperty("ClientMAC").SetValue(request, ClientInformation.MacAddress, null);
         request.GetType().GetProperty("RequestSecurityKey").SetValue(request, ClientInformation.RequestSecurityKey, null);
         request.GetType().GetProperty("SessionId").SetValue(request, ClientInformation.SessionId, null);
         request.GetType().GetProperty("DeptCode").SetValue(request, ClientInformation.MaDonVi, null);
         request.GetType().GetProperty("OprDeptCode").SetValue(request, ClientInformation.MaDonViGiaoDich, null);
         request.GetType().GetProperty("MngDeptCode").SetValue(request, ClientInformation.MaDonViQuanLy, null);
         request.GetType().GetProperty("NgayLamViec").SetValue(request, ClientInformation.NgayLamViecHienTai, null);
     }
     else
     {
         UserInformation userInfo = HttpContext.Current.Session["UserInformation"] as UserInformation;
         if (userInfo != null)
         {
             request.GetType().GetProperty("UserId").SetValue(request, userInfo.IdNguoiSuDung, null);
             request.GetType().GetProperty("UserName").SetValue(request, userInfo.TenDangNhap, null);
             request.GetType().GetProperty("ClientIP").SetValue(request, userInfo.IpAddress, null);
             request.GetType().GetProperty("ClientMAC").SetValue(request, userInfo.MacAddress, null);
             request.GetType().GetProperty("RequestSecurityKey").SetValue(request, userInfo.RequestSecurityKey, null);
             request.GetType().GetProperty("SessionId").SetValue(request, userInfo.SessionId, null);
             request.GetType().GetProperty("DeptCode").SetValue(request, userInfo.MaDonVi, null);
             request.GetType().GetProperty("OprDeptCode").SetValue(request, userInfo.MaDonViGiaoDich, null);
             request.GetType().GetProperty("MngDeptCode").SetValue(request, userInfo.MaDonViQuanLy, null);
             request.GetType().GetProperty("NgayLamViec").SetValue(request, userInfo.NgayLamViecHienTai, null);
             request.GetType().GetProperty("ClientType").SetValue(request, ApplicationConstant.ClientType.WEB, null);
         }
         else
         {
             request.GetType().GetProperty("RequestSecurityKey").SetValue(request, ClientInformation.RequestSecurityKey, null);
             request.GetType().GetProperty("ClientType").SetValue(request, ApplicationConstant.ClientType.WEB, null);
         }
     }
     return(request);
 }
Пример #9
0
        /// <summary>
        /// For updating compnay information
        /// </summary>
        /// <param name="userCode"></param>
        /// <returns></returns>
        public bool UpdateCompanyInfo(UserApplicationConstantsProp objCompanyinfo)
        {
            try
            {
                using (PortStorageEntities psEntities = new PortStorageEntities())
                {
                    CommonDAL.logger.LogInfo(typeof(string), string.Format(CultureInfo.InvariantCulture, "Called {2} function ::{0} {1}.", DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString(), MethodBase.GetCurrentMethod().Name));

                    bool isSuccessfull = false;
                    // ApplicationConstant customer = psEntities.ApplicationConstants.Where(x => x.usercode == objcustomer.CustomerID).FirstOrDefault();
                    ApplicationConstant companyinfo = psEntities.ApplicationConstants.FirstOrDefault();
                    if (companyinfo != null)
                    {
                        companyinfo.CompanyName     = objCompanyinfo.CompanyName;
                        companyinfo.AddressLine1    = objCompanyinfo.AddressLine1;
                        companyinfo.AddressLine2    = objCompanyinfo.AddressLine2;
                        companyinfo.City            = objCompanyinfo.CitySep;
                        companyinfo.Phone           = objCompanyinfo.Phone;
                        companyinfo.State           = objCompanyinfo.State;
                        companyinfo.Zip             = objCompanyinfo.Zip;
                        companyinfo.FaxNumber       = objCompanyinfo.FaxNumber;
                        companyinfo.SystemName      = objCompanyinfo.SystemName;
                        companyinfo.NextOrderNumber = objCompanyinfo.NextOrderNumber;
                        companyinfo.UpdatedDate     = objCompanyinfo.UpdatedDate;
                        companyinfo.UpdatedBy       = objCompanyinfo.UpdatedBy;
                        psEntities.SaveChanges();
                        isSuccessfull = true;
                    }
                    return(isSuccessfull);
                }
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                CommonDAL.logger.LogInfo(typeof(string), string.Format(CultureInfo.InvariantCulture, "End {2} function ::{0} {1}.", DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString(), MethodBase.GetCurrentMethod().Name));
            }
        }
 private void loadWidthColumn()
 {
     if (grvKheUoc.Columns.Count >= lstHeader.Count)
     {
         int idx = 1;
         foreach (HeaderDto item in lstHeader)
         {
             double width = (double)item.WidthValue;
             if (width > 0)
             {
                 Telerik.Windows.Controls.GridViewLengthUnitType unit = new Telerik.Windows.Controls.GridViewLengthUnitType();
                 if (item.WidthUnit.Equals(ApplicationConstant.layGiaTri(ApplicationConstant.UnitWidth.Pixel)))
                 {
                     unit = Telerik.Windows.Controls.GridViewLengthUnitType.Pixel;
                 }
                 else if (item.WidthUnit.Equals(ApplicationConstant.layGiaTri(ApplicationConstant.UnitWidth.Star)))
                 {
                     unit = Telerik.Windows.Controls.GridViewLengthUnitType.Star;
                 }
                 else if (item.WidthUnit.Equals(ApplicationConstant.layGiaTri(ApplicationConstant.UnitWidth.Percent)))
                 {
                     unit = Telerik.Windows.Controls.GridViewLengthUnitType.Auto;
                 }
                 grvKheUoc.Columns[idx].Width  = new Telerik.Windows.Controls.GridViewLength(width, unit);
                 grvKheUoc.Columns[idx].Header = LLanguage.SearchResourceByKey(item.LanguageKey);
             }
             else
             {
                 grvKheUoc.Columns[idx].IsVisible = false;
             }
             idx = idx + 1;
         }
         for (int i = idx; i < grvKheUoc.Columns.Count; i++)
         {
             grvKheUoc.Columns[i].IsVisible = false;
         }
         columnsWidthLoad = true;
     }
 }
        public LoginWithConfigWindow()
        {
            InitializeComponent();
            process = new ZAMainAppProcess();

            //Icon & title setting
            CommonFunction.setIcon(this);
            this.Title += " - " + ClientInformation.ShortName;

            ApplicationConstant.DonViSuDung company = ApplicationConstant.layDonViSuDung(ClientInformation.Company);

            if (company == ApplicationConstant.DonViSuDung.BINHKHANH)
            {
                lblLanguage.Visibility = Visibility.Hidden;
                cboLanguage.Visibility = Visibility.Hidden;
                lblTitle.Visibility    = Visibility.Visible;
            }

            string        ServerPattern = ClientInformation.ServerList;
            Server        server        = new Server();
            List <Server> ServerList    = server.getServerList(ServerPattern);

            foreach (Server item in ServerList)
            {
                MenuItem mnuItem = new MenuItem();
                mnuItem.Name   = "" + item.ServerName;
                mnuItem.Header = "" + item.ServerName;
                mnuItem.Uid    = "" + item.ServerIP + "#" + item.ServerPort;
                if (item.ServerName.Equals(ClientInformation.ServerName))
                {
                    mnuItem.Icon = new Image {
                        Source = new BitmapImage(new Uri(@"pack://application:,,,/Utilities.Common;component/Images/Action/approve.png", UriKind.RelativeOrAbsolute)), Width = 12, Height = 12
                    };
                }
                mnuItem.Click += mnu_Click;

                mnuConfig.Items.Add(mnuItem);
            }
        }
Пример #12
0
        public bool doLogin(string userName, string passWord, ref string responseMessage)
        {
            // Kiểm tra kết nối, server, service trước khi request
            Common.Utilities.IsRequestAllow(ApplicationConstant.SystemService.ZAMainAppService.layGiaTri());

            // Khởi tạo và gán các giá trị cho request
            LoginRequest request = Common.Utilities.PrepareRequest(new LoginRequest());

            request.UserName = userName.ToUpper();
            request.PassWord = passWord;

            request.Module   = DatabaseConstant.Module.QTHT;
            request.Function = DatabaseConstant.Function.HT_LOGIN;
            request.Action   = DatabaseConstant.Action.DANG_NHAP;

            // Ghi log
            LLogging.WriteLog(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString(), LLogging.LogType.SYS, "Login at Client : " + userName);

            // Lấy kết quả trả về
            LoginResponse response = Client.doLogin(request);

            // Kiểm tra kết quả trả về
            Common.Utilities.ValidResponse(request, response);

            // Xử lý dữ liệu trả về
            if (response.ResponseStatus == ApplicationConstant.ResponseStatus.KHONG_THANH_CONG)
            {
                responseMessage = response.ResponseMessage;
                return(false);
            }
            else
            {
                ClientInformation.TenDangNhap  = response.NguoiSuDung.MA_DANG_NHAP;
                ClientInformation.ListChucNang = response.ListChucNang;
                if (response.NguoiSuDung != null)
                {
                    ClientInformation.IdNguoiSuDung   = response.NguoiSuDung.ID;
                    ClientInformation.HoTen           = response.NguoiSuDung.TEN_DAY_DU;
                    ClientInformation.MaDonVi         = response.NguoiSuDung.MA_DVI_QLY;
                    ClientInformation.LoaiNguoiSuDung = response.NguoiSuDung.PHAN_LOAI_NSD;
                }
                if (response.DonVi != null)
                {
                    ClientInformation.TenDonVi = response.DonVi.TEN_GDICH;
                    ClientInformation.IdDonVi  = response.DonVi.ID;
                }
                if (response.DonViRoot != null)
                {
                    ClientInformation.TenToChuc = response.DonViRoot.TEN_GDICH;
                    ClientInformation.MaToChuc  = response.DonViRoot.TEN_GDICH;
                    ClientInformation.IdToChu   = response.DonViRoot.ID;
                }
                ClientInformation.NgayLamViecTruoc   = response.NgayLamViecTruoc;
                ClientInformation.NgayLamViecHienTai = response.NgayLamViecHienTai;
                ClientInformation.NgayLamViecSau     = response.NgayLamViecSau;
                ClientInformation.MaDongNoiTe        = response.MaDongNoiTe;
                ClientInformation.Company            = ApplicationConstant.layGiaTri(response.Company);

                return(true);
            }
        }
Пример #13
0
        public bool doLoginWithSession(string userName, string passWord, ref NGON_NGU_DTO ngonNguDTO, ref string responseMessage)
        {
            // Kiểm tra kết nối, server, service trước khi request
            Common.Utilities.IsRequestAllow(ApplicationConstant.SystemService.ZAMainAppService.layGiaTri());

            // Khởi tạo và gán các giá trị cho request
            LoginRequest request = Common.Utilities.PrepareRequest(new LoginRequest());

            request.License  = ClientInformation.License;
            request.Version  = ClientInformation.Version;
            request.UserName = userName.ToUpper();
            request.PassWord = passWord;

            request.Module   = DatabaseConstant.Module.QTHT;
            request.Function = DatabaseConstant.Function.HT_LOGIN;
            request.Action   = DatabaseConstant.Action.DANG_NHAP;
            request.Company  = ApplicationConstant.layDonViSuDung(ClientInformation.Company);

            if (ClientInformation.ClientType.Equals(ApplicationConstant.ClientType.DESKTOP.layGiaTri()))
            {
                request.PhienBanResource = LLanguage.SearchResourceByKey("U.PhienBan");
                request.PhienBanMessage  = LLanguage.SearchResourceByKey("M.PhienBan");
            }
            if (ClientInformation.ClientType.Equals(ApplicationConstant.ClientType.WEB.layGiaTri()))
            {
                UserInformation userInfo = HttpContext.Current.Session["UserInformation"] as UserInformation;
                request.PhienBanResource = userInfo.U_PhienBan;
                request.PhienBanMessage  = userInfo.M_PhienBan;
            }

            // Ghi log
            LLogging.WriteLog(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString(), LLogging.LogType.SYS, "Login at Client : " + userName);
            LLogging.WriteLog(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString(), LLogging.LogType.ERR, "Login at Client : " + userName);

            // Lấy kết quả trả về
            LoginResponse response = Client.doLoginWithSession(request);

            // Kiểm tra kết quả trả về
            LLogging.WriteLog(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString(), LLogging.LogType.ERR, "Before ValidResponse");
            Common.Utilities.ValidResponse(request, response);
            LLogging.WriteLog(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString(), LLogging.LogType.ERR, "After ValidResponse");

            // Xử lý dữ liệu trả về
            if (response.ResponseStatus == ApplicationConstant.ResponseStatus.KHONG_THANH_CONG)
            {
                responseMessage = response.ResponseMessage;
                return(false);
            }
            else
            {
                responseMessage = response.ResponseMessage;
                string sessionId = response.SessionId;
                if (ClientInformation.ClientType.Equals(ApplicationConstant.ClientType.DESKTOP.layGiaTri()))
                {
                    ClientInformation.SessionId = sessionId;

                    ClientInformation.TenDangNhap  = response.NguoiSuDung.MA_DANG_NHAP;
                    ClientInformation.ListChucNang = response.ListChucNang;
                    if (response.NguoiSuDung != null)
                    {
                        ClientInformation.IdNguoiSuDung   = response.NguoiSuDung.ID;
                        ClientInformation.HoTen           = response.NguoiSuDung.TEN_DAY_DU;
                        ClientInformation.MaDonViQuanLy   = response.NguoiSuDung.MA_DVI_QLY;
                        ClientInformation.LoaiNguoiSuDung = response.NguoiSuDung.PHAN_LOAI_NSD;
                    }
                    if (response.DonViGiaoDich != null)
                    {
                        ClientInformation.IdDonViGiaoDich    = response.DonViGiaoDich.ID;
                        ClientInformation.MaDonViGiaoDich    = response.DonViGiaoDich.MA_DVI;
                        ClientInformation.TenDonViGiaoDich   = response.DonViGiaoDich.TEN_GDICH;
                        ClientInformation.PhuongPhapHachToan = response.DonViGiaoDich.MA_HACH_TOAN;
                    }
                    if (response.DonVi != null)
                    {
                        ClientInformation.IdDonVi  = response.DonVi.ID;
                        ClientInformation.MaDonVi  = response.DonVi.MA_DVI;
                        ClientInformation.TenDonVi = response.DonVi.TEN_GDICH;
                    }
                    if (response.DonViQuanLy != null)
                    {
                        ClientInformation.IdDonViQuanLy  = response.DonViQuanLy.ID;
                        ClientInformation.MaDonViQuanLy  = response.DonViQuanLy.MA_DVI;
                        ClientInformation.TenDonViQuanLy = response.DonViQuanLy.TEN_GDICH;
                    }
                    if (response.DonViRoot != null)
                    {
                        ClientInformation.IdToChu   = response.DonViRoot.ID;
                        ClientInformation.MaToChuc  = response.DonViRoot.MA_DVI;
                        ClientInformation.TenToChuc = response.DonViRoot.TEN_GDICH;
                    }
                    if (response.ListPhongGD != null)
                    {
                        ClientInformation.ListPhongGD = response.ListPhongGD.ToList();
                    }
                    if (response.NgonNguDTO != null)
                    {
                        ngonNguDTO = response.NgonNguDTO;
                    }

                    if (response.ShowConfigDTO != null)
                    {
                        WriteShowConfig(response.ShowConfigDTO);
                    }

                    ClientInformation.NgayLamViecTruoc   = response.NgayLamViecTruoc;
                    ClientInformation.NgayLamViecHienTai = response.NgayLamViecHienTai;
                    ClientInformation.NgayLamViecSau     = response.NgayLamViecSau;
                    ClientInformation.MaDongNoiTe        = response.MaDongNoiTe;
                    ClientInformation.MaQuocGiaBanDia    = response.MaQuocGiaBanDia;
                }
                else
                {
                    UserInformation userInfo = new UserInformation();
                    userInfo.SessionId    = sessionId;
                    userInfo.TenDangNhap  = response.NguoiSuDung.MA_DANG_NHAP;
                    userInfo.ListChucNang = response.ListChucNang;
                    if (response.NguoiSuDung != null)
                    {
                        userInfo.IdNguoiSuDung   = response.NguoiSuDung.ID;
                        userInfo.HoTen           = response.NguoiSuDung.TEN_DAY_DU;
                        userInfo.MaDonViQuanLy   = response.NguoiSuDung.MA_DVI_QLY;
                        userInfo.LoaiNguoiSuDung = response.NguoiSuDung.PHAN_LOAI_NSD;
                    }
                    if (response.DonViGiaoDich != null)
                    {
                        userInfo.IdDonViGiaoDich    = response.DonViGiaoDich.ID;
                        userInfo.MaDonViGiaoDich    = response.DonViGiaoDich.MA_DVI;
                        userInfo.TenDonViGiaoDich   = response.DonViGiaoDich.TEN_GDICH;
                        userInfo.PhuongPhapHachToan = response.DonViGiaoDich.MA_HACH_TOAN;
                    }
                    if (response.DonVi != null)
                    {
                        userInfo.IdDonVi  = response.DonVi.ID;
                        userInfo.MaDonVi  = response.DonVi.MA_DVI;
                        userInfo.TenDonVi = response.DonVi.TEN_GDICH;
                    }
                    if (response.DonViQuanLy != null)
                    {
                        userInfo.IdDonViQuanLy  = response.DonViQuanLy.ID;
                        userInfo.MaDonViQuanLy  = response.DonViQuanLy.MA_DVI;
                        userInfo.TenDonViQuanLy = response.DonViQuanLy.TEN_GDICH;
                    }
                    if (response.DonViRoot != null)
                    {
                        userInfo.IdToChu   = response.DonViRoot.ID;
                        userInfo.MaToChuc  = response.DonViRoot.MA_DVI;
                        userInfo.TenToChuc = response.DonViRoot.TEN_GDICH;
                    }
                    if (response.ListPhongGD != null)
                    {
                        userInfo.ListPhongGD = response.ListPhongGD.ToList();
                    }
                    if (response.NgonNguDTO != null)
                    {
                        ngonNguDTO = response.NgonNguDTO;
                    }
                    userInfo.NgayLamViecTruoc   = response.NgayLamViecTruoc;
                    userInfo.NgayLamViecHienTai = response.NgayLamViecHienTai;
                    userInfo.NgayLamViecSau     = response.NgayLamViecSau;
                    userInfo.MaDongNoiTe        = response.MaDongNoiTe;
                    userInfo.MaQuocGiaBanDia    = response.MaQuocGiaBanDia;
                    HttpContext.Current.Session["UserInformation"] = userInfo;
                }
                ClientInformation.Company = ApplicationConstant.layGiaTri(response.Company);
                return(true);
            }
        }
Пример #14
0
 /**
  * タッチ位置を取得(ゲーム内解像度の値を返す)
  */
 public Vector3 GetTouchPosition()
 {
     return(GetTouchPosition(ApplicationConstant.GetWidth(), ApplicationConstant.GetHeight()));
 }
Пример #15
0
        public bool doLoginWithSession(string userName, string passWord, ref NGON_NGU_DTO ngonNguDTO, ref string responseMessage, UserInformation userInfomation)
        {
            // Kiểm tra kết nối, server, service trước khi request
            Common.WebUtilities.IsRequestAllow(userInformation.ServerIP, userInformation.ServerPort, ApplicationConstant.SystemService.ZAMainAppService.layGiaTri());

            // Khởi tạo và gán các giá trị cho request
            LoginRequest request = Common.WebUtilities.PrepareRequest(new LoginRequest(), userInformation);

            request.License  = userInformation.License;
            request.Version  = userInformation.Version;
            request.UserName = userName.ToUpper();
            request.PassWord = passWord;

            request.Module   = DatabaseConstant.Module.QTHT;
            request.Function = DatabaseConstant.Function.HT_LOGIN;
            request.Action   = DatabaseConstant.Action.DANG_NHAP;
            request.Company  = ApplicationConstant.layDonViSuDung(userInformation.Company);

            // Ghi log
            LLogging.WriteLog(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString(), LLogging.LogType.SYS, "Login at Client : " + userName);

            // Lấy kết quả trả về
            LoginResponse response = Client.doLoginWithSession(request);

            // Kiểm tra kết quả trả về
            Common.WebUtilities.ValidResponse(request, response, userInformation);

            // Xử lý dữ liệu trả về
            if (response.ResponseStatus == ApplicationConstant.ResponseStatus.KHONG_THANH_CONG)
            {
                responseMessage = response.ResponseMessage;
                return(false);
            }
            else
            {
                responseMessage = response.ResponseMessage;
                string sessionId = response.SessionId;
                userInformation.SessionId = sessionId;

                userInformation.TenDangNhap  = response.NguoiSuDung.MA_DANG_NHAP;
                userInformation.ListChucNang = response.ListChucNang;
                if (response.NguoiSuDung != null)
                {
                    userInformation.IdNguoiSuDung   = response.NguoiSuDung.ID;
                    userInformation.HoTen           = response.NguoiSuDung.TEN_DAY_DU;
                    userInformation.MaDonViQuanLy   = response.NguoiSuDung.MA_DVI_QLY;
                    userInformation.LoaiNguoiSuDung = response.NguoiSuDung.PHAN_LOAI_NSD;
                }
                if (response.DonViGiaoDich != null)
                {
                    userInformation.IdDonViGiaoDich    = response.DonViGiaoDich.ID;
                    userInformation.MaDonViGiaoDich    = response.DonViGiaoDich.MA_DVI;
                    userInformation.TenDonViGiaoDich   = response.DonViGiaoDich.TEN_GDICH;
                    userInformation.PhuongPhapHachToan = response.DonViGiaoDich.MA_HACH_TOAN;
                }
                if (response.DonVi != null)
                {
                    userInformation.IdDonVi  = response.DonVi.ID;
                    userInformation.MaDonVi  = response.DonVi.MA_DVI;
                    userInformation.TenDonVi = response.DonVi.TEN_GDICH;
                }
                if (response.DonViQuanLy != null)
                {
                    userInformation.IdDonViQuanLy  = response.DonViQuanLy.ID;
                    userInformation.MaDonViQuanLy  = response.DonViQuanLy.MA_DVI;
                    userInformation.TenDonViQuanLy = response.DonViQuanLy.TEN_GDICH;
                }
                if (response.DonViRoot != null)
                {
                    userInformation.IdToChu   = response.DonViRoot.ID;
                    userInformation.MaToChuc  = response.DonViRoot.MA_DVI;
                    userInformation.TenToChuc = response.DonViRoot.TEN_GDICH;
                }
                if (response.ListPhongGD != null)
                {
                    userInformation.ListPhongGD = response.ListPhongGD.ToList();
                }
                if (response.NgonNguDTO != null)
                {
                    ngonNguDTO = response.NgonNguDTO;
                }
                userInformation.NgayLamViecTruoc   = response.NgayLamViecTruoc;
                userInformation.NgayLamViecHienTai = response.NgayLamViecHienTai;
                userInformation.NgayLamViecSau     = response.NgayLamViecSau;
                userInformation.MaDongNoiTe        = response.MaDongNoiTe;
                userInformation.MaQuocGiaBanDia    = response.MaQuocGiaBanDia;
                userInformation.Company            = ApplicationConstant.layGiaTri(response.Company);
                return(true);
            }
        }
Пример #16
0
        public LoginWindow()
        {
            InitializeComponent();

            // IP, MAC Address
            new ClientInitProcess().docThongTinCauHinhClient(1);

            // No IP, MAC Address
            //docThongTinCauHinhClient(1);

            if (!ClientInformation.Theme.Equals("default"))
            {
                SetThemes();
            }

            /* LANGUAGE */
            if (!ClientInformation.LanguageList.Equals(""))
            {
                string          LanguagePattern = ClientInformation.LanguageList;
                List <Language> LanguageList    = (new Language()).getLanguageList(LanguagePattern);

                int    i     = 0;
                int    index = 0;
                string value = "";
                foreach (Language e in LanguageList)
                {
                    RadComboBoxItem item = new RadComboBoxItem();
                    item.Content = e.LanguageName; item.Tag = e.LanguageCode;
                    cboLanguage.Items.Add(item);

                    if (e.LanguageStatus.Equals("1"))
                    {
                        index = i;
                        value = e.LanguageStatus;
                    }
                    ++i;
                }

                cboLanguage.SelectedIndex = index;
                //cboLanguage.SelectedValue = value;
            }
            else
            {
            }
            /* LANGUAGE */

            process = new ZAMainAppProcess();

            //Icon & title setting
            CommonFunction.setIcon(this);

            //Set licence Aspose Words and Cells
            MemoryStream aspLic = new MemoryStream();
            StreamWriter sw     = new StreamWriter(aspLic, Encoding.UTF8);

            Aspose.Words.License licenseWord = new Aspose.Words.License();
            //Set the license of Aspose.Cells to avoid the evaluation
            //limitations
            sw.WriteLine(BusinessConstant.asposeWordLic);
            sw.Flush();
            aspLic.Position = 0;
            licenseWord.SetLicense(aspLic);

            Aspose.Cells.License licenseExcel = new Aspose.Cells.License();
            //Set the license of Aspose.Cells to avoid the evaluation
            //limitations
            sw.WriteLine(BusinessConstant.asposeWordLic);
            sw.Flush();
            aspLic.Position = 0;
            licenseExcel.SetLicense(aspLic);

            ApplicationConstant.DonViSuDung company = ApplicationConstant.layDonViSuDung(ClientInformation.Company);

            if (company == ApplicationConstant.DonViSuDung.BINHKHANH)
            {
                lblLanguage.Visibility = Visibility.Hidden;
                cboLanguage.Visibility = Visibility.Hidden;
                lblTitle.Visibility    = Visibility.Visible;

                //imgConfig.Visibility = Visibility.Collapsed;
                string ServerPattern = ClientInformation.ServerList;
                if (!string.IsNullOrEmpty(ServerPattern))
                {
                    Server        server     = new Server();
                    List <Server> ServerList = server.getServerList(ServerPattern);

                    if (ServerList.Count <= 1)
                    {
                        imgConfig.Visibility = Visibility.Collapsed;
                    }
                    else
                    {
                        foreach (Server item in ServerList)
                        {
                            MenuItem mnuItem = new MenuItem();
                            mnuItem.Name   = "" + item.ServerName;
                            mnuItem.Header = "" + item.ServerName;
                            mnuItem.Uid    = "" + item.ServerIP + "#" + item.ServerPort + "#" + item.ServerCode;
                            if (item.ServerName.Equals(ClientInformation.ServerName))
                            {
                                mnuItem.Icon = new Image {
                                    Source = new BitmapImage(new Uri(@"pack://*****:*****@"pack://application:,,,/Utilities.Common;component/Images/Action/approve.png", UriKind.RelativeOrAbsolute)), Width = 12, Height = 12
                                };
                            }
                            mnuItem.Click += mnu_Click;

                            mnuConfig.Items.Add(mnuItem);
                        }
                    }
                }
                else
                {
                    imgConfig.Visibility = Visibility.Collapsed;
                }
            }
            else
            {
                if (company == ApplicationConstant.DonViSuDung.BIDV ||
                    company == ApplicationConstant.DonViSuDung.BIDV_BLF)
                {
                    //cboLanguage.SelectedIndex = 1;
                }

                //imgConfig.Visibility = Visibility.Collapsed;
                string ServerPattern = ClientInformation.ServerList;
                if (!string.IsNullOrEmpty(ServerPattern))
                {
                    Server        server     = new Server();
                    List <Server> ServerList = server.getServerList(ServerPattern);

                    if (ServerList.Count <= 1)
                    {
                        imgConfig.Visibility = Visibility.Collapsed;
                    }
                    else
                    {
                        foreach (Server item in ServerList)
                        {
                            MenuItem mnuItem = new MenuItem();
                            mnuItem.Name   = "" + item.ServerName;
                            mnuItem.Header = "" + item.ServerName;
                            mnuItem.Uid    = "" + item.ServerIP + "#" + item.ServerPort + "#" + item.ServerCode;
                            if (item.ServerName.Equals(ClientInformation.ServerName))
                            {
                                mnuItem.Icon = new Image {
                                    Source = new BitmapImage(new Uri(@"pack://application:,,,/Utilities.Common;component/Images/Action/approve.png", UriKind.RelativeOrAbsolute)), Width = 12, Height = 12
                                };
                            }
                            mnuItem.Click += mnu_Click;

                            mnuConfig.Items.Add(mnuItem);
                        }
                    }
                }
                else
                {
                    imgConfig.Visibility = Visibility.Collapsed;
                }
            }
            cboLanguage.SelectionChanged += cboLanguage_SelectionChanged;
        }