protected void btnSave_Click(object sender, EventArgs e) { User u2 = new User(); u2.userId =Convert.ToInt32( labuserId2.Text); u2.userName = labuserName2.Text; u2.bestBook =tboxbestBook.Text; u2.bestFilm =tboxbestFilm.Text; u2.bestFood =tboxbestFood.Text; u2.bestGames =tboxbestGames.Text; u2.bestPlaces =tboxbestPlaces.Text; u2.bestSong =tboxbestSong.Text; u2.bestStars =tboxbestStars.Text; u2.birthday =tboxbirthday.Text; u2.boodtype =tboxboodtype.Text; u2.colloge =tboxcolloge.Text; u2.email =tboxemail.Text; u2.hobbies =tboxhobbies.Text; u2.home =tboxhome.Text; u2.inCollogeYear =tboxinCollogeYear.Text; u2.MSN =tboxMSN.Text; u2.personalwords =tboxpersonalwords.Text; u2.phone =tboxphone.Text; u2.prinmarySchool =tboxprinmarySchool.Text; u2.pwd =tboxpwd.Text; u2.QQ =tboxQQ.Text; u2.realName =tboxrealName.Text; u2.seccondSchool =tboxseccondSchool.Text; u2.sex =tboxsex.Text; u2.sports =tboxsports.Text; if ( ubll.update(u2)) { Response.Write("<script>alert('更新成功')</script>"); } }
public string getUserlogoURL(object id) { string URL; UserBLL usbll = new UserBLL(); int userid = (Int32)id; User u = new User(); u = usbll.findUserByUserId(userid); if ( u.sex.Trim()=="男") { URL = "upload/logoimg/logoimgdf1.png"; } else { URL = "upload/logoimg/logoimgdf2.png"; } return URL; }
protected void loadfirst(int masterid,int guestid) { u = userbll.findUserByUserId(masterid); btnmasterName.Value = u.userName; User u2 = userbll.findUserByUserName(u.userName); btnmasterId.Value = u2.userId.ToString();//操作时取值 btnguestId.Value = guestid.ToString(); User u3 = userbll.findUserByUserId(guestid); btnguestName.Value = u3.userName; labuserId.Value = u3.userName;//显示当前用户名 labpWords.Text = u2.personalwords; if (labpWords.Text == "") { labpWords.Text = "个性签名"; } labsex.Text = u2.sex; labcolloge.Text = u2.colloge; if (labcolloge.Text == "") { labcolloge.Text = "未知学院"; } labweiboNo.Text = "0"; labfansNo.Text = "0"; labfocusNo.Text = "0"; // 函数计算 if (masterid==guestid) { Isown = true; } else { Isown = false; } wblist = wbbll.findWeiboByauthorId(masterid); labweiboNo.Text = wblist.Count.ToString(); fmlist = fmbll.findfocusFansMarksByonselfId(masterid); labfocusNo.Text = fmlist.Count.ToString(); fmlist = fmbll.findfansFansMarksByotherId(masterid); labfansNo.Text = fmlist.Count.ToString(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Request.QueryString["userid"] != null) { userid =Convert.ToInt32( Request.QueryString["userid"]); u = ubll.findUserByUserId(userid); labuserId2.Text = u.userId.ToString(); labuserName2.Text = u.userName; tboxbestBook.Text = u.bestBook; tboxbestFilm.Text = u.bestFilm; tboxbestFood.Text = u.bestFood; tboxbestGames.Text = u.bestGames; tboxbestPlaces.Text = u.bestPlaces; tboxbestSong.Text = u.bestSong; tboxbestStars.Text = u.bestStars; tboxbirthday.Text = u.birthday; tboxboodtype.Text = u.boodtype; tboxcolloge.Text = u.colloge; tboxemail.Text = u.email; tboxhobbies.Text = u.hobbies; tboxhome.Text = u.home; tboxinCollogeYear.Text = u.inCollogeYear; tboxMSN.Text = u.MSN; tboxpersonalwords.Text = u.personalwords; tboxphone.Text = u.phone; tboxprinmarySchool.Text = u.prinmarySchool; tboxpwd.Text = u.pwd; tboxQQ.Text = u.QQ; tboxrealName.Text = u.realName; tboxseccondSchool.Text = u.seccondSchool; tboxsex.Text = u.sex; tboxsports.Text = u.sports; } } }
protected void btnRegister_Click(object sender, EventArgs e) { //验证登陆 string txtuserName = userName.Text; string txtPwd = pwd.Value; string txtemail = email.Value; string txtpwords = pwords.Value; string txtsex = ""; bool flag = true; if (txtuserName == null || txtuserName.Trim().Equals("") || txtPwd.Trim().Length < 6 || txtPwd.Trim().Length >40) { flag = false; labInfo.Text = "友情提示:用户名输入不正确"; return; } if (txtPwd == null || txtPwd.Trim().Length < 6 || txtPwd.Trim().Length >12) { flag = false; labInfo.Text = "友情提示:密码输入不正确"; return; } if (!(txtPwd==pwd2.Value)) { flag = false; labInfo.Text = "友情提示:二次密码输入不正确"; return; } if (txtemail == null || txtuserName.Trim().Equals("")) { flag = false; labInfo.Text = "友情提示:email输入不正确"; return; } if (radsexNv.Checked == true) { txtsex = "女"; } if (radsexNan.Checked == true) { txtsex = "男"; } if (txtsex=="") { flag = false; labInfo.Text = "友情提示:请选择性别"; } if (!radRead.Checked==true) { flag = false; labInfo.Text = "友情提示:请阅读淮师校园微博规范"; } if ( flag) { //插入一个user,返回登录页面 userbll = new UserBLL(); User u = new User(); u.userName = txtuserName; u.pwd = txtPwd; u.email = txtemail; u.sex = txtsex; u.personalwords = txtpwords; if (userbll.save(u)) { Response.Redirect("RegisterSuccess.html"); } } }
protected void Page_Load(object sender, EventArgs e) { //加载动画 if (!IsPostBack) { masterid = Convert.ToInt32(Request["masterid"]); guestid = Convert.ToInt32(Request["guestid"]); //Response.Write(guestid); if (masterid != 0&&guestid!=0) { //别人访问 loadfirst(masterid,guestid); } else { //登录页面加载 object obj = Session["user"]; if (obj == null) { Response.Redirect("~/Login.aspx"); } else { u = (User)obj; masterid = u.userId; loadfirst(masterid, masterid); //guestid = u.userId;//后台向前端输出值 此时master=guest } } if (Isown) { btnEdit.Visible = true; btnAddFocus.Visible = false; publish.Visible = true; } else { btnEdit.Visible = false; btnAddFocus.Visible = true; publish.Visible = false; } } }