Пример #1
0
        public void GetLinkedIndata(object UserId)
        {
            Guid userId = (Guid)UserId;

            LinkedInHelper objliHelper = new LinkedInHelper();
            LinkedInAccountRepository objLiRepo = new LinkedInAccountRepository();
            oAuthLinkedIn _oauth = new oAuthLinkedIn();
            ArrayList arrLiAccount = objLiRepo.getAllLinkedinAccountsOfUser(userId);
            foreach (LinkedInAccount itemLi in arrLiAccount)
            {
                _oauth.Token = itemLi.OAuthToken;
                _oauth.TokenSecret = itemLi.OAuthSecret;
                _oauth.Verifier = itemLi.OAuthVerifier;
                objliHelper.GetLinkedInFeeds(_oauth, itemLi.LinkedinUserId, userId);
            }

        }
Пример #2
0
        public void GetAccessToken()
        {
            LinkedInProfile objProfile = new LinkedInProfile();
            LinkedInProfile.UserProfile objUserProfile = new LinkedInProfile.UserProfile();
            LinkedInHelper liHelper = new LinkedInHelper();
            User user = (User)Session["LoggedUser"];
            string oauth_token = Request.QueryString["oauth_token"];
            string oauth_verifier = Request.QueryString["oauth_verifier"];
            try
            {

                if (oauth_token != null && oauth_verifier != null)
                {

                    try
                    {
                        _oauth.Token = oauth_token;
                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex.StackTrace);
                    }
                    try
                    {
                        _oauth.TokenSecret = Session["reuqestTokenSecret"].ToString();
                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex.StackTrace);

                    }
                    try
                    {
                        _oauth.Verifier = oauth_verifier;
                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex.StackTrace);
                    }
                    try
                    {
                        _oauth.AccessTokenGet(oauth_token);
                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex.StackTrace);

                    }

                    // Update Access Token in DB 
                    try
                    {
                        int res = UpdateLDToken(user.Id.ToString(), _oauth.Token);
                    }
                    catch { };
                    //***********************

                    Session.Remove("oauth_token");
                    Session.Remove("oauth_TokenSecret");

                    try
                    {
                        objUserProfile = objProfile.GetUserProfile(_oauth);
                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex.StackTrace);
                    }
                    try
                    {
                        liHelper.GetLinkedInUserProfile(objUserProfile, _oauth, user);
                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex.StackTrace);

                    }
                    try
                    {
                        // liHelper.getLinkedInNetworkUpdate(_oauth,user);
                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex.StackTrace);

                    }
                    Session["LinkedInUser"] = _oauth;
                    Session["datatable"] = null;
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex.StackTrace);

            }
        }