Пример #1
0
 protected void btnEdit_Click(object sender, EventArgs e)
 {
     if (Session["Pop"].ToString() == "用户")
     {
         user.UserName = txtName.Text;
         user.UserPwd  = txtPwd.Text;
         user.TName    = txtTName.Text;
         if (ddlSex.SelectedIndex == 0)
         {
             user.Sex = true;
         }
         if (ddlSex.SelectedIndex == 1)
         {
             user.Sex = false;
         }
         user.Birthday  = DateTime.Parse(txtBirthday.Text);
         user.Tel       = txtTel.Text;
         user.Mobile    = txtMobile.Text;
         user.QQ        = Int32.Parse(txtQQ.Text);
         images.PhotoID = ddlPhoto.SelectedValue;
         user.Photo     = ImageManager.findImageByPhotoID(images).Photo;
         user.Email     = txtEmail.Text;
         user.FAddress  = txtHAddress.Text;
         user.RAddress  = txtRAddress.Text;
         user.Index     = txtIndex.Text;
         if (UserManager.UpdateUser(user) != 0)
         {
             Response.Write("<script language=javascript>alert('用户信息修改成功!')</script>");
         }
         return;
     }
     if (Session["Pop"].ToString() == "版主")
     {
         host.HostName = txtName.Text;
         host.HostPwd  = txtPwd.Text;
         host.TName    = txtTName.Text;
         if (ddlSex.SelectedIndex == 0)
         {
             host.Sex = true;
         }
         if (ddlSex.SelectedIndex == 1)
         {
             host.Sex = false;
         }
         host.Birthday  = DateTime.Parse(txtBirthday.Text);
         host.Tel       = txtTel.Text;
         host.Mobile    = txtMobile.Text;
         host.QQ        = Int32.Parse(txtQQ.Text);
         images.PhotoID = ddlPhoto.SelectedValue;
         host.Photo     = ImageManager.findImageByPhotoID(images).Photo;
         host.Email     = txtEmail.Text;
         host.FAddress  = txtHAddress.Text;
         host.RAddress  = txtRAddress.Text;
         host.Index     = txtIndex.Text;
         if (HostManager.UpdateHost(host) != 0)
         {
             Response.Write("<script language=javascript>alert('版主信息修改成功!')</script>");
         }
         return;
     }
 }