C#.NET通用权限管理系统组件中用少数几行代码实现记录页面状态
申请用户帐户的界面如下,若想记录用户选中的默认参数,如下图:
公司主营业务:网站建设、网站制作、移动网站开发等业务。帮助企业客户真正实现互联网宣传,提高企业的竞争能力。成都创新互联公司是一支青春激扬、勤奋敬业、活力青春激扬、勤奋敬业、活力澎湃、和谐高效的团队。公司秉承以“开放、自由、严谨、自律”为核心的企业文化,感谢他们对我们的高要求,感谢他们从不同领域给我们带来的挑战,让我们激情的团队有机会用头脑与智慧不断的给客户带来惊喜。成都创新互联公司推出闽侯免费做网站回馈大家。
需要能记录红色选中部分的选项内容,希望每次进入次页面的时候,能记住用户的当前选中状态。
下面粘贴通用权限管理系统中的源码,有兴趣的朋友可以阅读理解,记录用户选中状态的代码实现部分
#region public override void FormOnLoad() 加载窗体
///
/// 加载窗体
///
publicoverridevoid 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;
}
elseif (password.Equals(this.rbtnDefaultPassword.Name))
{
this.rbtnDefaultPassword.Checked = true;
}
elseif (password.Equals(this.rbtnUserNamePassword.Name))
{
this.rbtnUserNamePassword.Checked = true;
}
}
}
#endregion
///
/// 加载窗体
///
publicoverridevoid 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;
}
elseif (password.Equals(this.rbtnDefaultPassword.Name))
{
this.rbtnDefaultPassword.Checked = true;
}
elseif (password.Equals(this.rbtnUserNamePassword.Name))
{
this.rbtnUserNamePassword.Checked = true;
}
}
}
#endregion
privatevoid 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);
}
}
privatevoid 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);
}
}
privatevoid 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);
}
}
{
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);
}
}
privatevoid 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);
}
}
privatevoid 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);
}
}
privatevoid chkIsStaff_CheckedChanged(object sender, EventArgs e)
{
if (this.FormLoaded)
{
DotNetService.Instance.ParameterService.SetParameter(BaseSystemInfo.UserInfo, "User", "RequestAnAccount", "IsStaff", this.chkIsStaff.Checked.ToString());
}
}
privatevoid chkClose_CheckedChanged(object sender, EventArgs e)
{
if (this.FormLoaded)
{
DotNetService.Instance.ParameterService.SetParameter(BaseSystemInfo.UserInfo, "User", "RequestAnAccount", "Close", this.chkClose.Checked.ToString());
}
}
{
if (this.FormLoaded)
{
DotNetService.Instance.ParameterService.SetParameter(BaseSystemInfo.UserInfo, "User", "RequestAnAccount", "IsStaff", this.chkIsStaff.Checked.ToString());
}
}
privatevoid chkClose_CheckedChanged(object sender, EventArgs e)
{
if (this.FormLoaded)
{
DotNetService.Instance.ParameterService.SetParameter(BaseSystemInfo.UserInfo, "User", "RequestAnAccount", "Close", this.chkClose.Checked.ToString());
}
}
当前标题:C#.NET通用权限管理系统组件中用少数几行代码实现记录页面状态
标题来源:http://pwwzsj.com/article/jpsgpd.html