protected void ButtonEmail_Click(object sender, EventArgs e) { if ("" != TextBoxEmail.Text) { //修改Email UserData _user = new UserData(); int userid = Convert.ToInt32(Session["UserId"]); User tempuser = _user.GetUserById(userid); tempuser.Email = TextBoxEmail.Text; _user.UpdateUser(tempuser); } TextBoxEmail.Visible = true; ButtonEmail.Visible = true; LinkButtonEmail.Visible = false; Response.Write("<script language=javascript>window.location.href=window.location.href;</script>"); }
protected void ButtonGender_Click(object sender, EventArgs e) { //修改性别 UserData _user = new UserData(); int userid = Convert.ToInt32(Session["UserId"]); User tempuser = _user.GetUserById(userid); char Gender = RadioButtonMale.Checked ? '男' : '女'; tempuser.Gender = Gender; _user.UpdateUser(tempuser); RadioButtonMale.Visible = true; RadioButtonFemale.Visible = true; ButtonGender.Visible = true; LinkButtonGender.Visible = false; Response.Write("<script language=javascript>window.location.href=window.location.href;</script>"); }
protected void ButtonName_Click(object sender, EventArgs e) { //修改姓名 if (TextBoxName.Text != "") { UserData _user = new UserData(); int userid = Convert.ToInt32(Session["UserId"]); User tempuser = _user.GetUserById(userid); tempuser.Name = TextBoxName.Text; _user.UpdateUser(tempuser); } TextBoxName.Visible = false; ButtonName.Visible = false; LinkButtonName.Visible = true; //刷新本页 Response.Write("<script language=javascript>window.location.href=window.location.href;</script>"); }
protected void Page_Load(object sender, EventArgs e) { string imagename = Convert.ToString(Session["UserId"]); if ("" != imagename) { //显示用户头像 Image1.ImageUrl = @"img\userimage\" + imagename + @".jpg"; //显示用户信息 UserData _userdata = new UserData(); User user = _userdata.GetUserById(Convert.ToInt32(imagename)); Label1.Text = user.UserName; Label2.Text = user.Name; Label3.Text = Convert.ToString(user.Gender); Label4.Text = user.PhoneNum; Label5.Text = user.Email; Label6.Text = user.CreateTime.ToShortDateString(); } }