Example #1
0
 private void btnDecrypt_Click(object sender, EventArgs e)
 {
     // 如果当前处于已加密状态,则对数据库连接字符窜进行解密操作;
     if (this.chkEncryptDbConnection.Checked)
     {
         this.chkEncryptDbConnection.Checked = false;
         this.txtUserCenterDbConnection.Text = SecretUtil.Decrypt(this.txtUserCenterDbConnection.Text);
         this.txtBusinessDbConnection.Text   = SecretUtil.Decrypt(this.txtBusinessDbConnection.Text);
         this.txtWorkFlowDbConnection.Text   = SecretUtil.Decrypt(this.txtWorkFlowDbConnection.Text);
     }
 }
Example #2
0
        /// <summary>
        /// 获取现有的登录信息
        /// </summary>
        private void GetLogOnInfo()
        {
            if (this.chkRememberPassword.Checked)
            {
                string      userName    = BaseSystemInfo.CurrentUserName;
                DataRowView dataRowView = null;
                for (int i = 0; i < this.cmbUser.Items.Count; i++)
                {
                    dataRowView = (DataRowView)this.cmbUser.Items[i];
                    if (dataRowView[BaseUserEntity.FieldUserName].ToString().Equals(userName))
                    {
                        this.cmbUser.SelectedIndex = i;
                        break;
                    }
                }
                // 对密码进行解密操作
                string password = BaseSystemInfo.CurrentPassword;
                password = SecretUtil.Decrypt(password);
                this.txtPassword.Text = password;

                // 写入注册表信息,这个往往是会遇到安全问题,出现异常等

                /*
                 * RegistryKey registryKey = Registry.LocalMachine.OpenSubKey(@"Software\" + BaseConfiguration.COMPANY_NAME + "\\" + BaseSystemInfo.SoftName, false);
                 * if (registryKey != null)
                 * {
                 *  // 这里是保存用户名的读取,对用户名进行解密操作
                 *  string userName = (string)registryKey.GetValue(BaseConfiguration.CURRENT_USERNAME);
                 *  userName = SecretUtil.Decrypt(userName);
                 *  DataRowView dataRowView = null;
                 *  for (int i = 0; i < this.cmbUser.Items.Count; i++)
                 *  {
                 *      dataRowView = (DataRowView)this.cmbUser.Items[i];
                 *      if (dataRowView[BaseUserEntity.FieldUserName].ToString().Equals(userName))
                 *      {
                 *          this.cmbUser.SelectedIndex = i;
                 *          // this.cmbUser.SelectedItem = this.cmbUser.Items[i];
                 *          // this.cmbUser.SelectedValue = userName;
                 *          break;
                 *      }
                 *  }
                 *  // 对密码进行解密操作
                 *  string password = (string)registryKey.GetValue(BaseConfiguration.CURRENT_PASSWORD);
                 *  password = SecretUtil.Decrypt(password);
                 *  this.txtPassword.Text = password;
                 * }
                 */
            }
        }
        /// <summary>
        /// 获取现有的登录信息
        /// </summary>
        private void GetLogOnInfo()
        {
            if (this.chkRememberPassword.Checked)
            {
                this.txtUser.Text = BaseSystemInfo.CurrentUserName;

                // 对密码进行解密操作
                string password = BaseSystemInfo.CurrentPassword;
                if (BaseSystemInfo.ClientEncryptPassword)
                {
                    password = SecretUtil.Decrypt(password);
                }
                this.txtPassword.Text = password;

                this.ActiveControl = this.txtVerifyCode;
                this.txtVerifyCode.Focus();
            }
        }
Example #4
0
        /// <summary>
        /// 获取系统配置信息
        /// </summary>
        private void GetConfigInfo()
        {
            // 若没有配置文件
            if (!UserConfigHelper.Exists())
            {
                return;
            }
            this.chkClientEncryptPassword.Checked = BaseSystemInfo.ClientEncryptPassword;
            this.chkClientEncryptPassword.Visible = UserConfigHelper.Exists("ClientEncryptPassword");

            this.txtUser.Text = BaseSystemInfo.CurrentUserName;
            // 对密码进行解密操作
            this.txtClientPassword.Text = BaseSystemInfo.CurrentPassword;
            if (BaseSystemInfo.ClientEncryptPassword)
            {
                this.txtClientPassword.Text = SecretUtil.Decrypt(BaseSystemInfo.CurrentPassword);
            }

            // 初始化语言选项菜单
            // this.cmbCurrentLanguage.Items.Clear();
            // this.cmbCurrentLanguage.Items.Add("zh-CN");
            // this.cmbCurrentLanguage.Items.Add("zh-TW");
            // this.cmbCurrentLanguage.Items.Add("en-US");
            string[] currentLanguageItems = UserConfigHelper.GetOptions("CurrentLanguage");
            for (int i = 0; i < currentLanguageItems.Length; i++)
            {
                this.cmbCurrentLanguage.Items.Add(currentLanguageItems[i]);
            }
            this.cmbCurrentLanguage.SelectedIndex = this.cmbCurrentLanguage.Items.IndexOf(BaseSystemInfo.CurrentLanguage);
            this.lblCurrentLanguage.Visible       = UserConfigHelper.Exists("CurrentLanguage");
            this.cmbCurrentLanguage.Visible       = UserConfigHelper.Exists("CurrentLanguage");

            // this.cmbService.Items.Clear();
            // this.cmbService.Items.Add("DotNet.Service");
            // this.cmbService.Items.Add("DotNet.WCFClient");
            // this.cmbService.Items.Add("DotNet.RemotingClient");
            string[] servicePathItems = UserConfigHelper.GetOptions("Service");
            for (int i = 0; i < servicePathItems.Length; i++)
            {
                this.cmbService.Items.Add(servicePathItems[i]);
            }
            this.cmbService.SelectedIndex = this.cmbService.Items.IndexOf(BaseSystemInfo.Service);

            this.chkRememberPassword.Checked = BaseSystemInfo.RememberPassword;
            this.chbAutoLogOn.Checked        = BaseSystemInfo.AutoLogOn;
            this.chkRecordLog.Checked        = BaseSystemInfo.RecordLog;

            // 客户端若没这个配置,那就不读取这个配置了。
            this.chkUseMessage.Visible = UserConfigHelper.Exists("UseMessage");
            this.chkUseMessage.Checked = BaseSystemInfo.UseMessage;

            this.chkAllowUserRegister.Checked = BaseSystemInfo.AllowUserRegister;
            this.txtCustomerCompanyName.Text  = BaseSystemInfo.CustomerCompanyName;

            this.txtMainForm.Text  = BaseSystemInfo.MainForm;
            this.txtLogOnForm.Text = BaseSystemInfo.LogOnForm;

            this.nupOnLineLimit.Value = BaseSystemInfo.OnLineLimit;

            this.chkUseUserPermission.Checked     = BaseSystemInfo.UseUserPermission;
            this.chkUseOrganizePermission.Checked = BaseSystemInfo.UseOrganizePermission;
            this.chkUseModulePermission.Checked   = BaseSystemInfo.UseModulePermission;
            this.chkWorkFlow.Visible = UserConfigHelper.Exists("UseWorkFlow");
            this.chkWorkFlow.Checked = BaseSystemInfo.UseWorkFlow;

            // 是否隐藏这个配置选项
            this.chkUseOrganizePermission.Visible = UserConfigHelper.Exists("UseOrganizePermission");
            this.chkUsePermissionScope.Visible    = UserConfigHelper.Exists("UsePermissionScope");
            this.chkUsePermissionScope.Checked    = BaseSystemInfo.UsePermissionScope;
            this.chkUseAuthorizationScope.Visible = UserConfigHelper.Exists("UseAuthorizationScope");
            this.chkUseAuthorizationScope.Checked = BaseSystemInfo.UseAuthorizationScope;

            // 是否隐藏这个配置选项
            this.chkUseTableColumnPermission.Visible = UserConfigHelper.Exists("UseTableColumnPermission");
            this.chkUseTableColumnPermission.Checked = BaseSystemInfo.UseTableColumnPermission;

            // 是否隐藏这个配置选项
            this.chkUseTableScopePermission.Visible = UserConfigHelper.Exists("UseTableScopePermission");
            this.chkUseTableScopePermission.Checked = BaseSystemInfo.UseTableScopePermission;

            // 初始化数据库
            // this.cmbDbType.Items.Clear();
            // this.cmbDbType.Items.Add("SqlServer");
            // this.cmbDbType.Items.Add("Oracle");
            // this.cmbDbType.Items.Add("Access");
            // this.cmbDbType.Items.Add("DB2");
            // this.cmbDbType.Items.Add("MySql");
            // this.cmbDbType.Items.Add("SQLite");
            string[] dataBaseTypeItems = UserConfigHelper.GetOptions("UserCenterDbType");
            for (int i = 0; i < dataBaseTypeItems.Length; i++)
            {
                this.cmbUserCenterDbDbType.Items.Add(dataBaseTypeItems[i]);
            }
            this.cmbUserCenterDbDbType.SelectedIndex = this.cmbUserCenterDbDbType.Items.IndexOf(BaseSystemInfo.UserCenterDbType.ToString());

            dataBaseTypeItems = UserConfigHelper.GetOptions("BusinessDbType");
            for (int i = 0; i < dataBaseTypeItems.Length; i++)
            {
                this.cmbBusinessDbDbType.Items.Add(dataBaseTypeItems[i]);
            }
            this.cmbBusinessDbDbType.SelectedIndex = this.cmbBusinessDbDbType.Items.IndexOf(BaseSystemInfo.BusinessDbType.ToString());

            dataBaseTypeItems = UserConfigHelper.GetOptions("WorkFlowDbType");
            for (int i = 0; i < dataBaseTypeItems.Length; i++)
            {
                this.cmbWorkFlowDbDbType.Items.Add(dataBaseTypeItems[i]);
            }
            this.cmbWorkFlowDbDbType.SelectedIndex = this.cmbWorkFlowDbDbType.Items.IndexOf(BaseSystemInfo.WorkFlowDbType.ToString());

            this.chkEncryptDbConnection.Checked = BaseSystemInfo.EncryptDbConnection;
            this.btnEncrypt.Visible             = !BaseSystemInfo.EncryptDbConnection;
            this.txtUserCenterDbConnection.Text = BaseSystemInfo.UserCenterDbConnectionString;
            this.txtBusinessDbConnection.Text   = BaseSystemInfo.BusinessDbConnectionString;

            this.txtWorkFlowDbConnection.Text    = BaseSystemInfo.WorkFlowDbConnectionString;
            this.lblWorkFlowDbConnection.Visible = UserConfigHelper.Exists() && UserConfigHelper.Exists("WorkFlowDbConnection");
            this.cmbWorkFlowDbDbType.Visible     = UserConfigHelper.Exists() && UserConfigHelper.Exists("WorkFlowDbConnection");
            this.txtWorkFlowDbConnection.Visible = UserConfigHelper.Exists() && UserConfigHelper.Exists("WorkFlowDbConnection");
        }
        /// <summary>
        /// 从配置信息获取配置信息
        /// </summary>
        /// <param name="configuration">配置</param>
        public static void GetConfig()
        {
            // 读取注册码
            BaseSystemInfo.RegisterKey = ConfigurationManager.AppSettings["RegisterKey"];

            // 客户信息配置
            if (ConfigurationManager.AppSettings["CustomerCompanyName"] != null)
            {
                BaseSystemInfo.CustomerCompanyName = ConfigurationManager.AppSettings["CustomerCompanyName"];
            }
            if (ConfigurationManager.AppSettings["ConfigurationFrom"] != null)
            {
                BaseSystemInfo.ConfigurationFrom = BaseConfiguration.GetConfiguration(ConfigurationManager.AppSettings["ConfigurationFrom"]);
            }
            if (ConfigurationManager.AppSettings["SoftName"] != null)
            {
                BaseSystemInfo.SoftName = ConfigurationManager.AppSettings["SoftName"];
            }
            if (ConfigurationManager.AppSettings["SoftFullName"] != null)
            {
                BaseSystemInfo.SoftFullName = ConfigurationManager.AppSettings["SoftFullName"];
            }
            if (ConfigurationManager.AppSettings["SystemCode"] != null)
            {
                BaseSystemInfo.SystemCode = ConfigurationManager.AppSettings["SystemCode"];
            }
            if (ConfigurationManager.AppSettings["RootMenuCode"] != null)
            {
                BaseSystemInfo.RootMenuCode = ConfigurationManager.AppSettings["RootMenuCode"];
            }
            if (ConfigurationManager.AppSettings["ServiceUserName"] != null)
            {
                BaseSystemInfo.ServiceUserName = ConfigurationManager.AppSettings["ServiceUserName"];
            }
            if (ConfigurationManager.AppSettings["ServicePassword"] != null)
            {
                BaseSystemInfo.ServicePassword = ConfigurationManager.AppSettings["ServicePassword"];
            }
            // BaseSystemInfo.CurrentLanguage = ConfigurationManager.AppSettings[BaseConfiguration.CURRENT_LANGUAGE];
            // BaseSystemInfo.Version = ConfigurationManager.AppSettings[BaseConfiguration.VERSION];

            // BaseSystemInfo.UseModulePermission = (ConfigurationManager.AppSettings[BaseConfiguration.USE_MODULE_PERMISSION].ToUpper(), true.ToString().ToUpper(), true);
            // BaseSystemInfo.UsePermissionScope = (ConfigurationManager.AppSettings[BaseConfiguration.USE_PERMISSIONS_COPE].ToUpper(), true.ToString().ToUpper(), true);
            // BaseSystemInfo.UseTablePermission = (ConfigurationManager.AppSettings[BaseConfiguration.USE_TABLE_PERMISSION].ToUpper(), true.ToString().ToUpper(), true);

            // BaseSystemInfo.Service = ConfigurationManager.AppSettings[BaseConfiguration.SERVICE];
            // BaseSystemInfo.RecordLog = (ConfigurationManager.AppSettings[BaseConfiguration.RECORD_LOG].ToUpper(), true.ToString().ToUpper(), true);

            if (ConfigurationManager.AppSettings["ServerEncryptPassword"] != null)
            {
                BaseSystemInfo.ServerEncryptPassword = ConfigurationManager.AppSettings["ServerEncryptPassword"].ToUpper().Equals(true.ToString().ToUpper());
            }
            if (ConfigurationManager.AppSettings["ClientEncryptPassword"] != null)
            {
                BaseSystemInfo.ClientEncryptPassword = ConfigurationManager.AppSettings["ClientEncryptPassword"].ToUpper().Equals(true.ToString().ToUpper());
            }
            if (ConfigurationManager.AppSettings["CheckIPAddress"] != null)
            {
                BaseSystemInfo.CheckIPAddress = ConfigurationManager.AppSettings["CheckIPAddress"].ToUpper().Equals(true.ToString().ToUpper());
            }

            // BaseSystemInfo.AutoLogOn = (ConfigurationManager.AppSettings[BaseConfiguration.AUTO_LOGON].ToUpper(), true.ToString().ToUpper(), true);
            // BaseSystemInfo.LogOnAssembly = ConfigurationManager.AppSettings[BaseConfiguration.LOGON_ASSEMBLY];
            // BaseSystemInfo.LogOnForm = ConfigurationManager.AppSettings[BaseConfiguration.LOGON_FORM];
            // BaseSystemInfo.MainForm = ConfigurationManager.AppSettings[BaseConfiguration.MAIN_FORM];

            if (ConfigurationManager.AppSettings["CheckOnLine"] != null)
            {
                BaseSystemInfo.CheckOnLine = ConfigurationManager.AppSettings["CheckOnLine"].ToUpper().Equals(true.ToString().ToUpper());
            }
            // BaseSystemInfo.LoadAllUser = (ConfigurationManager.AppSettings[BaseConfiguration.LOAD_All_USER].ToUpper(), true.ToString().ToUpper(), true);
            // BaseSystemInfo.AllowUserRegister = (ConfigurationManager.AppSettings[BaseConfiguration.ALLOW_USER_REGISTER].ToUpper(), true.ToString().ToUpper(), true);

            // 数据库连接
            if (ConfigurationManager.AppSettings["UserCenterDbType"] != null)
            {
                BaseSystemInfo.UserCenterDbType = BaseConfiguration.GetDbType(ConfigurationManager.AppSettings["UserCenterDbType"]);
            }
            if (ConfigurationManager.AppSettings["BusinessDbType"] != null)
            {
                BaseSystemInfo.BusinessDbType = BaseConfiguration.GetDbType(ConfigurationManager.AppSettings["BusinessDbType"]);
            }
            if (ConfigurationManager.AppSettings["WorkFlowDbType"] != null)
            {
                BaseSystemInfo.WorkFlowDbType = BaseConfiguration.GetDbType(ConfigurationManager.AppSettings["WorkFlowDbType"]);
            }
            if (ConfigurationManager.AppSettings["EncryptDbConnection"] != null)
            {
                BaseSystemInfo.EncryptDbConnection = ConfigurationManager.AppSettings["EncryptDbConnection"].ToUpper().Equals(true.ToString().ToUpper());
            }
            if (ConfigurationManager.AppSettings["BusinessDbConnection"] != null)
            {
                BaseSystemInfo.BusinessDbConnectionString = ConfigurationManager.AppSettings["BusinessDbConnection"];
            }
            if (ConfigurationManager.AppSettings["UserCenterDbConnection"] != null)
            {
                BaseSystemInfo.UserCenterDbConnectionString = ConfigurationManager.AppSettings["UserCenterDbConnection"];
            }
            if (ConfigurationManager.AppSettings["WorkFlowDbConnection"] != null)
            {
                BaseSystemInfo.WorkFlowDbConnectionString = ConfigurationManager.AppSettings["WorkFlowDbConnection"];
            }
            // 对加密的数据库连接进行解密操作
            if (BaseSystemInfo.EncryptDbConnection)
            {
                BaseSystemInfo.BusinessDbConnection   = SecretUtil.Decrypt(BaseSystemInfo.BusinessDbConnectionString);
                BaseSystemInfo.UserCenterDbConnection = SecretUtil.Decrypt(BaseSystemInfo.UserCenterDbConnectionString);
                BaseSystemInfo.WorkFlowDbConnection   = SecretUtil.Decrypt(BaseSystemInfo.WorkFlowDbConnectionString);
            }
            else
            {
                BaseSystemInfo.BusinessDbConnection   = BaseSystemInfo.BusinessDbConnectionString;
                BaseSystemInfo.UserCenterDbConnection = BaseSystemInfo.UserCenterDbConnectionString;
                BaseSystemInfo.WorkFlowDbConnection   = BaseSystemInfo.WorkFlowDbConnectionString;
            }

            // 这里重新给静态数据库连接对象进行赋值
            // DotNet.Utilities.DbHelper.DbConnection = BaseSystemInfo.BusinessDbConnection;
            // DotNet.Utilities.DbHelper.DbType = BaseSystemInfo.BusinessDbType;
        }
Example #6
0
        /// <summary>
        /// 从配置信息获取配置信息
        /// </summary>
        /// <param name="configuration">配置</param>
        public static void GetConfig()
        {
            // 对加密的数据库连接进行解密操作
            if (ConfigurationManager.AppSettings["EncryptDbConnection"] != null)
            {
                BaseSystemInfo.EncryptDbConnection = ConfigurationManager.AppSettings["EncryptDbConnection"].ToUpper().Equals(true.ToString().ToUpper());
            }


            #region 数据库相关的配置

            #region 主要数据库
            if (ConfigurationManager.AppSettings["CenterDbType"] != null)
            {
                BaseSystemInfo.CenterDbType = BaseConfiguration.GetDbType(ConfigurationManager.AppSettings["CenterDbType"]);
            }
            if (ConfigurationManager.AppSettings["CenterDbConnection"] != null)
            {
                BaseSystemInfo.CenterDbConnection = ConfigurationManager.AppSettings["CenterDbConnection"];
            }
            if (BaseSystemInfo.EncryptDbConnection)
            {
                BaseSystemInfo.CenterDbConnectionString = SecretUtil.Decrypt(BaseSystemInfo.CenterDbConnection);
            }
            else
            {
                BaseSystemInfo.CenterDbConnectionString = BaseSystemInfo.CenterDbConnection;
            }
            #endregion


            #region 业务数据库
            if (ConfigurationManager.AppSettings["BusinessDbType"] != null)
            {
                BaseSystemInfo.BusinessDbType = BaseConfiguration.GetDbType(ConfigurationManager.AppSettings["BusinessDbType"]);
            }
            if (ConfigurationManager.AppSettings["BusinessDbConnection"] != null)
            {
                BaseSystemInfo.BusinessDbConnection = ConfigurationManager.AppSettings["BusinessDbConnection"];
            }
            if (BaseSystemInfo.EncryptDbConnection)
            {
                BaseSystemInfo.BusinessDbConnectionString = SecretUtil.Decrypt(BaseSystemInfo.BusinessDbConnection);
            }
            else
            {
                BaseSystemInfo.BusinessDbConnectionString = BaseSystemInfo.BusinessDbConnection;
            }
            #endregion


            #region 工作流数据库
            if (ConfigurationManager.AppSettings["WorkFlowDbType"] != null)
            {
                BaseSystemInfo.WorkFlowDbType = BaseConfiguration.GetDbType(ConfigurationManager.AppSettings["WorkFlowDbType"]);
            }
            if (ConfigurationManager.AppSettings["WorkFlowDbConnection"] != null)
            {
                BaseSystemInfo.WorkFlowDbConnection = ConfigurationManager.AppSettings["WorkFlowDbConnection"];
            }
            if (BaseSystemInfo.EncryptDbConnection)
            {
                BaseSystemInfo.WorkFlowDbConnectionString = SecretUtil.Decrypt(BaseSystemInfo.WorkFlowDbConnection);
            }
            else
            {
                BaseSystemInfo.WorkFlowDbConnectionString = BaseSystemInfo.WorkFlowDbConnection;
            }
            #endregion


            #region 卡务数据库

            if (ConfigurationManager.AppSettings["KawuDbType"] != null)
            {
                BaseSystemInfo.KawuDbType = BaseConfiguration.GetDbType(ConfigurationManager.AppSettings["KawuDbType"]);
            }
            if (ConfigurationManager.AppSettings["KawuDbConnection"] != null)
            {
                BaseSystemInfo.KawuDbConnection = ConfigurationManager.AppSettings["KawuDbConnection"];
            }
            if (BaseSystemInfo.EncryptDbConnection)
            {
                BaseSystemInfo.KawuDbConnectionString = SecretUtil.Decrypt(BaseSystemInfo.KawuDbConnection);
            }
            else
            {
                BaseSystemInfo.KawuDbConnectionString = BaseSystemInfo.KawuDbConnection;
            }
            #endregion

            #endregion
        }
Example #7
0
        /// <summary>
        /// 从指定的文件读取配置项
        /// </summary>
        /// <param name="fileName">配置文件</param>
        public static void GetConfig(string fileName)
        {
            XmlDocument xmlDocument = new XmlDocument();

            xmlDocument.Load(fileName);

            // 客户信息配置
            if (Exists("CurrentUserName"))
            {
                BaseSystemInfo.CurrentUserName = GetValue(xmlDocument, "CurrentUserName");
            }
            if (Exists("CurrentPassword"))
            {
                BaseSystemInfo.CurrentPassword = GetValue(xmlDocument, "CurrentPassword");
            }
            if (Exists("MultiLanguage"))
            {
                BaseSystemInfo.MultiLanguage = (String.Compare(GetValue(xmlDocument, "MultiLanguage"), "TRUE", true, CultureInfo.CurrentCulture) == 0);
            }
            if (Exists("CurrentLanguage"))
            {
                BaseSystemInfo.CurrentLanguage = GetValue(xmlDocument, "CurrentLanguage");
            }
            if (Exists("RememberPassword"))
            {
                BaseSystemInfo.RememberPassword = (String.Compare(GetValue(xmlDocument, "RememberPassword"), "TRUE", true, CultureInfo.CurrentCulture) == 0);
            }
            if (Exists("AutoLogOn"))
            {
                BaseSystemInfo.AutoLogOn = (String.Compare(GetValue(xmlDocument, "AutoLogOn"), "TRUE", true, CultureInfo.CurrentCulture) == 0);
            }
            if (Exists("ClientEncryptPassword"))
            {
                BaseSystemInfo.ClientEncryptPassword = (String.Compare(GetValue(xmlDocument, "ClientEncryptPassword"), "TRUE", true, CultureInfo.CurrentCulture) == 0);
            }
            if (Exists("ServerEncryptPassword"))
            {
                BaseSystemInfo.ServerEncryptPassword = (String.Compare(GetValue(xmlDocument, "ServerEncryptPassword"), "TRUE", true, CultureInfo.CurrentCulture) == 0);
            }

            // add by zgl
            if (Exists("CheckIPAddress"))
            {
                BaseSystemInfo.CheckIPAddress = (String.Compare(GetValue(xmlDocument, "CheckIPAddress"), "TRUE", true, CultureInfo.CurrentCulture) == 0);
            }
            if (Exists("CheckOnLine"))
            {
                BaseSystemInfo.CheckOnLine = (String.Compare(GetValue(xmlDocument, "CheckOnLine"), "TRUE", true, CultureInfo.CurrentCulture) == 0);
            }
            if (Exists("UseMessage"))
            {
                BaseSystemInfo.UseMessage = (String.Compare(GetValue(xmlDocument, "UseMessage"), "TRUE", true, CultureInfo.CurrentCulture) == 0);
            }
            if (Exists("AllowUserRegister"))
            {
                BaseSystemInfo.AllowUserRegister = (String.Compare(GetValue(xmlDocument, "AllowUserRegister"), "TRUE", true, CultureInfo.CurrentCulture) == 0);
            }
            if (Exists("RecordLog"))
            {
                BaseSystemInfo.RecordLog = (String.Compare(GetValue(xmlDocument, "RecordLog"), "TRUE", true, CultureInfo.CurrentCulture) == 0);
            }

            BaseSystemInfo.CustomerCompanyName = GetValue(xmlDocument, "CustomerCompanyName");
            BaseSystemInfo.ConfigurationFrom   = BaseConfiguration.GetConfiguration(GetValue(xmlDocument, "ConfigurationFrom"));
            BaseSystemInfo.SoftName            = GetValue(xmlDocument, "SoftName");
            BaseSystemInfo.SoftFullName        = GetValue(xmlDocument, "SoftFullName");

            if (Exists("SystemCode"))
            {
                BaseSystemInfo.SystemCode = GetValue(xmlDocument, "SystemCode");
            }
            if (Exists("RootMenuCode"))
            {
                BaseSystemInfo.RootMenuCode = GetValue(xmlDocument, "RootMenuCode");
            }
            BaseSystemInfo.Version = GetValue(xmlDocument, "Version");

            if (Exists("UseOrganizePermission"))
            {
                BaseSystemInfo.UseOrganizePermission = (String.Compare(GetValue(xmlDocument, "UseOrganizePermission"), "TRUE", true, CultureInfo.CurrentCulture) == 0);
            }
            if (Exists("UseUserPermission"))
            {
                BaseSystemInfo.UseUserPermission = (String.Compare(GetValue(xmlDocument, "UseUserPermission"), "TRUE", true, CultureInfo.CurrentCulture) == 0);
            }
            if (Exists("UseModulePermission"))
            {
                BaseSystemInfo.UseModulePermission = (String.Compare(GetValue(xmlDocument, "UseModulePermission"), "TRUE", true, CultureInfo.CurrentCulture) == 0);
            }
            if (Exists("UsePermissionItem"))
            {
                BaseSystemInfo.UsePermissionItem = (String.Compare(GetValue(xmlDocument, "UsePermissionItem"), "TRUE", true, CultureInfo.CurrentCulture) == 0);
            }
            if (Exists("UseTableColumnPermission"))
            {
                BaseSystemInfo.UseTableColumnPermission = (String.Compare(GetValue(xmlDocument, "UseTableColumnPermission"), "TRUE", true, CultureInfo.CurrentCulture) == 0);
            }
            if (Exists("UseTableScopePermission"))
            {
                BaseSystemInfo.UseTableScopePermission = (String.Compare(GetValue(xmlDocument, "UseTableScopePermission"), "TRUE", true, CultureInfo.CurrentCulture) == 0);
            }
            if (Exists("UsePermissionScope"))
            {
                BaseSystemInfo.UsePermissionScope = (String.Compare(GetValue(xmlDocument, "UsePermissionScope"), "TRUE", true, CultureInfo.CurrentCulture) == 0);
            }
            if (Exists("UseAuthorizationScope"))
            {
                BaseSystemInfo.UseAuthorizationScope = (String.Compare(GetValue(xmlDocument, "UseAuthorizationScope"), "TRUE", true, CultureInfo.CurrentCulture) == 0);
            }
            if (Exists("HandwrittenSignature"))
            {
                BaseSystemInfo.HandwrittenSignature = (String.Compare(GetValue(xmlDocument, "HandwrittenSignature"), "TRUE", true, CultureInfo.CurrentCulture) == 0);
            }

            if (Exists("LoadAllUser"))
            {
                BaseSystemInfo.LoadAllUser = (String.Compare(GetValue(xmlDocument, "LoadAllUser"), "TRUE", true, CultureInfo.CurrentCulture) == 0);
            }

            if (Exists("Service"))
            {
                BaseSystemInfo.Service = GetValue(xmlDocument, "Service");
            }
            if (Exists("LogOnForm"))
            {
                BaseSystemInfo.LogOnForm = GetValue(xmlDocument, "LogOnForm");
            }
            if (Exists("MainForm"))
            {
                BaseSystemInfo.MainForm = GetValue(xmlDocument, "MainForm");
            }

            int.TryParse(GetValue(xmlDocument, "OnLineLimit"), out BaseSystemInfo.OnLineLimit);

            // 打开数据库连接
            if (Exists("UserCenterDbType"))
            {
                BaseSystemInfo.UserCenterDbType = BaseConfiguration.GetDbType(GetValue(xmlDocument, "UserCenterDbType"));
            }
            if (Exists("BusinessDbType"))
            {
                BaseSystemInfo.BusinessDbType = BaseConfiguration.GetDbType(GetValue(xmlDocument, "BusinessDbType"));
            }
            if (Exists("WorkFlowDbType"))
            {
                BaseSystemInfo.WorkFlowDbType = BaseConfiguration.GetDbType(GetValue(xmlDocument, "WorkFlowDbType"));
            }
            BaseSystemInfo.EncryptDbConnection          = (String.Compare(GetValue(xmlDocument, "EncryptDbConnection"), "TRUE", true, CultureInfo.CurrentCulture) == 0);
            BaseSystemInfo.BusinessDbConnectionString   = GetValue(xmlDocument, "BusinessDbConnection");
            BaseSystemInfo.WorkFlowDbConnectionString   = GetValue(xmlDocument, "WorkFlowDbConnection");
            BaseSystemInfo.UserCenterDbConnectionString = GetValue(xmlDocument, "UserCenterDbConnection");
            if (BaseSystemInfo.EncryptDbConnection)
            {
                BaseSystemInfo.WorkFlowDbConnection   = SecretUtil.Decrypt(BaseSystemInfo.WorkFlowDbConnectionString);
                BaseSystemInfo.BusinessDbConnection   = SecretUtil.Decrypt(BaseSystemInfo.BusinessDbConnectionString);
                BaseSystemInfo.UserCenterDbConnection = SecretUtil.Decrypt(BaseSystemInfo.UserCenterDbConnectionString);
            }
            else
            {
                BaseSystemInfo.WorkFlowDbConnection   = BaseSystemInfo.WorkFlowDbConnectionString;
                BaseSystemInfo.BusinessDbConnection   = BaseSystemInfo.BusinessDbConnectionString;
                BaseSystemInfo.UserCenterDbConnection = BaseSystemInfo.UserCenterDbConnectionString;
            }

            if (Exists("ServiceUserName"))
            {
                BaseSystemInfo.ServiceUserName = GetValue(xmlDocument, "ServiceUserName");
            }
            if (Exists("ServicePassword"))
            {
                BaseSystemInfo.ServicePassword = GetValue(xmlDocument, "ServicePassword");
            }

            BaseSystemInfo.RegisterKey = GetValue(xmlDocument, "RegisterKey");

            // 错误报告相关
            BaseSystemInfo.ErrorReportTo           = GetValue(xmlDocument, "ErrorReportTo");
            BaseSystemInfo.ErrorReportMailUserName = GetValue(xmlDocument, "ErrorReportMailUserName");
            BaseSystemInfo.ErrorReportMailPassword = GetValue(xmlDocument, "ErrorReportMailPassword");
            // BaseSystemInfo.ErrorReportMailPassword = SecretUtil.Encrypt(BaseSystemInfo.ErrorReportMailPassword);
            BaseSystemInfo.ErrorReportMailPassword = SecretUtil.Decrypt(BaseSystemInfo.ErrorReportMailPassword);

            // 这里重新给静态数据库连接对象进行赋值
            // DotNet.Utilities.DbHelper.DbConnection = BaseSystemInfo.BusinessDbConnection;
            // DotNet.Utilities.DbHelper.DbType = BaseSystemInfo.BusinessDbType;
        }