温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:Asp.net在线考试系统源码及毕业设计论文
当前文件:
ExamOnline/UserControl/uc_login.ascx.cs[2K,2009-6-12 11:42:06],打开代码结构图
ExamOnline/UserControl/uc_login.ascx.cs[2K,2009-6-12 11:42:06],打开代码结构图1using System; 2
using System.Data; 3
using System.Configuration; 4
using System.Collections; 5
using System.Web; 6
using System.Web.Security; 7
using System.Web.UI; 8
using System.Web.UI.WebControls; 9
using System.Web.UI.WebControls.WebParts; 10
using System.Web.UI.HtmlControls; 11
12
public partial class UserControl_uc_login : System.Web.UI.UserControl 13
{ 14
//该源码下载自www.51aspx.com(51aspx.com) 15
16
protected void Page_Load(object sender, EventArgs e) 17
{ 18
TextBox1.Focus(); 19
} 20
protected void Button1_Click(object sender, EventArgs e) 21
{ 22
string userID = TextBox1.Text.ToString(); 23
string userPWD = TextBox2.Text.ToString(); 24
25
if ( (userID == "") || (userPWD == "") ) 26
{ 27
ExamOnline.Common.ShowMess("出错可能原因:1.用户名不能为空。2.密码不能为空。"); 28
} 29
else 30
{ 31
if (cbExercise.Checked == false) 32
{ 33
int loginResult = (new ExamOnline.Login()).checkUser(ref userID, ref userPWD); 34
if (loginResult == 2) 35
{ 36
Session["userID"] = userID; 37
Session["checkUser"] = "exam"; 38
Response.Redirect("examlogin.aspx"); 39
} 40
else if (loginResult == 0) 41
{ 42
ExamOnline.Common.ShowMess("出错可能原因:1.用户名错误。2.密码错误。"); 43
} 44
else if (loginResult == 1) 45
{ 46
ExamOnline.Common.ShowMess("出错可能原因:该时段内没有考试!"); 47
} 48
else if (loginResult == 3) 49
{ 50
ExamOnline.Common.ShowMess("出错可能原因:1.你本学期无该课程的考试。2.你已经考过。"); 51
} 52
else if (loginResult == 4) 53
{ 54
ExamOnline.Common.ShowMess("出错可能原因:1.你迟到规定的时间以上。2.考试未开始。"); 55
} 56
} 57
else if(cbExercise.Checked == true) 58
{ 59
bool ifAllow = (new ExamOnline.Login()).checkPWD(ref userID, ref userPWD); 60
if (ifAllow == true) 61
{ 62
Session["checkUser"] = "exercise"; 63
Response.Redirect("exerciselogin.aspx"); 64
} 65
else 66
{ 67
ExamOnline.Common.ShowMess("出错可能原因:1.用户名错误。2.密码错误。"); 68
} 69
} 70
} 71
} 72
} 73






}
}