Example #1
0
        private string uploadFolder = string.Empty; //头像上传路径

        #endregion Fields

        #region Methods

        protected void btnUpdateGravatar_Click(object sender, EventArgs e)
        {
            BLL.UserExp.UsersExp UsersExpBLL = new BLL.UserExp.UsersExp();
            int imageWidth = Int32.Parse(txt_width.Text);
            int imageHeight = Int32.Parse(txt_height.Text);
            int cutTop = Int32.Parse(txt_top.Text);
            int cutLeft = Int32.Parse(txt_left.Text);
            int dropWidth = Int32.Parse(txt_DropWidth.Text);
            int dropHeight = Int32.Parse(txt_DropHeight.Text);
            string filename = Maticsoft.Common.CutPhotoHelp.SaveCutPic(Server.MapPath(ImageIcon.ImageUrl), Server.MapPath("/" + uploadFolder), 0, 0, dropWidth, dropHeight, cutLeft, cutTop, imageWidth, imageHeight);
            if (CurrentUser.UserID > 0)
            {
                Model.UserExp.UsersExp UsersExpModel = new Model.UserExp.UsersExp();

                UsersExpModel.UserAvatar = "/" + uploadFolder + "/" + filename;
                UsersExpModel.UserID = CurrentUser.UserID;
                if (UsersExpBLL.UpdateGravatar(UsersExpModel))
                {
                    //Maticsoft.Common.MessageBox.ShowAndRedirect(this, "修改头像成功!", "UserBaseInfo.aspx");
                    Response.Redirect("UserBaseInfo.aspx");
                }
                else
                {
                    Maticsoft.Common.MessageBox.ShowFailTip(this, "修改头像失败!");
                    return;
                }
            }
        }
Example #2
0
 protected void btnSubmit_Click(object sender, EventArgs e)
 {
     Model.UserExp.UsersExp UserExp = new Model.UserExp.UsersExp();
     string TrueName = this.txtTrueName.Value;
     string Phone = this.txtTel.Value;
     string sex = String.Empty;
     UserExp.UserHobby = this.txthobby.Value;
     UserExp.UserCareer = this.txtProfession.Value;
     UserExp.UserID = CurrentUser.UserID;
     if (this.rbMan.Checked)
     {
         sex = "M";
     }
     else if (this.rbWomen.Checked)
     {
         sex = "F";
     }
     else
     {
         sex = "S";
     }
     if (!string.IsNullOrEmpty(this.RegionAjax1.SelectedValue))
     {
         UserExp.UserRegionID = int.Parse(this.RegionAjax1.SelectedValue);
     }
     string strBir = this.txtBir.Value;
     if (!string.IsNullOrEmpty(strBir))
     {
         if (PageValidate.IsDateTime(strBir))
         {
             UserExp.Birthday = DateTime.Parse(strBir);
         }
     }
     if (UserBll.UpDateUserInfo(TrueName, sex, Phone, UserExp) > 0)
     {
         Maticsoft.Common.MessageBox.ShowSuccessTip(this, "修改成功!");//, "/MyAccount/UserBaseInfo.aspx");
     }
     else
     {
         Maticsoft.Common.MessageBox.ShowFailTip(this, "修改失败!");
     }
 }