📄 loginctrl.ascx.cs
字号:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class Ctrls_LoginCtrl : PageBaseUserCtrl
{
protected void Page_Load(object sender, EventArgs e)
{
if (Session["CurrentUser"] == null)
{
this.panlLogin.Visible = true;
this.panlManage.Visible = false;
}
else if(CurrentUser != null)
{
this.panlManage.Visible = true;
this.panlLogin.Visible = false;
}
}
protected void btnLogin_Click(object sender, EventArgs e)
{
if (this.txtAccount.Text.Trim().Length <= 0)
{
this.ShowMessage("用户名不能为空");
this.panlLogin.Visible = true;
this.panlManage.Visible = false;
return;
}
if (this.txtPassword.Text.Trim().Length <= 0)
{
this.ShowMessage("密码不能为空");
this.panlLogin.Visible = true;
this.panlManage.Visible = false;
return;
}
Itsv.BLL.SystemManage.UserBLL userBLL = new Itsv.BLL.SystemManage.UserBLL();
Itsv.Model.User user = new Itsv.Model.User();
if (userBLL.UserLogin(txtAccount.Text.Trim().Replace("'", "\""), txtPassword.Text.Trim().Replace("'", "\""), ref msg, ref user))
{
this.CurrentUser = user;
this.WriteUserAction("登录系统,登录ip地址:" + GetClientIP());
this.panlLogin.Visible = false;
this.panlManage.Visible = true;
}
else
{
ShowMessage(msg);
this.panlLogin.Visible = true;
this.panlManage.Visible = false;
}
}
protected void lbtnLogOut_Click(object sender, EventArgs e)
{
this.CurrentUser = null;
Session.Abandon();
Response.Redirect("test.aspx");
}
protected void LinkButton1_Click(object sender, EventArgs e)
{
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -