Exemplo n.º 1
0
        public static int AsyncUserProfile(int uId)
        {
            DiscuzSession ds = DiscuzSessionHelper.GetMainSiteSession();

            User userInfo = ds.GetUserInfo(uId);

            UserForEditing userForEditing = new UserForEditing();
            userForEditing.Bio = userInfo.Bio;
            userForEditing.Birthday = userInfo.Birthday;
            userForEditing.Email = userInfo.Email;
            userForEditing.Gender = userInfo.Gender.ToString();
            userForEditing.Icq = userInfo.Icq;
            userForEditing.IdCard = userInfo.IdCard;
            userForEditing.Location = userInfo.Location;
            userForEditing.Mobile = userInfo.Mobile;
            userForEditing.Msn = userInfo.Msn;
            userForEditing.NickName = userInfo.NickName;
            userForEditing.Phone = userInfo.Phone;
            userForEditing.Qq = userInfo.Qq;
            userForEditing.RealName = userInfo.RealName;
            userForEditing.Skype = userInfo.Skype;
            userForEditing.WebSite = userInfo.WebSite;
            userForEditing.Yahoo = userInfo.Yahoo;

            List<AsyncSiteInfo> asyncSiteList = AsyncSites.GetAsyncSiteList();

            int successCount = 0;

            foreach (AsyncSiteInfo info in asyncSiteList)
            {
                if (!new ProcessUpdateUser(userInfo, info, userForEditing).Enqueue())
                    successCount++;
            }
            return successCount;
        }
Exemplo n.º 2
0
 public void EditPassword(string username, string newMD5Password)
 {
     DiscuzSession ds = new DiscuzSession(api, secret, url);
     int uid = ds.GetUserID(username);
     if (uid > 0)
     {
         UserForEditing ufe = new UserForEditing();
         ufe.Password = newMD5Password;
         ds.SetUserInfo(uid, ufe);
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// 设置用户信息
        /// </summary>
        /// <param name="uid"></param>
        /// <param name="user_for_editing"></param>
        /// <returns></returns>
        public bool SetUserInfo(int uid, UserForEditing user_for_editing)
        {
            List <DiscuzParam> param_list = new List <DiscuzParam>();

            if (session_info != null && !string.IsNullOrEmpty(session_info.SessionKey))
            {
                param_list.Add(DiscuzParam.Create("session_key", session_info.SessionKey));
            }
            param_list.Add(DiscuzParam.Create("call_id", DateTime.Now.Ticks));

            param_list.Add(DiscuzParam.Create("uid", uid));
            param_list.Add(DiscuzParam.Create("user_info", Newtonsoft.Json.JsonConvert.SerializeObject(user_for_editing)));

            SetInfoResponse sir = util.GetResponse <SetInfoResponse>("users.setInfo", param_list.ToArray());

            return(sir.Successfull == 1);
        }
Exemplo n.º 4
0
        public static int AsyncUserPassword(string userName, string password)
        {
            DiscuzSession ds = DiscuzSessionHelper.GetMainSiteSession();

            User userInfo = new User();
            userInfo.UserName = userName;

            UserForEditing userForEditing = new UserForEditing();
            userForEditing.Password = password;

            List<AsyncSiteInfo> asyncSiteList = AsyncSites.GetAsyncSiteList();

            int successCount = 0;

            foreach (AsyncSiteInfo info in asyncSiteList)
            {
                if (!new ProcessUpdateUser(userInfo, info, userForEditing).Enqueue())
                    successCount++;
            }
            return successCount;
        }
Exemplo n.º 5
0
        /// <summary>
        /// 设置用户信息
        /// </summary>
        /// <param name="uid"></param>
        /// <param name="user_for_editing"></param>
        /// <returns></returns>
        public bool SetUserInfo(int uid, UserForEditing user_for_editing)
        {
            List<DiscuzParam> param_list = new List<DiscuzParam>();
            if (session_info != null && !string.IsNullOrEmpty(session_info.SessionKey))
            {
                param_list.Add(DiscuzParam.Create("session_key", session_info.SessionKey));
            }

            param_list.Add(DiscuzParam.Create("uid", uid));
            param_list.Add(DiscuzParam.Create("user_info", Newtonsoft.Json.JavaScriptConvert.SerializeObject(user_for_editing)));

            SetInfoResponse sir = util.GetResponse<SetInfoResponse>("users.setInfo", param_list.ToArray());

            return sir.Successfull == 1;
        }
Exemplo n.º 6
0
 public ProcessUpdateUser(User userInfo, AsyncSiteInfo asyncSiteInfo, UserForEditing userForEditing)
 {
     this._userInfo = userInfo;
     this._siteInfo = asyncSiteInfo;
     this._userForEditing = userForEditing;
 }