Exemplo n.º 1
0
 public platforminfo SavePlatforminfo(OAuth2Base oa, long userId)
 {
     platforminfo platformInfo;
     platformInfo = new platforminfo();
     var user = this.sinaClient.API.Entity.Users.Show(oa.PlatformUId);
     if (user != null)
     {
         platformInfo.Nick = user.Name;
         platformInfo.PlatformUserId = user.ID;
         platformInfo.UserId = userId;
         platformInfo.Platform = Helper.Mappings.PlatForm.SinaWeiBo.ToString("G"); //新浪微博
         platformInfo.SessionKey = oa.AccessToken;
         platformInfo.AuthDate = DateTime.Now;
         platformInfo.ExpireDate = oa.ExpireTime;
         platformInfo.Refresh_token = sinaClient.OAuth.RefreshToken;
         return accessor.AddEntity(platformInfo); //保存
     }
     return null;
 }
Exemplo n.º 2
0
        public platforminfo SavePlatforminfo(OAuth2Base oa, long userId)
        {
            platforminfo platformInfo = new platforminfo();
            var userJson = new user(oauthKey, "json").info();
            if (string.IsNullOrWhiteSpace(userJson)
                || (!string.IsNullOrWhiteSpace(Helper.StringParserHelper.GetJosnValue(userJson, "errcode "))
                    && Helper.StringParserHelper.GetJosnValue(userJson, "errcode ") != "0"))
            {
                throw new ArgumentNullException("获取用户信息失败");
            }

            platformInfo.Nick = Helper.StringParserHelper.GetJosnValue(userJson, "nick");
            platformInfo.PlatformUserId = Helper.StringParserHelper.GetJosnValue(userJson, "name");
            platformInfo.UserId = userId;
            platformInfo.Platform = Helper.Mappings.PlatForm.QQWeiBo.ToString("G"); //新浪微博
            platformInfo.SessionKey = oa.AccessToken;
            platformInfo.AuthDate = DateTime.Now;
            platformInfo.OpenId = (oa as QQWeiboOAuth2).OpenID;
            platformInfo.ExpireDate = oa.ExpireTime;
            platformInfo.Refresh_token = oa.RefreshToken;
            return accessor.AddEntity(platformInfo); //保存
        }
Exemplo n.º 3
0
 public void UpdateWeiboInfo(platforminfo info)
 {
     accessor.UpdateEntity(info);
 }
Exemplo n.º 4
0
 public override void SavePlatformInfo(platforminfo entity)
 {
     var accessor=new PlatFormInfoAccessor();
     accessor.AddEntity(entity);
 }
Exemplo n.º 5
0
 /// <summary>
 /// 保存平台信息
 /// </summary>
 /// <param name="entity"></param>
 public abstract void SavePlatformInfo(platforminfo entity);
Exemplo n.º 6
0
 public override void SavePlatformInfo(platforminfo entity)
 {
     this.accessor.AddOrUpdatePlatFormInfo(entity);
 }
Exemplo n.º 7
0
 /// <summary>
 /// 创建新的 platforminfo 对象。
 /// </summary>
 /// <param name="sessionKey">SessionKey 属性的初始值。</param>
 /// <param name="refresh_token">Refresh_token 属性的初始值。</param>
 /// <param name="nick">Nick 属性的初始值。</param>
 /// <param name="platformUserId">PlatformUserId 属性的初始值。</param>
 /// <param name="platform">Platform 属性的初始值。</param>
 /// <param name="expireDate">ExpireDate 属性的初始值。</param>
 /// <param name="authDate">AuthDate 属性的初始值。</param>
 /// <param name="id">ID 属性的初始值。</param>
 /// <param name="userId">UserId 属性的初始值。</param>
 public static platforminfo Createplatforminfo(global::System.String sessionKey, global::System.String refresh_token, global::System.String nick, global::System.String platformUserId, global::System.String platform, global::System.DateTime expireDate, global::System.DateTime authDate, global::System.Int64 id, global::System.Int64 userId)
 {
     platforminfo platforminfo = new platforminfo();
     platforminfo.SessionKey = sessionKey;
     platforminfo.Refresh_token = refresh_token;
     platforminfo.Nick = nick;
     platforminfo.PlatformUserId = platformUserId;
     platforminfo.Platform = platform;
     platforminfo.ExpireDate = expireDate;
     platforminfo.AuthDate = authDate;
     platforminfo.ID = id;
     platforminfo.UserId = userId;
     return platforminfo;
 }
Exemplo n.º 8
0
 /// <summary>
 /// 用于向 platforminfo EntitySet 添加新对象的方法,已弃用。请考虑改用关联的 ObjectSet&lt;T&gt; 属性的 .Add 方法。
 /// </summary>
 public void AddToplatforminfo(platforminfo platforminfo)
 {
     base.AddObject("platforminfo", platforminfo);
 }