Ejemplo n.º 1
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");
        }