权限管理、用户权限系统、开源用户权限系统、信息化建设标准基础数据管理平台
代码改变世界

C#.NET通用权限管理系统组件中用少数几行代码实现记录页面状态

2012-08-08 23:21  通用C#系统架构  阅读(1136)  评论(0编辑  收藏  举报

  申请用户帐户的界面如下,若想记录用户选中的默认参数,如下图:

吉日嘎拉,通用权限管理系统组件

   需要能记录红色选中部分的选项内容,希望每次进入次页面的时候,能记住用户的当前选中状态。

吉日嘎拉,通用权限管理系统组件 

 下面粘贴通用权限管理系统中的源码,有兴趣的朋友可以阅读理解,记录用户选中状态的代码实现部分

 

        #region public override void FormOnLoad() 加载窗体
        /// <summary>
        
/// 加载窗体
        
/// </summary>
        public override void FormOnLoad()
        {
            // 绑定下拉筐数据
            this.BindItemDetails();
            if (!string.IsNullOrEmpty(this.UserInfo.CompanyId))
            {
                this.ucCompany.SelectedId = this.UserInfo.CompanyId;
            }
            string isStaff = DotNetService.Instance.ParameterService.GetParameter(BaseSystemInfo.UserInfo, "User""RequestAnAccount""IsStaff");
            if (!string.IsNullOrEmpty(isStaff))
            {
                this.chkIsStaff.Checked = true.ToString().Equals(isStaff);
            }
            string close = DotNetService.Instance.ParameterService.GetParameter(BaseSystemInfo.UserInfo, "User""RequestAnAccount""Close");
            if (!string.IsNullOrEmpty(close))
            {
                this.chkClose.Checked = true.ToString().Equals(close);
            }
            string password = DotNetService.Instance.ParameterService.GetParameter(BaseSystemInfo.UserInfo, "User""RequestAnAccount""Password");
            if (!string.IsNullOrEmpty(password))
            {
                if (password.Equals(this.rbtnUserInput.Name))
                {
                    this.rbtnUserInput.Checked = true;
                }
                else if (password.Equals(this.rbtnDefaultPassword.Name))
                {
                    this.rbtnDefaultPassword.Checked = true;
                }
                else if (password.Equals(this.rbtnUserNamePassword.Name))
                {
                    this.rbtnUserNamePassword.Checked = true;
                }
            }
        }
        #endregion

 

        private void rbtnUserInput_CheckedChanged(object sender, EventArgs e)
        {
            if (this.rbtnUserInput.Checked)
            {
                this.txtPassword.TabStop = true;
                this.txtConfirmPassword.TabStop = true;
                this.txtPassword.Text = string.Empty;
                this.txtConfirmPassword.Text = string.Empty;
                DotNetService.Instance.ParameterService.SetParameter(BaseSystemInfo.UserInfo, "User""RequestAnAccount""Password"this.rbtnUserInput.Name);
            }
        }

        private void rbtnDefaultPassword_CheckedChanged(object sender, EventArgs e)
        {
            if (this.rbtnDefaultPassword.Checked)
            {
                this.txtPassword.Text = BaseSystemInfo.DefaultPassword;
                this.txtConfirmPassword.Text = BaseSystemInfo.DefaultPassword;
                if (!string.IsNullOrEmpty(this.txtPassword.Text))
                {
                    this.txtPassword.TabStop = false;
                    this.txtConfirmPassword.TabStop = false;
                }
                DotNetService.Instance.ParameterService.SetParameter(BaseSystemInfo.UserInfo, "User""RequestAnAccount""Password"this.rbtnDefaultPassword.Name);
            }
        }

        private void rbtnUserNamePassword_CheckedChanged(object sender, EventArgs e)
        {
            if (this.rbtnUserNamePassword.Checked)
            {
                this.txtPassword.Text = this.txtUserName.Text;
                this.txtConfirmPassword.Text = this.txtUserName.Text;
                if (string.IsNullOrEmpty(this.txtPassword.Text))
                {
                    this.txtPassword.TabStop = true;
                    this.txtConfirmPassword.TabStop = true;
                }
                else
                {
                    this.txtPassword.TabStop = false;
                    this.txtConfirmPassword.TabStop = false;
                }
                DotNetService.Instance.ParameterService.SetParameter(BaseSystemInfo.UserInfo, "User""RequestAnAccount""Password"this.rbtnUserNamePassword.Name);
            }
        }

 

        private void chkIsStaff_CheckedChanged(object sender, EventArgs e)
        {
            if (this.FormLoaded)
            {
                DotNetService.Instance.ParameterService.SetParameter(BaseSystemInfo.UserInfo, "User""RequestAnAccount""IsStaff"this.chkIsStaff.Checked.ToString());
            }
        }

        private void chkClose_CheckedChanged(object sender, EventArgs e)
        {
            if (this.FormLoaded)
            {
                DotNetService.Instance.ParameterService.SetParameter(BaseSystemInfo.UserInfo, "User""RequestAnAccount""Close"this.chkClose.Checked.ToString());
            }
        }

 



C# ASP.NET 通用权限设计、通用权限管理、通用权限组件、单点登录、集中式权限管理、统一授权体系、分级管理分级授权


微信扫一扫加好友