?? teacher.aspx.cs
字號:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
namespace TestOnline
{
/// <summary>
/// teacher 的摘要說明。
/// </summary>
public class teacher : System.Web.UI.Page
{
protected System.Web.UI.WebControls.TextBox tbx_oldPwd;
protected System.Web.UI.WebControls.TextBox tbx_newPwd1;
protected System.Web.UI.WebControls.TextBox tbx_newPwd2;
protected System.Web.UI.WebControls.ImageButton Ibtn_ok;
private void Page_Load(object sender, System.EventArgs e)
{
// 在此處放置用戶代碼以初始化頁面
if(Session["teacherId"]==null)
Response.Redirect("login.aspx");
}
#region Web 窗體設計器生成的代碼
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 該調用是 ASP.NET Web 窗體設計器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 設計器支持所需的方法 - 不要使用代碼編輯器修改
/// 此方法的內容。
/// </summary>
private void InitializeComponent()
{
this.Ibtn_ok.Click += new System.Web.UI.ImageClickEventHandler(this.Ibtn_ok_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void Ibtn_ok_Click(object sender, System.Web.UI.ImageClickEventArgs e)
{
string teacherId=Convert.ToString(Session["teacherId"]);
string teacherPwd=tbx_oldPwd.Text.Trim();
string newPwd1=tbx_newPwd1.Text.Trim();
string newPwd2=tbx_newPwd2.Text.Trim();
if(newPwd1==""||newPwd2=="")
Response.Write("<script>alert(\"密碼不能為空\");</script>");
else
{
int count=(new projClass()).getTeacher(teacherId,teacherPwd);
if(count==0)
{
Response.Write("<script>alert(\"密碼錯誤!請重新輸入\");</script>");
}
else
{
if(!newPwd1.Equals(newPwd2))
Response.Write("<script>alert(\"兩次密碼不一致!請重新輸入!\");</script>");
else
{
int count1=(new projClass()).updateTeacherPwd(teacherId,newPwd1);
if(count1==1)
Response.Write("<script>alert(\"密碼修改成功!\");</script>");
else Response.Write("<script>alert(\"更新失敗!\");</script>");
}
}
}
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -