public override void SetControlState() { if (UserConfigHelper.Exists()) { this.btnConfirm.Enabled = true; this.btnEncrypt.Enabled = true; this.btnSystemSecurity.Enabled = true; } // 已经登录了系统,并且是系统管理员才可以做这个服务器端的配置,第一次用时无法配置系统了 /* * if (!BaseSystemInfo.LogOned || !this.UserInfo.IsAdministrator) * { * this.tcConfirm.TabPages.Remove(tpServer); * } */ this.btnSystemSecurity.Visible = BaseSystemInfo.UserIsLogOn && BaseSystemInfo.UserInfo.IsAdministrator; // 只有系统管理员才可以初始化系统,并却是sqlserver数据库下才运行 this.btnInitialize.Visible = BaseSystemInfo.UserIsLogOn && BaseSystemInfo.UserInfo.IsAdministrator; if (this.btnInitialize.Visible) { if (BaseSystemInfo.UserCenterDbType == DbTypes.SqlServer) { string parameter = DotNetService.Instance.ParameterService.GetParameter(UserInfo, "System", "System", "Initialize"); if (!string.IsNullOrEmpty(parameter) && parameter.Equals("None")) { this.btnInitialize.Enabled = true; } } } }
/// <summary> /// 设置控件状态 /// </summary> public override void SetControlState() { if (BaseSystemInfo.UserIsLogOn) { this.Text = AppMessage.MSGReLogOn; } // 是否允许申请密码 this.btnRequestAnAccount.Visible = BaseSystemInfo.AllowUserRegister; // 密码强度检查 this.labPasswordReq.Visible = BaseSystemInfo.CheckPasswordStrength; // 已登录了?还是未登录状态 if (BaseSystemInfo.UserIsLogOn) { this.CancelButton = this.btnCancel; this.btnCancel.Show(); this.btnExit.Hide(); } else { this.CancelButton = this.btnExit; this.btnExit.Show(); this.btnCancel.Hide(); } this.btnConfig.Visible = UserConfigHelper.Exists(); }
/// <summary> /// 设置控件状态 /// </summary> public override void SetControlState() { if (UserConfigHelper.Exists()) { DefaultPassword = UserConfigHelper.GetValue("DefaultPassword"); } this.btnSetDefaultPassword.Visible = !string.IsNullOrEmpty(DefaultPassword); // 密码强度检查 this.lblConfirmPasswordReq.Visible = BaseSystemInfo.CheckPasswordStrength; this.lblNewPasswordReq.Visible = BaseSystemInfo.CheckPasswordStrength; // this.btnDeletePassword.Visible = !BaseSystemInfo.CheckPasswordStrength; this.btnSetAsUserCode.Visible = this.UserInfo.IsAdministrator; this.btnSetAsUserName.Visible = this.UserInfo.IsAdministrator; }
/// <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"); }