📄 teacherreg.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 SystemManage_TeacherReg : 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 BtnAddTeacher_Click(object sender, EventArgs e)
{
SqlData sql = new SqlData();
String[] StrAll ={ "注册成功", "注册失败!" ,"注册的内容不能为空!","此工号已经存在","读数据库发生错误","密码与验证不一致"};
String StrTno = TxtTno.Text.ToString();
String StrTname = TxtTname.Text.ToString();
String StrTPassword = TxtTPassword.Text.ToString();
String StrComfirm = TxtConfirm.Text.ToString();
String[] InsertStr ={ StrTno, StrTname, StrTPassword };
if (StrTno != "" && StrTname != "" && StrTPassword != "" && StrComfirm != "")
{
String TableName = "TAB_TEACHER";
String ColumnName = "TNO";
if (sql.CheckStringUnique(TableName, ColumnName, StrTno) == 2)
{
if (StrTPassword == StrComfirm)
{
if (sql.InsertRow(TableName, InsertStr, InsertStr.Length) == true)
{
Dialog(StrAll[0]);
Response.Write(@"<script type='text/JavaScript'>");
Response.Write(@"window.location='./Login.aspx';");
Response.Write(@"</script>");
}
else
{
Dialog(StrAll[1]);
}
}
else
{
Dialog(StrAll[5]);
}
}
else if (sql.CheckStringUnique(TableName, ColumnName, StrTno) == 1)
{
Dialog(StrAll[3]);
}
else
{
Dialog(StrAll[4]);
}
}
else
{
Dialog(StrAll[2]);
}
}
protected void BtnGoback_Click(object sender, EventArgs e)
{
if (Session["USERSTYLE"] == "TEACHER")
{
Response.Write(@"<script type='text/JavaScript'>");
Response.Write(@"window.location='./TeacherMain.aspx';");
Response.Write(@"</script>");
}
else
{
Response.Write(@"<script type='text/JavaScript'>");
Response.Write(@"window.location='./Login.aspx';");
Response.Write(@"</script>");
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -