温馨提示:代码在线浏览功能只能做为源码浏览参考,不能展示项目的全部,如果想更进一步了解该代码请下载:三层班级留言本源码
当前文件路径:ClassSay/Class/ModifyPass.aspx.cs

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
using System.IO; 12
using UserInfoLib; 13
14
public partial class ModifyPass : System.Web.UI.Page 15
{ 16
17
protected void Page_Load(object sender, EventArgs e) 18
{ 19
if (!Page.IsPostBack) 20
{ 21
if ((Session["User"] != null) && (Session["Root"] != null) && (Session["Root"].ToString()) != "0") 22
{ 23
this.LabelName.Text = Session["User"].ToString(); 24
UserInfo user = new UserInfo(); 25
user.UserName = Session["User"].ToString(); 26
DataSet table = user.SeleUpdate(); 27
this.TextBoxPassword.Text = table.Tables[0].Rows[0]["UserPassword"].ToString(); 28
this.TextBox1.Text = table.Tables[0].Rows[0]["UserImage"].ToString(); 29
this.ViewState["table"] = table; 30
this.ButtonClose.Attributes.Add("onclick", "window.close();"); 31
} 32
else 33
{ 34
this.Response.Write("<script>alert('您还没有登陆!');</script>"); 35
this.Response.Redirect("index.aspx"); 36
//this.Page.RegisterStartupScript("closewindow", "<script>window.close()</script>"); 37
} 38
} 39
} 40
protected void ButtonExit_Click(object sender, EventArgs e) 41
{ 42
this.TextBoxPassword.Text = ""; 43
} 44
protected void ButtonModify_Click(object sender, EventArgs e) 45
{ 46
UserInfo user = new UserInfo(); 47
user.UserName = this.LabelName.Text; 48
user.UserPassword = this.TextBoxPassword.Text; 49
user.UserImage = this.TextBox1.Text; 50
if (FileUpload1.FileName == null || FileUpload1.FileName == "") 51
{ 52
DataSet table = (DataSet)ViewState["table"]; 53
user.UserLable = table.Tables[0].Rows[0]["UserLable"].ToString(); 54
} 55
else 56
{ 57
58
this.FileUpload1.PostedFile.SaveAs(this.Server.MapPath("UPimage") + "\\" + Path.GetFileName(FileUpload1.PostedFile.FileName)); 59
user.UserLable = "~\\UPimage\\" + this.FileUpload1.FileName; 60
} 61
user.Update(); 62
this.TextBoxPassword.Text = ""; 63
this.Response.Write("<script>alert('修改成功');</script>"); 64
this.Response.Write("<script>window.setTimeout('window.close()',0)</script>"); 65
} 66
} 67





}
}