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

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

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

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

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

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


复制代码
#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());
           }
       }
复制代码



你可能感兴趣的:(用户,记录,public,的)