//修改头像 protected void btnchuan_Click(object sender, EventArgs e) { Accounts = Request.Cookies["userName"].Value; if (FileUpload1.HasFile) { string filename = FileUpload1.FileName; String fileFix = filename.Substring(filename.LastIndexOf('.') + 1).ToLower(); if (fileFix != "png" && fileFix != "jpg" && fileFix != "jpeg" && fileFix != "gif") { ClientScript.RegisterStartupScript(this.GetType(), "zixunSucess", "<script>alert('修改失败,请上传png、jpg、jpeg、gif图片类型!');</script> "); } else { Accounts = Request.Cookies["userName"].Value; PersonalUpdateBLL usup = new PersonalUpdateBLL(); FileUpload1.SaveAs(Server.MapPath(".") + "//images//" + filename); this.Image1.ImageUrl = "~/images/" + filename; if (usup.UpdateUserHead(filename, Accounts)) { ClientScript.RegisterStartupScript(this.GetType(), "zixunSucess", "<script>alert('头像修改成功!');</script> "); } else { ClientScript.RegisterStartupScript(this.GetType(), "zixunSucess", "<script>alert('头像修改失败!');</script> "); } } } }
//修改密码 protected void Unnamed4_Click(object sender, EventArgs e) { Accounts = Request.Cookies["userName"].Value; PersonalSelectBLL usb = new PersonalSelectBLL(); if (this.rdPhone.Text == usb.PersonalSelectedBLL(Accounts)[0].Phone) { PersonalUpdateBLL usup = new PersonalUpdateBLL(); if (usup.UpdateUserspwd(this.rdPWD.Text, Accounts)) { ClientScript.RegisterStartupScript(this.GetType(), "zixunSucess", "<script>alert('修改成功!');</script> "); } else { ClientScript.RegisterStartupScript(this.GetType(), "zixunSucess", "<script>alert('修改失败!');</script> "); } } else { ClientScript.RegisterStartupScript(this.GetType(), "zixunSucess", "<script>alert('手机号码不正确!');</script> "); } loads(Accounts); }
//修改个人信息 protected void Unnamed1_Click(object sender, EventArgs e) { Accounts = Request.Cookies["userName"].Value; LoginModel us = new LoginModel(); us.UserName = this.UserName.Text; us.Gender = this.RadioButton1.Checked == true ? "男" : "女"; us.Province = this.DropDownList1.Text; us.City = this.DropDownList2.Text; us.URL = this.URL.Text; us.Personal_note = this.Personal_note.Text; us.Accounts = Request.Cookies["userName"].Value; PersonalUpdateBLL uspudt = new PersonalUpdateBLL(); if (uspudt.UpdateUsers(us)) { ClientScript.RegisterStartupScript(this.GetType(), "zixunSucess", "<script>alert('修改成功!')</script> "); } else { ClientScript.RegisterStartupScript(this.GetType(), "zixunSucess", "<script>alert('修改失败!')</script> "); } loads(Accounts); }