📄 login.aspx.cs.svn-base
字号:
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 SubjectManage_Login : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
private void Dialog(String Str)
{
Response.Write(@"<script type='text/JavaScript'>");
Response.Write(@"alert('"+Str+"');");
//Response.Write(@"window.location='./list_logingroup.aspx';");
Response.Write(@"</script>");
}
protected void BtnLogin_Click(object sender, EventArgs e)
{
SqlData sql = new SqlData();
String[] StrAll ={ "成功登陆", "用户名不存在或者密码或者选择类型不正确错误!" ,"连接不到数据库!"};
String StrUserID = TxtUerID.Text.ToString();
String StrPassword = TxtPassword.Text.ToString();
if (RdolsUserStyle.Items[1].Selected == true)
{
String TableName = "TAB_STUDENT";
String ColumnName1 = "SNO";
String ColumnName2 = "SPASSWORD";
if (sql.CheckStringUnique(TableName, ColumnName1, ColumnName2, StrUserID, StrPassword) == 1)
{
//Dialog(StrAll[0]);
Session["USERID"] = StrUserID;
Session["USERSTYLE"] = "STUDENT";
String ReturnColumn="SName";
String StrUserName = sql.FindString(TableName, ColumnName1, ReturnColumn, StrUserID);
Session["USERNAME"] = StrUserName;
Response.Write(@"<script type='text/JavaScript'>");
Response.Write(@"window.location='./Main.aspx';");
Response.Write(@"</script>");
}
else if (sql.CheckStringUnique(TableName, ColumnName1, ColumnName2, StrUserID, StrPassword) == 0)
{
Dialog(StrAll[2]);
}
else
{
Dialog(StrAll[1]);
}
}
else
{
String TableName = "TAB_TEACHER";
String ColumnName1 = "TNO";
String ColumnName2 = "TPASSWORD";
if (sql.CheckStringUnique(TableName, ColumnName1, ColumnName2, StrUserID, StrPassword) == 1)
{
//Dialog(StrAll[0]);
Session["USERID"] = StrUserID;
Session["USERSTYLE"] = "TEACHER";
String ReturnColumn = "TName";
String StrUserName = sql.FindString(TableName, ColumnName1, ReturnColumn, StrUserID);
Session["USERTEACHERNAME"] = StrUserName;
Response.Write(@"<script type='text/JavaScript'>");
Response.Write(@"window.location='./TeacherMain.aspx';");
Response.Write(@"</script>");
}
else if (sql.CheckStringUnique(TableName, ColumnName1, ColumnName2, StrUserID, StrPassword) == 0)
{
Dialog(StrAll[2]);
}
else
{
Dialog(StrAll[1]);
}
}
sql.SqlDataClose();
}
protected void LnkbtnStudentReg_Click(object sender, EventArgs e)
{
Response.Write(@"<script type='text/JavaScript'>");
Response.Write(@"window.location='./Register.aspx';");
Response.Write(@"</script>");
}
protected void LnkbtnTeacherReg_Click(object sender, EventArgs e)
{
Response.Write(@"<script type='text/JavaScript'>");
Response.Write(@"window.location='./TeacherReg.aspx';");
Response.Write(@"</script>");
}
protected void BtnCancelExit_Click(object sender, EventArgs e)
{
Response.Write("<script language:javascript>javascript:window.close();</script>");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -