Inheritance: oAuthBase2
        public IActionResult AddLinkedInPages(long groupId, long userId)
        {
            string             data = Request.Form["profileaccesstoken"];
            DatabaseRepository dbr  = new DatabaseRepository(_logger, _env);

            string[] profiledata = null;
            int      i           = 0;

            profiledata = data.Split(',');
            foreach (var item in profiledata)
            {
                string[]      lindata = Regex.Split(item, "<:>");
                oAuthLinkedIn _oauth  = new oAuthLinkedIn();
                _oauth.ConsumerKey    = _appSettings.LinkedinApiKey;
                _oauth.ConsumerSecret = _appSettings.LinkedinSecretKey;
                _oauth.Token          = lindata[1];
                try
                {
                    dynamic profile = Helper.LinkedInHelper.GetCompanyPageData(_oauth, lindata[0]);
                    i = Repositories.LinkedInAccountRepository.AddLinkedInCompantPage(_oauth, profile, dbr, userId, groupId, lindata[1], _redisCache, _appSettings, _logger);
                }
                catch (Exception ex)
                {
                    return(Ok("something went wrong while adding pages"));
                }
            }
            if (i == 1)
            {
                return(Ok("LinkedIn Company Page Added Successfully"));
            }
            else
            {
                return(Ok("Error while Adding Account"));
            }
        }
Ejemplo n.º 2
0
        public string SetImageStatusUpdate(oAuthLinkedIn OAuth, string msg, string file)
        {
            string xml      = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><share><comment>" + msg + "</comment><content><title></title><submitted-image-url>" + file + "</submitted-image-url></content><visibility><code>anyone</code></visibility></share>";
            string response = OAuth.APIWebRequest("POST", Global.StatusUpdateImage, xml);

            return(response);
        }
Ejemplo n.º 3
0
        public XmlDocument Get_NetworkUpdates(oAuthLinkedIn OAuth, int Count)
        {
            string response = OAuth.APIWebRequest("GET", Global.GetNetworkUpdates, null);

            xmlResult.Load(new StringReader(response));
            return(xmlResult);
        }
Ejemplo n.º 4
0
        protected void imgBtnLinkedIn_Click(object sender, ImageClickEventArgs e)
        {
            oAuthLinkedIn _oauth   = new oAuthLinkedIn();
            string        authLink = _oauth.AuthorizationLinkGet();

            try
            {
                Session[SessionKeys.ServiceProvider] = "LinkedIn";

                if (_oauth.Token != null && _oauth.TokenSecret != null && _oauth.Token.Length > 0 && _oauth.TokenSecret.Length > 0)
                {
                    Application["reuqestToken"]       = _oauth.Token;
                    Application["reuqestTokenSecret"] = _oauth.TokenSecret;
                    Application["oauthLink"]          = authLink;
                }
                else
                {
                    lblAlertMsg.Text = " LinkedIn keys Not Provided";
                }
            }
            catch (Exception ex)
            {
                ProcessException(ex);
            }
            if (authLink != null)
            {
                Response.Redirect(authLink);
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// The Job Search API enables search across LinkedIn's job postings Keyword Wise.
        /// </summary>
        /// <param name="OAuth"></param>
        /// <param name="keyword"></param>
        /// <param name="Count"></param>
        /// <returns></returns>
        public XmlDocument Get_JobSearchKeyword(oAuthLinkedIn OAuth, string keyword, int Count)
        {
            string response = OAuth.APIWebRequest("GET", Global.GetJobSearchKeyword + keyword + "&count=" + Count, null);

            xmlResult.Load(new StringReader(response));
            return(xmlResult);
        }
Ejemplo n.º 6
0
        public string SetPostOnPageWithImage(oAuthLinkedIn oauth, string PageId, string imageurl, string post)
        {
            string url      = "https://api.linkedin.com/v1/companies/" + PageId + "/shares?format=json";
            string response = oauth.LinkedProfilePostWebRequestWithImage("POST", url, post, imageurl);

            return(response);
        }
Ejemplo n.º 7
0
        public static string ComposeLinkedInMessage(string ImageUrl, long userid, string comment, string ProfileId, string imagepath, Domain.Socioboard.Models.LinkedInAccount _objLinkedInAccount, Model.DatabaseRepository dbr, Domain.Socioboard.Models.User _user)
        {
            string json = "";
            var    img  = "";

            Domain.Socioboard.Models.LinkedInAccount _LinkedInAccount = _objLinkedInAccount;
            oAuthLinkedIn _oauth = new oAuthLinkedIn();

            _oauth.ConsumerKey    = AppSettings.LinkedinConsumerKey;
            _oauth.ConsumerSecret = AppSettings.LinkedinConsumerSecret;
            _oauth.Token          = _LinkedInAccount.OAuthToken;
            string PostUrl = "https://api.linkedin.com/v1/people/~/shares?format=json";



            if (string.IsNullOrEmpty(ImageUrl))
            {
                json = _oauth.LinkedProfilePostWebRequest("POST", PostUrl, comment);
            }
            else
            {
                json = _oauth.LinkedProfilePostWebRequestWithImage("POST", PostUrl, comment, ImageUrl);
            }
            if (!string.IsNullOrEmpty(json))
            {
                string msg = "feed shared successfully";
                return(msg);
            }
            else
            {
                string msg = "feed has not posted";
                return(msg);
            }
        }
Ejemplo n.º 8
0
 public void UpdateLinkedIn()
 {
     while (true)
     {
         try
         {
             Model.DatabaseRepository dbr = new Model.DatabaseRepository();
             AppSettings _appsetting      = new AppSettings();
             List <Domain.Socioboard.Models.LinkedInAccount> lstLinkedinCompanyPage = dbr.Find <Domain.Socioboard.Models.LinkedInAccount>(t => t.IsActive).ToList();
             foreach (var item in lstLinkedinCompanyPage)
             {
                 oAuthLinkedIn _oauth = new oAuthLinkedIn();
                 _oauth.ConsumerKey    = Helper.AppSettings.LinkedinApiKey;
                 _oauth.ConsumerSecret = Helper.AppSettings.LinkedinSecretKey;
                 _oauth.Token          = item.OAuthToken;
                 Console.WriteLine(item.LinkedinUserName + "Updating Started");
                 LinkedPageFeed.UpdateLinkedIn(item, _oauth);
                 Console.WriteLine(item.LinkedinUserName + "Updated");
             }
             Thread.Sleep(60000);
         }
         catch (Exception ex)
         {
             Console.WriteLine("issue in web api calling" + ex.StackTrace);
             Thread.Sleep(600000);
         }
     }
 }
Ejemplo n.º 9
0
        /// <summary>
        /// Displays the profile the requestor is allowed to see.
        /// </summary>
        /// <param name="OAuth"></param>
        /// <returns></returns>
        public XmlDocument Get_UserProfile(oAuthLinkedIn OAuth)
        {
            string response = OAuth.APIWebRequest("GET", Global.GetUserProfileUrl, null);

            xmlResult.Load(new StringReader(response));
            return(xmlResult);
        }
Ejemplo n.º 10
0
        public string LinkedinComposeMessage(String message, String profileid, string userid, string currentdatetime, string picurl)
        {
            string ret = "";

            Domain.Socioboard.Domain.LinkedInAccount LinkedAccount = objLinkedInAccountRepository.getUserInformation(Guid.Parse(userid), profileid);
            oAuthLinkedIn Linkedin_oauth = new oAuthLinkedIn();

            Linkedin_oauth.Verifier    = LinkedAccount.OAuthVerifier;
            Linkedin_oauth.TokenSecret = LinkedAccount.OAuthSecret;
            Linkedin_oauth.Token       = LinkedAccount.OAuthToken;
            Linkedin_oauth.Id          = LinkedAccount.LinkedinUserId;
            Linkedin_oauth.FirstName   = LinkedAccount.LinkedinUserName;
            SocialStream sociostream = new SocialStream();

            if (!string.IsNullOrEmpty(picurl))
            {
                string res = sociostream.SetImageStatusUpdate(Linkedin_oauth, message, picurl);
            }
            else
            {
                string res = sociostream.SetStatusUpdate(Linkedin_oauth, message);
            }

            //string res = sociostream.SetStatusUpdate(Linkedin_oauth, message);
            return(ret);
        }
Ejemplo n.º 11
0
        public string getLinkedInData(string UserId, string LinkedinId)
        {
            string ret = string.Empty;

            try
            {
                Guid userId = Guid.Parse(UserId);
                //oAuthTwitter OAuth = new oAuthTwitter(ConfigurationManager.AppSettings["consumerKey"], ConfigurationManager.AppSettings["consumerSecret"], ConfigurationManager.AppSettings["callbackurl"]);

                oAuthLinkedIn Linkedin_Oauth = new oAuthLinkedIn();
                Linkedin_Oauth.ConsumerKey    = ConfigurationManager.AppSettings["LiApiKey"];
                Linkedin_Oauth.ConsumerSecret = ConfigurationManager.AppSettings["LiSecretKey"];
                LinkedInAccountRepository objLinkedInAccountRepository   = new LinkedInAccountRepository();
                Domain.Socioboard.Domain.LinkedInAccount LinkedinAccount = objLinkedInAccountRepository.getUserInformation(userId, LinkedinId);

                Linkedin_Oauth.Token       = LinkedinAccount.OAuthToken;
                Linkedin_Oauth.TokenSecret = LinkedinAccount.OAuthSecret;
                Linkedin_Oauth.Verifier    = LinkedinAccount.OAuthVerifier;
                GetUserProfile(Linkedin_Oauth, LinkedinAccount.LinkedinUserId, userId);
                GetLinkedInFeeds(Linkedin_Oauth, LinkedinId, userId);
                return("linkedin Info Updated");
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
            }


            return(ret);
        }
Ejemplo n.º 12
0
        public string FollowLinkedinPost(string GpPostid, string LinkedinUserId, string isFollowing, string userid)
        {
            int    Following    = Convert.ToInt32(isFollowing);
            string FollowStatus = string.Empty;

            if (Following == 0)
            {
                FollowStatus = "true";
            }
            else
            {
                FollowStatus = "false";
            }

            string authLink = string.Empty;
            LinkedInAccountRepository linkedinAccRepo = new LinkedInAccountRepository();
            LinkedInAccount           linkacc         = linkedinAccRepo.getUserInformation(Guid.Parse(userid), LinkedinUserId);
            oAuthLinkedIn             oauthlin        = new oAuthLinkedIn();

            oauthlin.ConsumerKey    = ConfigurationManager.AppSettings["LiApiKey"];
            oauthlin.ConsumerSecret = ConfigurationManager.AppSettings["LiSecretKey"];
            oauthlin.FirstName      = linkacc.LinkedinUserName;
            oauthlin.Id             = linkacc.LinkedinUserId;
            oauthlin.Token          = linkacc.OAuthToken;
            oauthlin.TokenSecret    = linkacc.OAuthSecret;
            oauthlin.Verifier       = linkacc.OAuthVerifier;
            GlobusLinkedinLib.LinkedIn.Core.SocialStreamMethods.SocialStream l = new GlobusLinkedinLib.LinkedIn.Core.SocialStreamMethods.SocialStream();
            string status = l.SetFollowCountUpdate(oauthlin, GpPostid, FollowStatus);

            return("success");
        }
Ejemplo n.º 13
0
        public string GetLinkedinPagePostComment(string Oauth, string updatekey, string PageId)
        {
            oAuthLinkedIn _OAuth = new oAuthLinkedIn();

            _OAuth = (oAuthLinkedIn)(new JavaScriptSerializer().Deserialize(Oauth, typeof(oAuthLinkedIn)));
            try
            {
                _OAuth.ConsumerKey = ConfigurationManager.AppSettings["LinkedinApiKey"];
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

            try
            {
                _OAuth.ConsumerSecret = ConfigurationManager.AppSettings["LinkedinSecretKey"];
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            List <Domain.Socioboard.Domain.LinkdeinPageComment> objLiPageComment = new List <Domain.Socioboard.Domain.LinkdeinPageComment>();

            try
            {
                GlobusLinkedinLib.App.Core.LinkedinPageComment objLiPagePostCmnt = new GlobusLinkedinLib.App.Core.LinkedinPageComment();

                List <LinkedinPageComment.CompanyPageComment> objLiPostcmnt = new List <LinkedinPageComment.CompanyPageComment>();

                objLiPostcmnt = objLiPagePostCmnt.GetPagePostscomment(_OAuth, updatekey, PageId);



                foreach (var item in objLiPostcmnt)
                {
                    Domain.Socioboard.Domain.LinkdeinPageComment lipagepostcmnt = new Domain.Socioboard.Domain.LinkdeinPageComment();
                    lipagepostcmnt.Comment     = item.Comment;
                    lipagepostcmnt.FirstName   = item.FirstName;
                    lipagepostcmnt.LastName    = item.LastName;
                    lipagepostcmnt.CommentTime = Convert.ToDateTime(item.CommentTime);
                    if (item.PictureUrl != null)
                    {
                        lipagepostcmnt.PictureUrl = item.PictureUrl;
                    }
                    else
                    {
                        lipagepostcmnt.PictureUrl = "../Contents/img/blank_img.png";
                    }

                    objLiPageComment.Add(lipagepostcmnt);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
            }

            return(new JavaScriptSerializer().Serialize(objLiPageComment));
        }
Ejemplo n.º 14
0
        public string GetLinkedIn_UserUpdates(oAuthLinkedIn OAuth, string LinkedInId, int Count)
        {
            string url      = "https://api.linkedin.com/v1/people/id=" + LinkedInId + "/network/updates?scope=self" + "&count=" + Count + "?format=json";
            string response = OAuth.APIWebRequest("GET", url, null);

            return(response);
        }
Ejemplo n.º 15
0
        public string SetCommentOnPagePost(oAuthLinkedIn oauth, string PageId, string Updatekey, string comment)
        {
            string url      = "https://api.linkedin.com/v1/companies/" + PageId + "/updates/key=" + Updatekey + "/update-comments-as-company";
            string response = oauth.LinkedCompanyPagePostWebRequest("POST", url, comment);

            return(response);
        }
Ejemplo n.º 16
0
        public string SetStatusUpdate(oAuthLinkedIn OAuth, string message)
        {
            ShareAndSocialStream socialStream = new ShareAndSocialStream();
            string responce = socialStream.SetStatusUpdate(OAuth, message);

            return(responce);
        }
Ejemplo n.º 17
0
        public string GetLinkedINCommentOnPagePost(oAuthLinkedIn oauth, string Updatekey, string PageId)
        {
            string url      = "https://api.linkedin.com/v1/companies/" + PageId + "/updates/key=" + Updatekey + "?format=json";
            string response = oauth.APIWebRequest("GET", url, null);

            return(response);
        }
Ejemplo n.º 18
0
        public string GetLinkedUserUpdates(string profileid, string UserId)
        {
            System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls;
            LinkedInAccount           linkacc;
            string                    authLink        = string.Empty;
            LinkedInAccountRepository linkedinAccRepo = new LinkedInAccountRepository();

            if (linkedinAccRepo.checkLinkedinUserExists(profileid, Guid.Parse(UserId)))
            {
                linkacc = linkedinAccRepo.getUserInformation(Guid.Parse(UserId), profileid);
            }
            else
            {
                linkacc = linkedinAccRepo.getUserInformation(profileid);
            }
            oAuthLinkedIn oauthlin = new oAuthLinkedIn();

            oauthlin.ConsumerKey    = ConfigurationManager.AppSettings["LiApiKey"];
            oauthlin.ConsumerSecret = ConfigurationManager.AppSettings["LiSecretKey"];
            oauthlin.FirstName      = linkacc.LinkedinUserName;
            oauthlin.Id             = linkacc.LinkedinUserId;
            oauthlin.Token          = linkacc.OAuthToken;
            oauthlin.TokenSecret    = linkacc.OAuthSecret;
            oauthlin.Verifier       = linkacc.OAuthVerifier;
            GlobusLinkedinLib.App.Core.LinkedInUser l = new GlobusLinkedinLib.App.Core.LinkedInUser();
            List <Domain.Myfashion.Domain.LinkedInUser.User_Updates> lst = l.GetUserUpdate(oauthlin, linkacc.LinkedinUserId, 10);

            return(new JavaScriptSerializer().Serialize(lst));
        }
Ejemplo n.º 19
0
        public string PutLikeOnLinkedinCompanyPageUpdate(string UserId, string PageId, string Updatekey, string IsLike)
        {
            try
            {
                string msg = string.Empty;

                int isLike = Convert.ToInt16(IsLike);

                if (isLike == 1)
                {
                    msg = "false";
                }
                else
                {
                    msg = "true";
                }

                Domain.Socioboard.Domain.LinkedinCompanyPage objlicompanypage = new Domain.Socioboard.Domain.LinkedinCompanyPage();
                objlicompanypage = objLinkedCmpnyPgeRepo.getCompanyPageInformation(PageId);
                oAuthLinkedIn Linkedin_oauth = new oAuthLinkedIn();
                Linkedin_oauth.Verifier    = objlicompanypage.OAuthVerifier;
                Linkedin_oauth.TokenSecret = objlicompanypage.OAuthSecret;
                Linkedin_oauth.Token       = objlicompanypage.OAuthToken;
                Linkedin_oauth.Id          = objlicompanypage.LinkedinPageId;
                Linkedin_oauth.FirstName   = objlicompanypage.LinkedinPageName;
                Company company = new Company();
                string  res     = company.SetLikeUpdateOnPagePost(Linkedin_oauth, Updatekey, msg);
                return(new JavaScriptSerializer().Serialize(res));
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
                return("Something Went Wrong");
            }
        }
Ejemplo n.º 20
0
        public string GetLinkedGroupsDataDetail(string userid, string groupid, string linkedinId)
        {
            LinkedInAccount           linkacc;
            string                    authLink        = string.Empty;
            LinkedInAccountRepository linkedinAccRepo = new LinkedInAccountRepository();

            if (linkedinAccRepo.checkLinkedinUserExists(linkedinId, Guid.Parse(userid)))
            {
                linkacc = linkedinAccRepo.getUserInformation(Guid.Parse(userid), linkedinId);
            }
            else
            {
                linkacc = linkedinAccRepo.getUserInformation(linkedinId);
            }
            // LinkedInAccount linkacc = linkedinAccRepo.getUserInformation(Guid.Parse(userid), linkedinId);
            oAuthLinkedIn oauthlin = new oAuthLinkedIn();

            oauthlin.ConsumerKey    = ConfigurationManager.AppSettings["LiApiKey"];
            oauthlin.ConsumerSecret = ConfigurationManager.AppSettings["LiSecretKey"];
            oauthlin.FirstName      = linkacc.LinkedinUserName;
            oauthlin.Id             = linkacc.LinkedinUserId;
            oauthlin.Token          = linkacc.OAuthToken;
            oauthlin.TokenSecret    = linkacc.OAuthSecret;
            oauthlin.Verifier       = linkacc.OAuthVerifier;
            GlobusLinkedinLib.App.Core.LinkedInGroup l = new GlobusLinkedinLib.App.Core.LinkedInGroup();
            List <Domain.Myfashion.Domain.LinkedInGroup.Group_Updates> lst = l.GetGroupPostData(oauthlin, 20, groupid, linkedinId);

            return(new JavaScriptSerializer().Serialize(lst));
        }
Ejemplo n.º 21
0
        public XmlDocument Get_UserProfile(oAuthLinkedIn OAuth)
        {
            string response = OAuth.APIWebRequest("GET", "http://api.linkedin.com/v1/people/~:(id,first-name,headline,last-name,industry,site-standard-profile-request,api-standard-profile-request,member-url-resources,picture-url,current-status,summary,positions,main-address,location,distance,specialties,proposal-comments,associations,honors,interests,educations,phone-numbers,im-accounts,twitter-accounts,date-of-birth,email-address)", null);

            xmlResult.Load(new StringReader(response));
            return(xmlResult);
        }
Ejemplo n.º 22
0
        public string PostLinkedInGroupFeeds(string gid, string linkedInUserId, string msg, string title, string userid)
        {
            LinkedInAccount           linkacc;
            string                    authLink        = string.Empty;
            LinkedInAccountRepository linkedinAccRepo = new LinkedInAccountRepository();

            if (linkedinAccRepo.checkLinkedinUserExists(linkedInUserId, Guid.Parse(userid)))
            {
                linkacc = linkedinAccRepo.getUserInformation(Guid.Parse(userid), linkedInUserId);
            }
            else
            {
                linkacc = linkedinAccRepo.getUserInformation(linkedInUserId);
            }
            oAuthLinkedIn oauthlin = new oAuthLinkedIn();

            oauthlin.ConsumerKey    = ConfigurationManager.AppSettings["LiApiKey"];
            oauthlin.ConsumerSecret = ConfigurationManager.AppSettings["LiSecretKey"];
            oauthlin.FirstName      = linkacc.LinkedinUserName;
            oauthlin.Id             = linkacc.LinkedinUserId;
            oauthlin.Token          = linkacc.OAuthToken;
            oauthlin.TokenSecret    = linkacc.OAuthSecret;
            oauthlin.Verifier       = linkacc.OAuthVerifier;
            GlobusLinkedinLib.LinkedIn.Core.SocialStreamMethods.SocialStream l = new GlobusLinkedinLib.LinkedIn.Core.SocialStreamMethods.SocialStream();
            string status = l.SetPostUpdate(oauthlin, gid, msg, title);

            return("success");
        }
Ejemplo n.º 23
0
        public string LinkedInAuth()
        {
            string email = "";

            try
            {
                oAuthLinkedIn _oauth         = new oAuthLinkedIn();
                string        oauth_token    = Request.QueryString["oauth_token"];
                string        oauth_verifier = Request.QueryString["oauth_verifier"];

                if (oauth_token != null && oauth_verifier != null)
                {
                    Application["oauth_token"]    = oauth_token;
                    Application["oauth_verifier"] = oauth_verifier;
                    _oauth.Token       = oauth_token;
                    _oauth.TokenSecret = Application["reuqestTokenSecret"].ToString();
                    _oauth.Verifier    = oauth_verifier;
                    _oauth.AccessTokenGet(oauth_token);

                    string emailResponse = _oauth.APIWebRequest("GET", "https://api.linkedin.com/v1/people/~/email-address", null);
                    email = ParselinkedInXMl(emailResponse, "<email-address>", "</email-address>");
                    string nameResponse = _oauth.APIWebRequest("GET", "https://api.linkedin.com/v1/people/~", null);
                    FirstName        = ParselinkedInXMl(nameResponse, "<first-name>", "</first-name>");
                    LastName         = ParselinkedInXMl(nameResponse, "<last-name>", "</last-name>");
                    lblAlertMsg.Text = email + " sucessfully Login with LinkedIn" + FirstName + "  " + LastName;
                    Session.Remove(SessionKeys.ServiceProvider);
                }
            }
            catch (Exception ex)
            {
                ProcessException(ex);
            }
            return(email);
        }
Ejemplo n.º 24
0
        public void GetLinkedUserUpdatesNew(oAuthLinkedIn Linkedin_Oauth, string profileid, Guid UserId)
        {
            GlobusLinkedinLib.App.Core.LinkedInUser l = new GlobusLinkedinLib.App.Core.LinkedInUser();
            List <Domain.Myfashion.Domain.LinkedIn_Update_Messages> lst_Messages = l.GetUserUpdateNew(Linkedin_Oauth, profileid, 10);

            foreach (var item_Messages in lst_Messages)
            {
                try
                {
                    objLinkedInMessage             = new Domain.Myfashion.Domain.LinkedInMessage();
                    objLinkedInMessage.Id          = Guid.NewGuid();
                    objLinkedInMessage.Message     = item_Messages.Message;
                    objLinkedInMessage.ProfileId   = item_Messages.ProfileId;
                    objLinkedInMessage.ProfileName = item_Messages.ProfileName;
                    objLinkedInMessage.CreatedDate = Convert.ToDateTime(item_Messages.CreatedDate);
                    objLinkedInMessage.EntryDate   = DateTime.Now;
                    objLinkedInMessage.Type        = item_Messages.Type;
                    objLinkedInMessage.UserId      = UserId;
                    objLinkedInMessage.ImageUrl    = item_Messages.ImageUrl;
                    objLinkedInMessage.FeedId      = item_Messages.FeedId;
                    objLinkedInMessage.ProfileUrl  = item_Messages.ProfileUrl;
                    objLinkedInMessage.Comments    = item_Messages.Comments;
                    objLinkedInMessage.Likes       = item_Messages.Likes;
                }
                catch (Exception ex)
                {
                    logger.Error(ex.StackTrace);
                }
                if (!objLinkedInMessageRepository.checkLinkedInMessageExists(profileid, objLinkedInMessage.FeedId, UserId))
                {
                    objLinkedInMessageRepository.addLinkedInMessage(objLinkedInMessage);
                }
            }
        }
        public void GetLinkedinCompanyPageFeeds(oAuthLinkedIn _oauth, string UserId, string PageId)
        {
            LinkedinPageUpdate         objlinkedinpageupdate = new LinkedinPageUpdate();
            LinkedinPagePostRepository objlipagepostRepo     = new LinkedinPagePostRepository();
            List <LinkedinPageUpdate.CompanyPagePosts> objcompanypagepost = new List <LinkedinPageUpdate.CompanyPagePosts>();

            objcompanypagepost = objlinkedinpageupdate.GetPagePosts(_oauth, PageId);
            LinkedinCompanyPagePosts lipagepost = new LinkedinCompanyPagePosts();

            foreach (var item in objcompanypagepost)
            {
                lipagepost.Id           = Guid.NewGuid();
                lipagepost.Posts        = item.Posts;
                lipagepost.PostDate     = Convert.ToDateTime(item.PostDate);
                lipagepost.EntryDate    = DateTime.Now;
                lipagepost.UserId       = Guid.Parse(UserId);
                lipagepost.Type         = item.Type;
                lipagepost.PostId       = item.PostId;
                lipagepost.UpdateKey    = item.UpdateKey;
                lipagepost.PageId       = PageId;
                lipagepost.PostImageUrl = item.PostImageUrl;
                lipagepost.Likes        = item.Likes;
                lipagepost.Comments     = item.Comments;
                if (!objlipagepostRepo.checkLinkedInPostExists(lipagepost.PostId, lipagepost.UserId))
                {
                    objlipagepostRepo.addLinkedInPagepost(lipagepost);
                }
                else
                {
                    objlipagepostRepo.updateLinkedinPostofPage(lipagepost);
                }
            }
        }
Ejemplo n.º 26
0
        public string GetLinkedIN_CompanyProfileById(oAuthLinkedIn OAuth, string CoampanyPageId)
        {
            string url      = "https://api.linkedin.com/v1/companies/" + CoampanyPageId + ":(id,name,email-domains,description,founded-year,end-year,locations,Specialties,website-url,status,employee-count-range,industries,company-type,logo-url,square-logo-url,blog-rss-url,num-followers,universal-name)?format=json";
            string response = OAuth.APIWebRequest("GET", url, null);

            return(response);
        }
Ejemplo n.º 27
0
        public XmlDocument Get_UserUpdates(oAuthLinkedIn OAuth, string LinkedInId, int Count)
        {
            string response = OAuth.APIWebRequest("GET", Global.GetNetworkUserUpdates + LinkedInId + "/network/updates?scope=self" + "&count=" + Count, null);

            xmlResult.Load(new StringReader(response));
            return(xmlResult);
        }
Ejemplo n.º 28
0
        public string GetLinkedIN_CompanyUpdateById(oAuthLinkedIn OAuth, string CoampanyPageId)
        {
            string url      = "https://api.linkedin.com/v1/companies/" + CoampanyPageId + "/updates?format=json";
            string response = OAuth.APIWebRequest("GET", url, null);

            return(response);
        }
        public static CompanyProfile GetCompanyPageData(oAuthLinkedIn _oauth, string ProfileId)
        {
            CompanyProfile objCompanyProfile = new CompanyProfile();

            objCompanyProfile = GetCompanyPageProfile(_oauth, ProfileId);
            return(objCompanyProfile);
        }
        public static void SaveLinkedInCompanyPageFeed(oAuthLinkedIn _oauth, string PageId, long UserId, Helper.AppSettings _appSettings)
        {
            List <LinkedinPageUpdate.CompanyPagePosts> objcompanypagepost = Helper.LinkedInHelper.GetLinkedinCompanyPageFeeds(_oauth, PageId);
            LinkedinCompanyPagePosts lipagepost = new LinkedinCompanyPagePosts();

            foreach (var item in objcompanypagepost)
            {
                lipagepost.Id           = ObjectId.GenerateNewId();
                lipagepost.strId        = ObjectId.GenerateNewId().ToString();
                lipagepost.Posts        = item.Posts;
                lipagepost.PostDate     = Convert.ToDateTime(item.PostDate).ToString("yyyy/MM/dd HH:mm:ss");
                lipagepost.EntryDate    = DateTime.UtcNow.ToString("yyyy/MM/dd HH:mm:ss");
                lipagepost.UserId       = UserId;
                lipagepost.Type         = item.Type;
                lipagepost.PostId       = item.PostId;
                lipagepost.UpdateKey    = item.UpdateKey;
                lipagepost.PageId       = PageId;
                lipagepost.PostImageUrl = item.PostImageUrl;
                lipagepost.Likes        = item.Likes;
                lipagepost.Comments     = item.Comments;
                MongoRepository _CompanyPagePostsRepository = new MongoRepository("LinkedinCompanyPagePosts", _appSettings);
                var             ret  = _CompanyPagePostsRepository.Find <Domain.Socioboard.Models.Mongo.LinkedinCompanyPagePosts>(t => t.PostId == lipagepost.PostId);
                var             task = Task.Run(async() =>
                {
                    return(await ret);
                });
                int count = task.Result.Count;
                if (count < 1)
                {
                    _CompanyPagePostsRepository.Add(lipagepost);
                }
            }
        }