Exemplo n.º 1
0
        private void DoChangeLanguage(int langID)
        {
            try
            {
                LangTypeInfo langType =
                    CurrentApp.Session.SupportLangTypes.FirstOrDefault(l => l.LangID == langID);
                if (langType == null)
                {
                    return;
                }
                LangTypeInfo = langType;
                CurrentApp.Session.LangTypeInfo = langType;
                CurrentApp.Session.LangTypeID   = langType.LangID;
                SetBusy(true, string.Empty);
                BackgroundWorker worker = new BackgroundWorker();
                worker.DoWork             += (s, de) => CurrentApp.InitAllLanguageInfos();
                worker.RunWorkerCompleted += (s, re) =>
                {
                    worker.Dispose();
                    SetBusy(false, string.Empty);

                    ChangeLanguage();
                };
                worker.RunWorkerAsync();
            }
            catch (Exception ex)
            {
                ShowException(ex.Message);
            }
        }
Exemplo n.º 2
0
        void ListBoxLanguages_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (e.RemovedItems == null || e.RemovedItems.Count <= 0)
            {
                return;
            }
            var item = ListBoxLanguages.SelectedItem as LangInfoItem;

            if (item == null)
            {
                return;
            }
            if (CurrentApp == null || CurrentApp.Session == null)
            {
                return;
            }
            var          session  = CurrentApp.Session;
            LangTypeInfo langType = session.SupportLangTypes.FirstOrDefault(t => t.LangID == item.Code);

            if (langType != null)
            {
                LangTypeInfo         = langType;
                session.LangTypeInfo = langType;
                session.LangTypeID   = langType.LangID;
                WebRequest webRequest = new WebRequest();
                webRequest.Session = session;
                webRequest.Code    = (int)RequestCode.CSLanguageChange;
                webRequest.Data    = langType.LangID.ToString();
                CurrentApp.PublishEvent(webRequest);
            }
        }
        protected override void PageHead_PageHeadEvent(object sender, PageHeadEventArgs e)
        {
            base.PageHead_PageHeadEvent(sender, e);
            switch (e.Code)
            {
            //切换主题
            case 100:
                ThemeInfo themeInfo = e.Data as ThemeInfo;
                if (themeInfo != null)
                {
                    ThemeInfo             = themeInfo;
                    App.Session.ThemeInfo = themeInfo;
                    App.Session.ThemeName = themeInfo.Name;
                    ChangeTheme();
                    SendThemeChangeMessage();
                }
                break;

            //切换语言
            case 110:
                LangTypeInfo langType = e.Data as LangTypeInfo;
                if (langType != null)
                {
                    LangTypeInfo             = langType;
                    App.Session.LangTypeInfo = langType;
                    App.Session.LangTypeID   = langType.LangID;
                    MyWaiter.Visibility      = Visibility.Visible;
                    mWorker                     = new BackgroundWorker();
                    mWorker.DoWork             += (s, de) => App.InitAllLanguageInfos();
                    mWorker.RunWorkerCompleted += (s, re) =>
                    {
                        mWorker.Dispose();
                        MyWaiter.Visibility = Visibility.Collapsed;
                        ChangeLanguage();
                        PopupPanel.ChangeLanguage();
                        SendLanguageChangeMessage();
                    };
                    mWorker.RunWorkerAsync();
                }
                break;

            //展开或关闭侧边栏
            case 121:
                OpenCloseLeftPanel();
                break;

            case 120:
                SendChangePasswordMessage();
                break;

            case 201:
                SendLogoutMessage();
                break;

            case 202:
                SendNavigateHomeMessage();
                break;
            }
        }
Exemplo n.º 4
0
        private void LoadLangTypes()
        {
            try
            {
                ListLangTypeInfos.Clear();
                List <LangTypeInfo> listTypes = new List <LangTypeInfo>();
                LangTypeInfo        langType  = new LangTypeInfo();
                langType.LangID   = 1033;
                langType.LangName = "en-us";
                langType.Display  = "English(U.S)";
                listTypes.Add(langType);
                langType          = new LangTypeInfo();
                langType.LangID   = 2052;
                langType.LangName = "zh-cn";
                langType.Display  = "简体中文";
                listTypes.Add(langType);
                langType          = new LangTypeInfo();
                langType.LangID   = 1028;
                langType.LangName = "zh-tw";
                langType.Display  = "繁体中文";
                listTypes.Add(langType);
                langType          = new LangTypeInfo();
                langType.LangID   = 1041;
                langType.LangName = "jp";
                langType.Display  = "日本语";
                listTypes.Add(langType);
                langType          = new LangTypeInfo();
                langType.LangID   = 1025;
                langType.LangName = "ar";
                langType.Display  = "阿拉伯语";
                listTypes.Add(langType);

                for (int i = 0; i < listTypes.Count; i++)
                {
                    var langTypeInfo = listTypes[i];
                    int langID       = langTypeInfo.LangID;
                    var resource     =
                        GetResourceStream(new Uri(string.Format("Languages/{0}.XML", langID), UriKind.RelativeOrAbsolute));
                    if (resource == null)
                    {
                        continue;
                    }
                    ListLangTypeInfos.Add(langTypeInfo);
                }
                WriteLog("LoadLangTypes", string.Format("End.\t{0}", ListLangTypeInfos.Count));
            }
            catch (Exception ex)
            {
                WriteLog("LoadLangTypes", string.Format("Fail.\t{0}", ex.Message));
            }
        }
Exemplo n.º 5
0
        protected override void PageHead_PageHeadEvent(object sender, PageHeadEventArgs e)
        {
            base.PageHead_PageHeadEvent(sender, e);

            try
            {
                switch (e.Code)
                {
                //切换主题
                case 100:
                    ThemeInfo themeInfo = e.Data as ThemeInfo;
                    if (themeInfo != null)
                    {
                        ThemeInfo             = themeInfo;
                        App.Session.ThemeInfo = themeInfo;
                        App.Session.ThemeName = themeInfo.Name;
                        ChangeTheme();
                        SendThemeChangeMessage();
                    }
                    break;

                //切换语言
                case 110:
                    LangTypeInfo langType = e.Data as LangTypeInfo;
                    if (langType != null)
                    {
                        LangTypeInfo             = langType;
                        App.Session.LangTypeInfo = langType;
                        App.Session.LangTypeID   = langType.LangID;
                        MyWaiter.Visibility      = Visibility.Visible;
                        mWorker                     = new BackgroundWorker();
                        mWorker.DoWork             += (s, de) => App.InitAllLanguageInfos();
                        mWorker.RunWorkerCompleted += (s, re) =>
                        {
                            mWorker.Dispose();
                            MyWaiter.Visibility = Visibility.Hidden;
                            ChangeLanguage();
                            SendLanguageChangeMessage();
                        };
                        mWorker.RunWorkerAsync();
                    }
                    break;
                }
            }
            catch (Exception ex)
            {
                App.ShowExceptionMessage(ex.Message);
            }
        }
Exemplo n.º 6
0
 private void InitLangTypes()
 {
     ListLanugages.Clear();
     if (SessionInfo != null && SessionInfo.SupportLangTypes != null)
     {
         for (int i = 0; i < SessionInfo.SupportLangTypes.Count; i++)
         {
             LangTypeInfo langType     = SessionInfo.SupportLangTypes[i];
             LangInfoItem langInfoItem = new LangInfoItem();
             langInfoItem.Code    = langType.LangID;
             langInfoItem.Display = langType.Display;
             ListLanugages.Add(langInfoItem);
         }
     }
 }
Exemplo n.º 7
0
        void mListBoxLangs_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (e.RemovedItems == null || e.RemovedItems.Count <= 0)
            {
                return;
            }
            var langItem = mListBoxLangs.SelectedItem as LangInfoItem;

            if (langItem != null)
            {
                LangTypeInfo langTypeInfo = SessionInfo.SupportLangTypes.FirstOrDefault(l => l.LangID == langItem.Code);
                if (langTypeInfo != null)
                {
                    LangTypeInfo             = langTypeInfo;
                    SessionInfo.LangTypeInfo = langTypeInfo;
                    SessionInfo.LangTypeID   = langTypeInfo.LangID;
                    ChangeLanguage();
                    PageHeadEventArgs args = new PageHeadEventArgs();
                    args.Code = 110;
                    args.Data = langTypeInfo;
                    OnPageHeadEvent(args);
                }
            }
        }
Exemplo n.º 8
0
        private void Init()
        {
            Session                = new SessionInfo();
            Session.SessionID      = Guid.NewGuid().ToString();
            Session.AppName        = AppName;
            Session.LastActiveTime = DateTime.Now;

            RentInfo rentInfo = new RentInfo();

            rentInfo.ID      = 1000000000000000001;
            rentInfo.Token   = "00000";
            rentInfo.Domain  = "voicecyber.com";
            rentInfo.Name    = "voicecyber";
            Session.RentInfo = rentInfo;
            Session.RentID   = 1000000000000000001;

            UserInfo userInfo = new UserInfo();

            userInfo.UserID   = 1020000000000000001;
            userInfo.Account  = "administrator";
            userInfo.UserName = "******";
            Session.UserInfo  = userInfo;
            Session.UserID    = 1020000000000000001;

            RoleInfo roleInfo = new RoleInfo();

            roleInfo.ID      = 1060000000000000001;
            roleInfo.Name    = "System Admin";
            Session.RoleInfo = roleInfo;
            Session.RoleID   = 1060000000000000001;

            AppServerInfo serverInfo = new AppServerInfo();

            serverInfo.Protocol   = "http";
            serverInfo.Address    = "192.168.6.75";
            serverInfo.Port       = 8081;
            Session.AppServerInfo = serverInfo;

            ThemeInfo themeInfo = new ThemeInfo();

            themeInfo.Name    = "Default";
            themeInfo.Color   = "Brown";
            Session.ThemeInfo = themeInfo;
            Session.ThemeName = "Default";

            themeInfo       = new ThemeInfo();
            themeInfo.Name  = "Style01";
            themeInfo.Color = "Green";
            Session.SupportThemes.Add(themeInfo);

            themeInfo       = new ThemeInfo();
            themeInfo.Name  = "Style02";
            themeInfo.Color = "Yellow";
            Session.SupportThemes.Add(themeInfo);

            themeInfo       = new ThemeInfo();
            themeInfo.Name  = "Style03";
            themeInfo.Color = "Brown";
            Session.SupportThemes.Add(themeInfo);

            themeInfo       = new ThemeInfo();
            themeInfo.Name  = "Style04";
            themeInfo.Color = "Blue";
            Session.SupportThemes.Add(themeInfo);

            LangTypeInfo langType = new LangTypeInfo();

            langType.LangID      = 1033;
            langType.LangName    = "en-us";
            langType.Display     = "English";
            Session.LangTypeInfo = langType;
            Session.LangTypeID   = 1033;
            Session.SupportLangTypes.Add(langType);

            langType          = new LangTypeInfo();
            langType.LangID   = 2052;
            langType.LangName = "zh-cn";
            langType.Display  = "简体中文";
            Session.SupportLangTypes.Add(langType);

            DatabaseInfo dbInfo = new DatabaseInfo();

            dbInfo.TypeID              = 3;
            dbInfo.TypeName            = "ORCL";
            dbInfo.Host                = "192.168.4.182";
            dbInfo.Port                = 1521;
            dbInfo.DBName              = "PFOrcl";
            dbInfo.LoginName           = "PFDEV";
            dbInfo.Password            = "******";
            Session.DatabaseInfo       = dbInfo;
            Session.DBType             = dbInfo.TypeID;
            Session.DBConnectionString = dbInfo.GetConnectionString();

            //DatabaseInfo dbInfo = new DatabaseInfo();
            //dbInfo.TypeID = 2;
            //dbInfo.TypeName = "MSSQL";
            //dbInfo.Host = "192.168.4.182";
            //dbInfo.Port = 1433;
            //dbInfo.DBName = "UMPDataDB";
            //dbInfo.LoginName = "sa";
            //dbInfo.Password = "******";
            //Session.DBType = dbInfo.TypeID;
            //Session.DBConnectionString = dbInfo.GetConnectionString();
            //Session.DatabaseInfo = dbInfo;

            Session.InstallPath = @"C:\UMPRelease";
        }
Exemplo n.º 9
0
        private void InitSessionInfo()
        {
            Session = SessionInfo.CreateSessionInfo(AppName, ModuleID, AppType);
            RentInfo rentInfo = new RentInfo();

            rentInfo.ID      = ConstValue.RENT_DEFAULT;
            rentInfo.Token   = ConstValue.RENT_DEFAULT_TOKEN;
            rentInfo.Domain  = "voicecyber.com";
            rentInfo.Name    = "voicecyber";
            Session.RentInfo = rentInfo;
            Session.RentID   = ConstValue.RENT_DEFAULT;

            UserInfo userInfo = new UserInfo();

            userInfo.UserID   = ConstValue.USER_ADMIN;
            userInfo.Account  = "administrator";
            userInfo.UserName = "******";
            Session.UserInfo  = userInfo;
            Session.UserID    = ConstValue.USER_ADMIN;

            RoleInfo roleInfo = new RoleInfo();

            roleInfo.ID      = ConstValue.ROLE_SYSTEMADMIN;
            roleInfo.Name    = "System Admin";
            Session.RoleInfo = roleInfo;
            Session.RoleID   = ConstValue.ROLE_SYSTEMADMIN;


            ThemeInfo themeInfo = new ThemeInfo();

            themeInfo.Name  = "Style01";
            themeInfo.Color = "Green";
            Session.SupportThemes.Add(themeInfo);

            themeInfo       = new ThemeInfo();
            themeInfo.Name  = "Style02";
            themeInfo.Color = "Yellow";
            Session.SupportThemes.Add(themeInfo);

            themeInfo       = new ThemeInfo();
            themeInfo.Name  = "Style03";
            themeInfo.Color = "Brown";
            Session.SupportThemes.Add(themeInfo);

            themeInfo       = new ThemeInfo();
            themeInfo.Name  = "Style04";
            themeInfo.Color = "Blue";
            Session.SupportThemes.Add(themeInfo);


            #region Set Default Theme

            string   themeName = "Style01";
            DateTime now       = DateTime.Now;
            if (now.Month == 3 ||
                now.Month == 4 ||
                now.Month == 5)
            {
                themeName = "Style01";
            }
            if (now.Month == 6 ||
                now.Month == 7 ||
                now.Month == 8)
            {
                themeName = "Style02";
            }
            if (now.Month == 9 ||
                now.Month == 10 ||
                now.Month == 11)
            {
                themeName = "Style03";
            }
            if (now.Month == 12 ||
                now.Month == 1 ||
                now.Month == 2)
            {
                themeName = "Style04";
            }
            var theme = Session.SupportThemes.FirstOrDefault(t => t.Name == themeName);
            if (theme != null)
            {
                Session.ThemeInfo = theme;
                Session.ThemeName = themeName;
            }

            #endregion


            LangTypeInfo langType = new LangTypeInfo();
            langType.LangID   = 1033;
            langType.LangName = "en-us";
            langType.Display  = "English";
            Session.SupportLangTypes.Add(langType);

            langType          = new LangTypeInfo();
            langType.LangID   = 2052;
            langType.LangName = "zh-cn";
            langType.Display  = "简体中文";
            Session.SupportLangTypes.Add(langType);
            Session.LangTypeInfo = langType;
            Session.LangTypeID   = langType.LangID;

            langType          = new LangTypeInfo();
            langType.LangID   = 1028;
            langType.LangName = "zh-cn";
            langType.Display  = "繁体中文";
            Session.SupportLangTypes.Add(langType);

            langType          = new LangTypeInfo();
            langType.LangID   = 1041;
            langType.LangName = "jp";
            langType.Display  = "日本语";
            Session.SupportLangTypes.Add(langType);

            langType          = new LangTypeInfo();
            langType.LangID   = 1025;
            langType.LangName = "ara";
            langType.Display  = "阿拉伯语";
            Session.SupportLangTypes.Add(langType);


            #region Set Default Language

            int langID = GetUserDefaultUILanguage();
            var lang   = Session.SupportLangTypes.FirstOrDefault(l => l.LangID == langID);
            if (lang != null)
            {
                Session.LangTypeInfo = lang;
                Session.LangTypeID   = lang.LangID;
            }

            #endregion


            AppServerInfo appServerInfo = new AppServerInfo();
            appServerInfo.Protocol      = "http";
            appServerInfo.Address       = "192.168.6.78";
            appServerInfo.Port          = 8081;
            appServerInfo.SupportHttps  = false;
            appServerInfo.SupportNetTcp = false;
            Session.AppServerInfo       = appServerInfo;

            DatabaseInfo dbInfo = new DatabaseInfo();
            dbInfo.TypeID    = 2;
            dbInfo.Host      = "192.168.4.182";
            dbInfo.Port      = 1433;
            dbInfo.DBName    = "UMPDataDB11251";
            dbInfo.LoginName = "PFDEV";
            string strPassword = "******";
            dbInfo.RealPassword = strPassword;
            strPassword         = EncryptString(strPassword);
            dbInfo.Password     = strPassword;

            Session.DatabaseInfo = dbInfo;
            Session.DBType       = dbInfo.TypeID;

            Session.AppVersion = "8.03.002";
        }
Exemplo n.º 10
0
        protected override void App_NetPipeEvent(WebRequest webRequest)
        {
            base.App_NetPipeEvent(webRequest);

            Dispatcher.Invoke(new Action(() =>
            {
                try
                {
                    var code    = webRequest.Code;
                    var strData = webRequest.Data;
                    switch (code)
                    {
                    case (int)RequestCode.SCLanguageChange:
                        LangTypeInfo langTypeInfo = UMPApp.Session.SupportLangTypes.FirstOrDefault(l => l.LangID.ToString() == strData);
                        if (langTypeInfo != null)
                        {
                            LangTypeInfo = langTypeInfo;
                            UMPApp.Session.LangTypeInfo = langTypeInfo;
                            UMPApp.Session.LangTypeID   = langTypeInfo.LangID;
                            if (MyWaiter != null)
                            {
                                MyWaiter.Visibility = Visibility.Visible;
                            }
                            _mWorker                     = new BackgroundWorker();
                            _mWorker.DoWork             += (s, de) => UMPApp.InitAllLanguageInfos();
                            _mWorker.RunWorkerCompleted += (s, re) =>
                            {
                                _mWorker.Dispose();
                                if (MyWaiter != null)
                                {
                                    MyWaiter.Visibility = Visibility.Hidden;
                                }
                                if (PopupCreateTest != null)
                                {
                                    PopupCreateTest.ChangeLanguage();
                                }
                                if (PageHead != null)
                                {
                                    PageHead.SessionInfo = UMPApp.Session;
                                    PageHead.InitInfo();
                                }
                            };
                            _mWorker.RunWorkerAsync();
                        }
                        break;

                    case (int)RequestCode.SCThemeChange:
                        ThemeInfo themeInfo = UMPApp.Session.SupportThemes.FirstOrDefault(t => t.Name == strData);
                        if (themeInfo != null)
                        {
                            ThemeInfo = themeInfo;
                            UMPApp.Session.ThemeInfo = themeInfo;
                            UMPApp.Session.ThemeName = themeInfo.Name;
                            ChangeTheme();
                            PageHead.SessionInfo = UMPApp.Session;
                            PageHead.InitInfo();
                        }
                        break;
                    }
                }
                catch (Exception ex)
                {
                    UMPApp.ShowExceptionMessage(ex.Message);
                }
            }));
        }
Exemplo n.º 11
0
        /// <summary>
        /// 初始化SessionInfo,如果应用程序单机运行(不在主模块中运行),此处可设置SessionInfo的默认值
        /// </summary>
        protected virtual void InitSessionInfo()
        {
            Session             = SessionInfo.CreateSessionInfo(AppName, ModuleID, AppType);
            Session.InstallPath = @"C:\UMPRelease";

            RentInfo rentInfo = new RentInfo();

            rentInfo.ID      = ConstValue.RENT_DEFAULT;
            rentInfo.Token   = ConstValue.RENT_DEFAULT_TOKEN;
            rentInfo.Domain  = "voicecyber.com";
            rentInfo.Name    = "voicecyber";
            Session.RentInfo = rentInfo;
            Session.RentID   = ConstValue.RENT_DEFAULT;

            UserInfo userInfo = new UserInfo();

            userInfo.UserID   = ConstValue.USER_ADMIN;
            userInfo.Account  = "administrator";
            userInfo.UserName = "******";
            userInfo.Password = "******";
            Session.UserInfo  = userInfo;
            Session.UserID    = ConstValue.USER_ADMIN;

            RoleInfo roleInfo = new RoleInfo();

            roleInfo.ID      = ConstValue.ROLE_SYSTEMADMIN;
            roleInfo.Name    = "System Admin";
            Session.RoleInfo = roleInfo;
            Session.RoleID   = ConstValue.ROLE_SYSTEMADMIN;

            ThemeInfo themeInfo = new ThemeInfo();

            themeInfo.Name    = "Default";
            themeInfo.Color   = "Brown";
            Session.ThemeInfo = themeInfo;
            Session.ThemeName = "Default";

            themeInfo       = new ThemeInfo();
            themeInfo.Name  = "Style01";
            themeInfo.Color = "Green";
            Session.SupportThemes.Add(themeInfo);

            themeInfo       = new ThemeInfo();
            themeInfo.Name  = "Style02";
            themeInfo.Color = "Yellow";
            Session.SupportThemes.Add(themeInfo);

            themeInfo       = new ThemeInfo();
            themeInfo.Name  = "Style03";
            themeInfo.Color = "Brown";
            Session.SupportThemes.Add(themeInfo);

            themeInfo       = new ThemeInfo();
            themeInfo.Name  = "Style04";
            themeInfo.Color = "Blue";
            Session.SupportThemes.Add(themeInfo);

            LangTypeInfo langType = new LangTypeInfo();

            langType.LangID   = 1033;
            langType.LangName = "en-us";
            langType.Display  = "English";
            Session.SupportLangTypes.Add(langType);

            langType          = new LangTypeInfo();
            langType.LangID   = 2052;
            langType.LangName = "zh-cn";
            langType.Display  = "简体中文";
            Session.SupportLangTypes.Add(langType);
            Session.LangTypeInfo = langType;
            Session.LangTypeID   = langType.LangID;

            langType          = new LangTypeInfo();
            langType.LangID   = 1028;
            langType.LangName = "zh-cn";
            langType.Display  = "繁体中文";
            Session.SupportLangTypes.Add(langType);
        }
Exemplo n.º 12
0
        protected override void App_NetPipeEvent(WebRequest webRequest)
        {
            base.App_NetPipeEvent(webRequest);

            Dispatcher.Invoke(new Action(() =>
            {
                try
                {
                    var code    = webRequest.Code;
                    var session = webRequest.Session;
                    var strData = webRequest.Data;
                    switch (code)
                    {
                    case (int)RequestCode.SCLanguageChange:
                        LangTypeInfo langTypeInfo =
                            App.Session.SupportLangTypes.FirstOrDefault(l => l.LangID.ToString() == strData);
                        if (langTypeInfo != null)
                        {
                            LangTypeInfo             = langTypeInfo;
                            App.Session.LangTypeInfo = langTypeInfo;
                            App.Session.LangTypeID   = langTypeInfo.LangID;
                            if (MyWaiter != null)
                            {
                                MyWaiter.Visibility = Visibility.Visible;
                            }
                            mWorker                     = new BackgroundWorker();
                            mWorker.DoWork             += (s, de) => App.InitAllLanguageInfos();
                            mWorker.RunWorkerCompleted += (s, re) =>
                            {
                                mWorker.Dispose();
                                if (MyWaiter != null)
                                {
                                    MyWaiter.Visibility = Visibility.Hidden;
                                }
                                ChangeLanguage();
                            };
                            mWorker.RunWorkerAsync();
                        }
                        break;

                    case (int)RequestCode.SCThemeChange:
                        ThemeInfo themeInfo = App.Session.SupportThemes.FirstOrDefault(t => t.Name == strData);
                        if (themeInfo != null)
                        {
                            ThemeInfo             = themeInfo;
                            App.Session.ThemeInfo = themeInfo;
                            App.Session.ThemeName = themeInfo.Name;
                            ChangeTheme();
                        }
                        break;

                    case (int)RequestCode.SCOperation:
                        string subModule = webRequest.Data;
                        ChangeFrameUrl(subModule);
                        break;
                    }
                }
                catch (Exception ex)
                {
                    App.ShowExceptionMessage(ex.Message);
                }
            }));
        }
Exemplo n.º 13
0
        public static void Init()
        {
            string path = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), @"UMP.Client");

            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }

            Session                = new SessionInfo();
            Session.SessionID      = Guid.NewGuid().ToString();
            Session.AppName        = AppName;
            Session.LastActiveTime = DateTime.Now;
            Session.UserID         = S3104Consts.USER_ADMIN;


            //PartitionTableInfo partInfo = new PartitionTableInfo();
            //partInfo.TableName = ConstValue.TABLE_NAME_RECORD;
            //partInfo.PartType = TablePartType.DatetimeRange;
            //partInfo.Other1 = ConstValue.TABLE_FIELD_NAME_RECORD_STARTRECORDTIME;
            //Session.ListPartitionTables.Add(partInfo);
            //partInfo = new PartitionTableInfo();
            //partInfo.TableName = ConstValue.TABLE_NAME_OPTLOG;
            //partInfo.PartType = TablePartType.DatetimeRange;
            //partInfo.Other1 = ConstValue.TABLE_FIELD_NAME_OPTLOG_OPERATETIME;
            //Session.ListPartitionTables.Add(partInfo);


            RentInfo rentInfo = new RentInfo();

            rentInfo.ID      = S3104Consts.RENT_DEFAULT;
            rentInfo.Token   = S3104Consts.RENT_DEFAULT_TOKEN;
            rentInfo.Domain  = "voicecyber.com";
            rentInfo.Name    = "voicecyber";
            Session.RentInfo = rentInfo;

            UserInfo userInfo = new UserInfo();

            userInfo.UserID   = S3104Consts.USER_ADMIN;
            userInfo.Account  = "administrator";
            userInfo.UserName = "******";
            Session.UserInfo  = userInfo;

            RoleInfo roleInfo = new RoleInfo();

            roleInfo.ID      = S3104Consts.ROLE_SYSTEMADMIN;
            roleInfo.Name    = "System Admin";
            Session.RoleInfo = roleInfo;

            AppServerInfo serverInfo = new AppServerInfo();

            serverInfo.Protocol     = "https";
            serverInfo.Address      = "192.168.6.27";
            serverInfo.Port         = 8082;
            serverInfo.SupportHttps = true;
            Session.AppServerInfo   = serverInfo;

            ThemeInfo themeInfo = new ThemeInfo();

            themeInfo.Name    = "Default";
            themeInfo.Color   = "Brown";
            Session.ThemeInfo = themeInfo;
            Session.ThemeName = "Default";

            themeInfo       = new ThemeInfo();
            themeInfo.Name  = "Style01";
            themeInfo.Color = "Green";
            Session.SupportThemes.Add(themeInfo);

            themeInfo       = new ThemeInfo();
            themeInfo.Name  = "Style02";
            themeInfo.Color = "Yellow";
            Session.SupportThemes.Add(themeInfo);

            themeInfo       = new ThemeInfo();
            themeInfo.Name  = "Style03";
            themeInfo.Color = "Brown";
            Session.SupportThemes.Add(themeInfo);

            themeInfo       = new ThemeInfo();
            themeInfo.Name  = "Style04";
            themeInfo.Color = "Blue";
            Session.SupportThemes.Add(themeInfo);

            LangTypeInfo langType = new LangTypeInfo();

            langType.LangID      = 1033;
            langType.LangName    = "en-US";
            langType.Display     = "English(U.S.)";
            Session.LangTypeInfo = langType;
            Session.LangTypeID   = 1033;
            Session.SupportLangTypes.Add(langType);

            langType          = new LangTypeInfo();
            langType.LangID   = 2052;
            langType.LangName = "zh-CN";
            langType.Display  = "简体中文";
            Session.SupportLangTypes.Add(langType);

            langType          = new LangTypeInfo();
            langType.LangID   = 1028;
            langType.LangName = "tc-CN";
            langType.Display  = "繁體中文";
            Session.SupportLangTypes.Add(langType);

            langType          = new LangTypeInfo();
            langType.LangID   = 1041;
            langType.LangName = "jp-JP";
            langType.Display  = "日本语";
            Session.SupportLangTypes.Add(langType);

            DatabaseInfo dbInfo = new DatabaseInfo();

            dbInfo.TypeID              = 3;
            dbInfo.TypeName            = "ORCL";
            dbInfo.Host                = "192.168.4.182";
            dbInfo.Port                = 1521;
            dbInfo.DBName              = "PFOrcl";
            dbInfo.LoginName           = "PFDEV_TEST";
            dbInfo.Password            = "******";
            Session.DBType             = dbInfo.TypeID;
            Session.DBConnectionString = dbInfo.GetConnectionString();
            Session.DatabaseInfo       = dbInfo;

            //DatabaseInfo dbInfo = new DatabaseInfo();
            //dbInfo.TypeID = 2;
            //dbInfo.TypeName = "MSSQL";
            //dbInfo.Host = "192.168.4.182";
            //dbInfo.Port = 1433;
            //dbInfo.DBName = "UMPDataDB0826";
            //dbInfo.LoginName = "PFDEV";
            //dbInfo.Password = "******";
            //Session.DBConnectionString = dbInfo.GetConnectionString();
            //Session.DatabaseInfo = dbInfo;


            Session.InstallPath = @"C:\UMPRelease";
            WriteLog("AppInit", string.Format("SessionInfo inited."));
        }
Exemplo n.º 14
0
        private void InitSessionInfo()
        {
            mSession = SessionInfo.CreateSessionInfo("Demo", 0, (int)AppType.UMPClient);
            RentInfo rentInfo = new RentInfo();

            rentInfo.ID       = ConstValue.RENT_DEFAULT;
            rentInfo.Token    = ConstValue.RENT_DEFAULT_TOKEN;
            rentInfo.Domain   = "voicecyber.com";
            rentInfo.Name     = "voicecyber";
            mSession.RentInfo = rentInfo;
            mSession.RentID   = ConstValue.RENT_DEFAULT;

            UserInfo userInfo = new UserInfo();

            userInfo.UserID   = ConstValue.USER_ADMIN;
            userInfo.Account  = "administrator";
            userInfo.UserName = "******";
            userInfo.Password = "******";
            mSession.UserInfo = userInfo;
            mSession.UserID   = ConstValue.USER_ADMIN;

            RoleInfo roleInfo = new RoleInfo();

            roleInfo.ID       = ConstValue.ROLE_SYSTEMADMIN;
            roleInfo.Name     = "System Admin";
            mSession.RoleInfo = roleInfo;
            mSession.RoleID   = ConstValue.ROLE_SYSTEMADMIN;

            ThemeInfo themeInfo = new ThemeInfo();

            themeInfo.Name     = "Style01";
            themeInfo.Color    = "Green";
            mSession.ThemeInfo = themeInfo;
            mSession.ThemeName = "Style01";

            themeInfo       = new ThemeInfo();
            themeInfo.Name  = "Style01";
            themeInfo.Color = "Green";
            mSession.SupportThemes.Add(themeInfo);

            themeInfo       = new ThemeInfo();
            themeInfo.Name  = "Style02";
            themeInfo.Color = "Yellow";
            mSession.SupportThemes.Add(themeInfo);

            themeInfo       = new ThemeInfo();
            themeInfo.Name  = "Style03";
            themeInfo.Color = "Brown";
            mSession.SupportThemes.Add(themeInfo);

            themeInfo       = new ThemeInfo();
            themeInfo.Name  = "Style04";
            themeInfo.Color = "Blue";
            mSession.SupportThemes.Add(themeInfo);

            LangTypeInfo langType = new LangTypeInfo();

            langType.LangID   = 1033;
            langType.LangName = "en-us";
            langType.Display  = "English";
            mSession.SupportLangTypes.Add(langType);

            langType          = new LangTypeInfo();
            langType.LangID   = 2052;
            langType.LangName = "zh-cn";
            langType.Display  = "简体中文";
            mSession.SupportLangTypes.Add(langType);
            mSession.LangTypeInfo = langType;
            mSession.LangTypeID   = langType.LangID;

            langType          = new LangTypeInfo();
            langType.LangID   = 1028;
            langType.LangName = "zh-cn";
            langType.Display  = "繁体中文";
            mSession.SupportLangTypes.Add(langType);

            AppServerInfo appServerInfo = new AppServerInfo();

            appServerInfo.Protocol      = "http";
            appServerInfo.Address       = "192.168.6.63";
            appServerInfo.Port          = 8081;
            appServerInfo.SupportHttps  = false;
            appServerInfo.SupportNetTcp = false;
            mSession.AppServerInfo      = appServerInfo;

            //DatabaseInfo dbInfo = new DatabaseInfo();
            //dbInfo.TypeID = 2;
            //dbInfo.Host = "192.168.4.182";
            //dbInfo.Port = 1433;
            //dbInfo.DBName = "UMPDataDB0304";
            //dbInfo.LoginName = "PFDEV";
            //dbInfo.Password = "******";
            //mSession.DatabaseInfo = dbInfo;
            //mSession.DBType = dbInfo.TypeID;
            //mSession.DBConnectionString = dbInfo.GetConnectionString();

            DatabaseInfo dbInfo = new DatabaseInfo();

            dbInfo.TypeID               = 3;
            dbInfo.Host                 = "192.168.4.182";
            dbInfo.Port                 = 1521;
            dbInfo.DBName               = "PFOrcl";
            dbInfo.LoginName            = "pfdev832";
            dbInfo.Password             = "******";
            dbInfo.RealPassword         = "******";
            mSession.DatabaseInfo       = dbInfo;
            mSession.DBType             = dbInfo.TypeID;
            mSession.DBConnectionString = dbInfo.GetConnectionString();
        }