Пример #1
0
 public ActionResult AjaxUserProfile(UserProfileModel model)
 {
     try
     {
         HttpContext.Profile["nickname"] = Utils.RemoveHtml(WebUtils.MyString(model.NickName));
         HttpContext.Profile["signature"] = WebUtils.ubb2html(WebUtils.MyString(model.Signature));
         HttpContext.Profile["intro"] = WebUtils.ubb2html(WebUtils.MyString(model.Intro));
         HttpContext.Profile["gender"] = model.Gender;
         HttpContext.Profile["birth"] = Utils.RemoveHtml(WebUtils.MyString(model.Birth));
         HttpContext.Profile["location"] = Utils.RemoveHtml(WebUtils.MyString(model.Location));
         HttpContext.Profile["website"] = Utils.RemoveHtml(WebUtils.MyString(model.Website));
         HttpContext.Profile["qq"] = Utils.RemoveHtml(WebUtils.MyString(model.QQ));
         HttpContext.Profile["sina"] = Utils.RemoveHtml(WebUtils.MyString(model.Sina));
         HttpContext.Profile["facebook"] = Utils.RemoveHtml(WebUtils.MyString(model.Facebook));
         HttpContext.Profile["twitter"] = Utils.RemoveHtml(WebUtils.MyString(model.Twitter));
         HttpContext.Profile["medals"] = WebUtils.MyString(model.Medals);
         HttpContext.Profile["phone"] = Utils.RemoveHtml(WebUtils.MyString(model.Phone));
         HttpContext.Profile["email"] = Utils.RemoveHtml(WebUtils.MyString(model.Email));
         HttpContext.Profile["isSendEmail"] = model.IsSendEmail;
         return Content("0", "text/html;charset=UTF-8");
     }
     catch
     {
         return Content("1", "text/html;charset=UTF-8");
     }
 }
Пример #2
0
        /// <summary>
        /// 获取用户Profile
        /// </summary>
        public UserProfileModel GetUserProfile(string user)
        {
            UserProfileModel userprofile = new UserProfileModel();
            try
            {
                ProfileBase objProfile = System.Web.Profile.ProfileBase.Create(user);

                userprofile.NickName = GetUserProfileItem(objProfile, "nickname");
                userprofile.Signature = GetUserProfileItem(objProfile, "signature");
                userprofile.Intro = GetUserProfileItem(objProfile, "intro");
                userprofile.Gender = GetUserProfileItem(objProfile, "gender", "1");
                userprofile.Birth = GetUserProfileItem(objProfile, "birth");
                userprofile.Location = GetUserProfileItem(objProfile, "location");
                userprofile.Website = GetUserProfileItem(objProfile, "website");
                userprofile.QQ = GetUserProfileItem(objProfile, "qq");
                userprofile.Sina = GetUserProfileItem(objProfile, "sina");
                userprofile.Facebook = GetUserProfileItem(objProfile, "facebook");
                userprofile.Twitter = GetUserProfileItem(objProfile, "twitter");
                userprofile.Medals = GetUserProfileItem(objProfile, "medals");
                userprofile.Phone = GetUserProfileItem(objProfile, "phone");

                string email = GetUserProfileItem(objProfile, "email");
                if (string.IsNullOrEmpty(email))
                {
                    MembershipUser currentUser = Membership.GetUser(user.Trim(), false /* userIsOnline */);
                    userprofile.Email = currentUser.Email;
                }
                else
                {
                    userprofile.Email = email;
                }
                userprofile.IsSendEmail = GetUserProfileItem(objProfile, "isSendEmail", "1");
            }
            catch
            { }
            return userprofile;
        }
Пример #3
0
        /// <summary>
        /// 获取当前用户Profile
        /// </summary>
        private UserProfileModel GetMyProfile()
        {
            UserProfileModel userprofile = new UserProfileModel();
            try
            {
                userprofile.NickName = GetProfileItem("nickname");
                userprofile.Signature = GetProfileItem("signature");
                userprofile.Intro = GetProfileItem("intro");
                userprofile.Gender = GetProfileItem("gender", "1");
                userprofile.Birth = GetProfileItem("birth");
                userprofile.Location = GetProfileItem("location");
                userprofile.Website = GetProfileItem("website");
                userprofile.QQ = GetProfileItem("qq");
                userprofile.Sina = GetProfileItem("sina");
                userprofile.Facebook = GetProfileItem("facebook");
                userprofile.Twitter = GetProfileItem("twitter");
                userprofile.Medals = GetProfileItem("medals");
                userprofile.Phone = GetProfileItem("phone");

                string email = GetProfileItem("email");
                if (string.IsNullOrEmpty(email))
                {
                    MembershipUser currentUser = Membership.GetUser(User.Identity.Name, false /* userIsOnline */);
                    userprofile.Email = currentUser.Email;
                }
                else
                {
                    userprofile.Email = email;
                }
                userprofile.IsSendEmail = GetProfileItem("isSendEmail","1");
            }
            catch
            { }
            return userprofile;
        }