📄 uc_login.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 UserControl_uc_login : System.Web.UI.UserControl
{
//该源码下载自www.51aspx.com(51aspx.com)
protected void Page_Load(object sender, EventArgs e)
{
TextBox1.Focus();
}
protected void Button1_Click(object sender, EventArgs e)
{
string userID = TextBox1.Text.ToString();
string userPWD = TextBox2.Text.ToString();
if ( (userID == "") || (userPWD == "") )
{
ExamOnline.Common.ShowMess("出错可能原因:1.用户名不能为空。2.密码不能为空。");
}
else
{
if (cbExercise.Checked == false)
{
int loginResult = (new ExamOnline.Login()).checkUser(ref userID, ref userPWD);
if (loginResult == 2)
{
Session["userID"] = userID;
Session["checkUser"] = "exam";
Response.Redirect("examlogin.aspx");
}
else if (loginResult == 0)
{
ExamOnline.Common.ShowMess("出错可能原因:1.用户名错误。2.密码错误。");
}
else if (loginResult == 1)
{
ExamOnline.Common.ShowMess("出错可能原因:该时段内没有考试!");
}
else if (loginResult == 3)
{
ExamOnline.Common.ShowMess("出错可能原因:1.你本学期无该课程的考试。2.你已经考过。");
}
else if (loginResult == 4)
{
ExamOnline.Common.ShowMess("出错可能原因:1.你迟到规定的时间以上。2.考试未开始。");
}
}
else if(cbExercise.Checked == true)
{
bool ifAllow = (new ExamOnline.Login()).checkPWD(ref userID, ref userPWD);
if (ifAllow == true)
{
Session["checkUser"] = "exercise";
Response.Redirect("exerciselogin.aspx");
}
else
{
ExamOnline.Common.ShowMess("出错可能原因:1.用户名错误。2.密码错误。");
}
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -