📄 uppassword.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;
using Teach_Manager.Dao;
namespace Teach_Manager.Common
{
/// <summary>
/// 功能:更改密码(学生和教师的)
/// 作者:
/// 日期:2006-05-08
/// </summary>
public class uppassword : PageBase
{
protected System.Web.UI.WebControls.TextBox renewpass;
protected System.Web.UI.WebControls.Button cmdOK;
protected System.Web.UI.WebControls.CompareValidator CompareValidator1;
protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator4;
protected System.Web.UI.WebControls.TextBox newpass;
protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator3;
protected System.Web.UI.WebControls.Label message;
private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
if (!Page.IsPostBack)
{
//(purview()&&(Request.Cookies["class_type"].Value.ToString()=="0"))
if (purview())
{
}
else
{
Response.Write("<script>window.top.location.href('../WebForm1.aspx'); </script>");
}
}
}
#region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.cmdOK.Click += new System.EventHandler(this.cmdOK_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void cmdOK_Click(object sender, System.EventArgs e)
{
//确认修改密码
//根据 原密码修改为新密码有确认新密码
//首先验证 原始密码是否正确 ,如果正确则更新原始密码,其中新密码,新密码确认
string i_type=Request.Cookies["class_type"].Value.ToString();
string str_guid=Request.Cookies["username_guid"].Value.ToString();
string str_sql="";
CommonInterface CIF=new CommonSql(str_conn_protected);
if (i_type=="0")
{
//教师
str_sql="update teacher_table set Password='"+newpass.Text+"' where guid='"+str_guid+"'" ;
CIF.Execute(str_sql);
}
if (i_type=="1")
{
//学生
str_sql="update student_table set Password='"+newpass.Text+"' where guid='"+str_guid+"'" ;
CIF.Execute(str_sql);
}
CIF.Close();
Alert("密码修改成功!");
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -