Esempio n. 1
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.Socioboard.Domain.LinkedInUser.User_Updates> lst = l.GetUserUpdate(oauthlin, linkacc.LinkedinUserId, 10);

            return(new JavaScriptSerializer().Serialize(lst));
        }
Esempio n. 2
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);
        }
Esempio n. 3
0
 public string GetAllLinkedinAccountsByUserIdAndGroupId(string userid, string groupid)
 {
     try
     {
         LinkedInAccountRepository _objLinkedInAccountRepository            = new LinkedInAccountRepository();
         List <Domain.Socioboard.Domain.LinkedInAccount> lstLinkedInAccount = new List <Domain.Socioboard.Domain.LinkedInAccount>();
         Domain.Socioboard.Domain.Team objTeam = objTeamRepository.GetTeamByGroupId(Guid.Parse(groupid));
         List <Domain.Socioboard.Domain.TeamMemberProfile> lstTeamMemberProfile = objTeamMemberProfileRepository.GetTeamMemberProfileByTeamIdAndProfileType(objTeam.Id, "linkedin");
         foreach (var item in lstTeamMemberProfile)
         {
             try
             {
                 if (_objLinkedInAccountRepository.checkLinkedinUserExists(item.ProfileId, Guid.Parse(userid)))
                 {
                     lstLinkedInAccount.Add(objlinkedinaccrepo.getUserInformation(Guid.Parse(userid), item.ProfileId));
                 }
                 else
                 {
                     lstLinkedInAccount.Add(objlinkedinaccrepo.getUserInformation(item.ProfileId));
                 }
             }
             catch (Exception)
             {
             }
         }
         return(new JavaScriptSerializer().Serialize(lstLinkedInAccount));
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.StackTrace);
         return("Something Went Wrong");
     }
 }
Esempio n. 4
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");
        }
Esempio n. 5
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.Socioboard.Domain.LinkedInGroup.Group_Updates> lst = l.GetGroupPostData(oauthlin, 20, groupid, linkedinId);

            return(new JavaScriptSerializer().Serialize(lst));
        }
Esempio n. 6
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");
        }
Esempio n. 7
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();
                LinkedInAccount           LinkedAccount;
                LinkedInAccountRepository linkedinAccRepo = new LinkedInAccountRepository();
                if (linkedinAccRepo.checkLinkedinUserExists(LinkedinId, Guid.Parse(UserId)))
                {
                    LinkedAccount = linkedinAccRepo.getUserInformation(Guid.Parse(UserId), LinkedinId);
                    #region UpdateTeammemberprofile
                    Domain.Socioboard.Domain.TeamMemberProfile objTeamMemberProfile = new Domain.Socioboard.Domain.TeamMemberProfile();
                    objTeamMemberProfile.ProfileName   = LinkedAccount.LinkedinUserName;
                    objTeamMemberProfile.ProfilePicUrl = LinkedAccount.ProfileImageUrl;
                    objTeamMemberProfile.ProfileId     = LinkedAccount.LinkedinUserId;
                    objTeamMemberProfileRepository.updateTeamMemberbyprofileid(objTeamMemberProfile);
                    #endregion
                }
                else
                {
                    LinkedAccount = linkedinAccRepo.getUserInformation(LinkedinId);
                    #region UpdateTeammemberprofile
                    Domain.Socioboard.Domain.TeamMemberProfile objTeamMemberProfile = new Domain.Socioboard.Domain.TeamMemberProfile();
                    objTeamMemberProfile.ProfileName   = LinkedAccount.LinkedinUserName;
                    objTeamMemberProfile.ProfilePicUrl = LinkedAccount.ProfileImageUrl;
                    objTeamMemberProfile.ProfileId     = LinkedAccount.LinkedinUserId;
                    objTeamMemberProfileRepository.updateTeamMemberbyprofileid(objTeamMemberProfile);
                    #endregion
                }

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


            return(ret);
        }
Esempio n. 8
0
        public string LinkedinProfileDetails(string Userid, string ProfileId)
        {
            Domain.Socioboard.Domain.LinkedInAccount objLinkedinAccount = new Domain.Socioboard.Domain.LinkedInAccount();
            LinkedInAccountRepository _objLinkedInAccountRepository     = new LinkedInAccountRepository();

            if (_objLinkedInAccountRepository.checkLinkedinUserExists(ProfileId, Guid.Parse(Userid)))
            {
                objLinkedinAccount = _objLinkedInAccountRepository.getUserInformation(Guid.Parse(Userid), ProfileId);
            }
            else
            {
                objLinkedinAccount = _objLinkedInAccountRepository.getUserInformation(ProfileId);
            }
            return(new JavaScriptSerializer().Serialize(objLinkedinAccount));
        }
Esempio n. 9
0
        public string CommentOnLinkedInPost(string groupid, string GpPostid, string message, string LinkedinUserId, string userid)
        {
            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.SetCommentOnPost(oauthlin, GpPostid, message);

            return("success");
        }
Esempio n. 10
0
        public string GetLinkedUsergroupsDetail(string profileid, string UserId)
        {
            string authLink = string.Empty;
            LinkedInAccountRepository linkedinAccRepo = new LinkedInAccountRepository();
            LinkedInAccount           linkacc         = linkedinAccRepo.getUserInformation(Guid.Parse(UserId), 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.Socioboard.Domain.LinkedInUser.User_Updates> lst = l.GetUserUpdate(oauthlin, linkacc.LinkedinUserId, 10);

            return(new JavaScriptSerializer().Serialize(lst));
        }
Esempio n. 11
0
        public void GetLinkedInUserProfile(dynamic data, oAuthLinkedIn _oauth, Guid user, string LinkedinUserId)
        {
            LinkedInAccount           objLinkedInAccount = new LinkedInAccount();
            LinkedInAccountRepository objLiRepo          = new LinkedInAccountRepository();

            try
            {
                objLinkedInAccount.UserId         = user;
                objLinkedInAccount.LinkedinUserId = data.id.ToString();
                try
                {
                    objLinkedInAccount.EmailId = data.email.ToString();
                }
                catch { }
                objLinkedInAccount.LinkedinUserName = data.first_name.ToString() + data.last_name.ToString();
                objLinkedInAccount.OAuthToken       = _oauth.Token;
                objLinkedInAccount.OAuthSecret      = _oauth.TokenSecret;
                objLinkedInAccount.OAuthVerifier    = _oauth.Verifier;
                try
                {
                    objLinkedInAccount.ProfileImageUrl = data.picture_url.ToString();
                }
                catch { }
                try
                {
                    objLinkedInAccount.ProfileUrl = data.profile_url.ToString();
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.StackTrace);
                }
                objLinkedInAccount.Connections = data.connections;
                objLinkedInAccount.IsActive    = true;
                objLiRepo.updateLinkedinUser(objLinkedInAccount);
            }
            catch
            {
            }
        }
Esempio n. 12
0
        public string LinkedinComposeMessage(String message, String profileid, string userid, string currentdatetime, string picurl)
        {
            string                    ret = "";
            LinkedInAccount           LinkedAccount;
            string                    authLink        = string.Empty;
            LinkedInAccountRepository linkedinAccRepo = new LinkedInAccountRepository();

            if (linkedinAccRepo.checkLinkedinUserExists(profileid, Guid.Parse(userid)))
            {
                LinkedAccount = linkedinAccRepo.getUserInformation(Guid.Parse(userid), profileid);
            }
            else
            {
                LinkedAccount = linkedinAccRepo.getUserInformation(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))
            {
                picurl = ConfigurationManager.AppSettings["DomainName"].ToString() + Regex.Split(picurl, "wwwroot")[1].Replace("\\", "/");
                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);
        }
Esempio n. 13
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();
                 LinkedInAccount LinkedAccount;
                 LinkedInAccountRepository linkedinAccRepo = new LinkedInAccountRepository();
                 if (linkedinAccRepo.checkLinkedinUserExists(LinkedinId, Guid.Parse(UserId)))
                 {
                     LinkedAccount = linkedinAccRepo.getUserInformation(Guid.Parse(UserId), LinkedinId);
                     #region UpdateTeammemberprofile
                     Domain.Socioboard.Domain.TeamMemberProfile objTeamMemberProfile = new Domain.Socioboard.Domain.TeamMemberProfile();
                     objTeamMemberProfile.ProfileName = LinkedAccount.LinkedinUserName;
                     objTeamMemberProfile.ProfilePicUrl = LinkedAccount.ProfileImageUrl;
                     objTeamMemberProfile.ProfileId = LinkedAccount.LinkedinUserId;
                     objTeamMemberProfileRepository.updateTeamMemberbyprofileid(objTeamMemberProfile);
                     #endregion
                 }
                 else
                 {
                     LinkedAccount = linkedinAccRepo.getUserInformation(LinkedinId);
                     #region UpdateTeammemberprofile
                     Domain.Socioboard.Domain.TeamMemberProfile objTeamMemberProfile = new Domain.Socioboard.Domain.TeamMemberProfile();
                     objTeamMemberProfile.ProfileName = LinkedAccount.LinkedinUserName;
                     objTeamMemberProfile.ProfilePicUrl = LinkedAccount.ProfileImageUrl;
                     objTeamMemberProfile.ProfileId = LinkedAccount.LinkedinUserId;
                     objTeamMemberProfileRepository.updateTeamMemberbyprofileid(objTeamMemberProfile);
                     #endregion
                 }

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


             return ret;
         }
Esempio n. 14
0
         public string ScheduleLinkedinGroupMessage(string scheduledmsgguid, string Userid, string profileid)
         {
             string str = string.Empty;
             try
             {
                 LinkedInAccount linkacc;
                 string authLink = string.Empty;
                 LinkedInAccountRepository linkedinAccRepo = new LinkedInAccountRepository();
                 objScheduledMessage = objScheduledMessageRepository.GetScheduledMessageDetails(Guid.Parse(scheduledmsgguid));
                 GroupScheduleMessageRepository grpschedulemessagerepo = new GroupScheduleMessageRepository();
                 Domain.Socioboard.Domain.GroupScheduleMessage _GroupScheduleMessage = grpschedulemessagerepo.GetScheduleMessageId(objScheduledMessage.Id);
                 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;

                 string imgurl = objScheduledMessage.PicUrl;
                 string text = objScheduledMessage.ShareMessage;
                 string[] arrtext = null;
                 try
                 {
                     arrtext = System.Text.RegularExpressions.Regex.Split(text, "$%^_^%$");
                     if (arrtext.Count() == 1)
                     {
                         arrtext = null;
                         arrtext = text.Split(new string[] { "$%^_^%$" }, StringSplitOptions.None);
                     }
                 }
                 catch (Exception ex)
                 {
                     return "somthing went wrong";
                 }
                 string Title = arrtext[0];
                 string Message = arrtext[1];
                 string response = string.Empty;
                 if (linkacc != null)
                 {
                     try
                     {
                         if (string.IsNullOrEmpty(objScheduledMessage.ShareMessage) && string.IsNullOrEmpty(objScheduledMessage.PicUrl))
                         {
                             str = "There is no data in Share Message !";
                         }
                         else
                         {
                             SocialStream sociostream = new SocialStream();
                             if (!string.IsNullOrEmpty(imgurl))
                             {
                                 imgurl = ConfigurationManager.AppSettings["DomainName"].ToString() + Regex.Split(imgurl, "wwwroot")[1].Replace("\\", "/");
                                 response = sociostream.SetImagePostUpdate(oauthlin, _GroupScheduleMessage.GroupId, Message, Title, imgurl);
                             }
                             else
                             {
                                 response = sociostream.SetPostUpdate(oauthlin, _GroupScheduleMessage.GroupId, Message, Title);
                             }
                         }
                     }
                     catch (Exception ex)
                     {
                     }

                     str = "Message post on linkedingroup for Id :" + linkacc.LinkedinUserId + ", Title: " + Title + " and Message: " + Message;
                     ScheduledMessage schmsg = new ScheduledMessage();
                     schmsg.UpdateScheduledMessageByMsgId(Guid.Parse(scheduledmsgguid));

                 }
             }
             catch (Exception ex)
             {
                 Console.WriteLine(ex.Message);
                 str = ex.Message;
             }
             return str;
         }
Esempio n. 15
0
         public string SheduleLinkedInMessage(string LinkedInId, string UserId, string sscheduledmsgguid)
         {
             string str = string.Empty;
             LinkedInAccount LinkedAccount;
             string authLink = string.Empty;
             LinkedInAccountRepository linkedinAccRepo = new LinkedInAccountRepository();
             try
             {
                 objScheduledMessage = objScheduledMessageRepository.GetScheduledMessageDetails(Guid.Parse(sscheduledmsgguid));
                 if (linkedinAccRepo.checkLinkedinUserExists(LinkedInId, Guid.Parse(UserId)))
                 {
                     LinkedAccount = linkedinAccRepo.getUserInformation(Guid.Parse(UserId), LinkedInId);
                 }
                 else
                 {
                     LinkedAccount = linkedinAccRepo.getUserInformation(LinkedInId);
                 }
                 oAuthLinkedIn Linkedin_oauth = new oAuthLinkedIn();
                 Linkedin_oauth.ConsumerKey = System.Configuration.ConfigurationSettings.AppSettings["LiApiKey"].ToString();
                 Linkedin_oauth.ConsumerSecret = System.Configuration.ConfigurationSettings.AppSettings["LiSecretKey"].ToString();
                 Linkedin_oauth.FirstName = LinkedAccount.LinkedinUserName;
                 Linkedin_oauth.Token = LinkedAccount.OAuthToken;
                 Linkedin_oauth.TokenSecret = LinkedAccount.OAuthSecret;
                 Linkedin_oauth.Verifier = LinkedAccount.OAuthVerifier;
                 string message = objScheduledMessage.ShareMessage;
                 string picurl = objScheduledMessage.PicUrl;
                 if (LinkedAccount != null)
                 {
                     try
                     {
                         //GlobusLinkedinLib.App.Core.LinkedInUser linkeduser = new GlobusLinkedinLib.App.Core.LinkedInUser();
                         if (string.IsNullOrEmpty(objScheduledMessage.ShareMessage) && string.IsNullOrEmpty(objScheduledMessage.PicUrl))
                         {
                             //objScheduledMessage.ShareMessage = "There is no data in Share Message !";
                             str = "There is no data in Share Message !";
                         }
                         else
                         {
                             var response = string.Empty; ;
                             try
                             {
                                 //response = linkeduser.SetStatusUpdate(Linkedin_oauth, objScheduledMessage.ShareMessage);
                                 SocialStream sociostream = new SocialStream();
                                 if (!string.IsNullOrEmpty(picurl))
                                 {
                                     picurl = ConfigurationManager.AppSettings["DomainName"].ToString() + Regex.Split(picurl, "wwwroot")[1].Replace("\\", "/");
                                     response = sociostream.SetImageStatusUpdate(Linkedin_oauth, message, picurl);
                                 }
                                 else
                                 {
                                     response = sociostream.SetStatusUpdate(Linkedin_oauth, message);
                                 }
                             }
                             catch (Exception ex)
                             {
                                 Console.WriteLine(ex.StackTrace);
                                 str = ex.Message;
                             }

                             if (!string.IsNullOrEmpty(response))
                             {
                                 str = "Message post on linkedin for Id :" + LinkedAccount.LinkedinUserId + " and Message: " + objScheduledMessage.ShareMessage;
                                 ScheduledMessage schmsg = new ScheduledMessage();
                                 schmsg.UpdateScheduledMessageByMsgId(Guid.Parse(sscheduledmsgguid));
                             }
                             else
                             {
                                 str = "Message not posted";
                             } 
                         }
                     }
                     catch (Exception ex)
                     {
                         Console.WriteLine(ex.StackTrace);
                         str = ex.Message;
                     }
                 }
                 else
                 {
                     str = "Linkedin account not found for id" + objScheduledMessage.ProfileId;
                 }
             }
             catch (Exception ex)
             {
                 Console.WriteLine(ex.StackTrace);
                 str = ex.Message;
             }
             return str;
         }
Esempio n. 16
0
         public string LinkedinComposeMessage(String message, String profileid, string userid, string currentdatetime, string picurl)
         {
             string ret = "";
             LinkedInAccount LinkedAccount;
             string authLink = string.Empty;
             LinkedInAccountRepository linkedinAccRepo = new LinkedInAccountRepository();
             if (linkedinAccRepo.checkLinkedinUserExists(profileid, Guid.Parse(userid)))
             {
                 LinkedAccount = linkedinAccRepo.getUserInformation(Guid.Parse(userid), profileid);
             }
             else
             {
                 LinkedAccount = linkedinAccRepo.getUserInformation(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))
             {
                 picurl = ConfigurationManager.AppSettings["DomainName"].ToString() + Regex.Split(picurl, "wwwroot")[1].Replace("\\", "/");
                 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;
         }
Esempio n. 17
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";

        }
Esempio n. 18
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";
            }

            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.SetFollowCountUpdate(oauthlin, GpPostid, FollowStatus);
            return "success";


        }
Esempio n. 19
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.Socioboard.Domain.LinkedInGroup.Group_Updates> lst = l.GetGroupPostData(oauthlin, 20, groupid, linkedinId);
            return new JavaScriptSerializer().Serialize(lst);

        }
Esempio n. 20
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.Socioboard.Domain.LinkedInUser.User_Updates> lst = l.GetUserUpdate(oauthlin, linkacc.LinkedinUserId, 10);
     return new JavaScriptSerializer().Serialize(lst);
    
 }
Esempio n. 21
0
 public string ProfilesConnected(string UserId)
 {
     try
     {
         Guid userid = Guid.Parse(UserId);
         SocialProfilesRepository socialRepo = new SocialProfilesRepository();
         List <Domain.Socioboard.Domain.SocialProfile> lstsocioprofile = socialRepo.getAllSocialProfilesOfUser(userid);
         List <profileConnected> lstProfile = new List <profileConnected>();
         foreach (Domain.Socioboard.Domain.SocialProfile sp in lstsocioprofile)
         {
             profileConnected pc = new profileConnected();
             pc.Id            = sp.Id;
             pc.ProfileDate   = sp.ProfileDate;
             pc.ProfileId     = sp.ProfileId;
             pc.ProfileStatus = sp.ProfileStatus;
             pc.ProfileType   = sp.ProfileType;
             pc.UserId        = sp.UserId;
             if (sp.ProfileType == "facebook")
             {
                 try
                 {
                     FacebookAccountRepository objFbAccRepo            = new FacebookAccountRepository();
                     Domain.Socioboard.Domain.FacebookAccount objFbAcc = objFbAccRepo.getUserDetails(sp.ProfileId);
                     pc.ProfileName   = objFbAcc.FbUserName;
                     pc.ProfileImgUrl = "http://graph.facebook.com/" + sp.ProfileId + "/picture?type=small";
                 }
                 catch (Exception ex)
                 {
                     Console.WriteLine(ex.StackTrace);
                 }
             }
             else if (sp.ProfileType == "twitter")
             {
                 try
                 {
                     TwitterAccountRepository objTwtAccRepo            = new TwitterAccountRepository();
                     Domain.Socioboard.Domain.TwitterAccount objTwtAcc = objTwtAccRepo.getUserInfo(sp.ProfileId);
                     pc.ProfileName   = objTwtAcc.TwitterScreenName;
                     pc.ProfileImgUrl = objTwtAcc.ProfileImageUrl;
                 }
                 catch (Exception ex)
                 {
                     Console.WriteLine(ex.StackTrace);
                 }
             }
             else if (sp.ProfileType == "instagram")
             {
                 try
                 {
                     InstagramAccountRepository objInsAccRepo            = new InstagramAccountRepository();
                     Domain.Socioboard.Domain.InstagramAccount objInsAcc = objInsAccRepo.getInstagramAccountById(sp.ProfileId);
                     pc.ProfileName   = objInsAcc.InsUserName;
                     pc.ProfileImgUrl = objInsAcc.ProfileUrl;
                 }
                 catch (Exception ex)
                 {
                     Console.WriteLine(ex.StackTrace);
                 }
             }
             else if (sp.ProfileType == "linkedin")
             {
                 try
                 {
                     LinkedInAccountRepository objLiAccRepo            = new LinkedInAccountRepository();
                     Domain.Socioboard.Domain.LinkedInAccount objLiAcc = objLiAccRepo.getLinkedinAccountDetailsById(sp.ProfileId);
                     pc.ProfileName   = objLiAcc.LinkedinUserName;
                     pc.ProfileImgUrl = objLiAcc.ProfileImageUrl;
                 }
                 catch (Exception ex)
                 {
                     Console.WriteLine(ex.StackTrace);
                 }
             }
             else if (sp.ProfileType == "googleplus")
             {
                 try
                 {
                     GooglePlusAccountRepository objGpAccRepo            = new GooglePlusAccountRepository();
                     Domain.Socioboard.Domain.GooglePlusAccount objGpAcc = objGpAccRepo.getUserDetails(sp.ProfileId);
                     pc.ProfileName   = objGpAcc.GpUserName;
                     pc.ProfileImgUrl = objGpAcc.GpProfileImage;
                 }
                 catch (Exception ex)
                 {
                     Console.WriteLine(ex.StackTrace);
                 }
             }
             else if (sp.ProfileType == "tumblr")
             {
                 try
                 {
                     TumblrAccountRepository objTumblrAccountRepository      = new TumblrAccountRepository();
                     Domain.Socioboard.Domain.TumblrAccount objTumblrAccount = objTumblrAccountRepository.getTumblrAccountDetailsById(sp.ProfileId);
                     pc.ProfileName   = objTumblrAccount.tblrUserName;
                     pc.ProfileImgUrl = objTumblrAccount.tblrProfilePicUrl;
                 }
                 catch (Exception ex)
                 {
                     Console.WriteLine(ex.StackTrace);
                 }
             }
             else if (sp.ProfileType == "youtube")
             {
                 try
                 {
                     YoutubeAccountRepository objYoutubeAccountRepository      = new YoutubeAccountRepository();
                     Domain.Socioboard.Domain.YoutubeAccount objYoutubeAccount = objYoutubeAccountRepository.getYoutubeAccountDetailsById(sp.ProfileId);
                     pc.ProfileName   = objYoutubeAccount.Ytusername;
                     pc.ProfileImgUrl = objYoutubeAccount.Ytprofileimage;
                 }
                 catch (Exception ex)
                 {
                     Console.WriteLine(ex.StackTrace);
                 }
             }
             lstProfile.Add(pc);
         }
         return(new JavaScriptSerializer().Serialize(lstProfile));
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.StackTrace);
         return(new JavaScriptSerializer().Serialize("Please Try Again"));
     }
 }
Esempio n. 22
0
        public string SheduleLinkedInMessage(string LinkedInId, string UserId, string sscheduledmsgguid)
        {
            string                    str = string.Empty;
            LinkedInAccount           LinkedAccount;
            string                    authLink        = string.Empty;
            LinkedInAccountRepository linkedinAccRepo = new LinkedInAccountRepository();

            try
            {
                objScheduledMessage = objScheduledMessageRepository.GetScheduledMessageDetails(Guid.Parse(sscheduledmsgguid));
                if (linkedinAccRepo.checkLinkedinUserExists(LinkedInId, Guid.Parse(UserId)))
                {
                    LinkedAccount = linkedinAccRepo.getUserInformation(Guid.Parse(UserId), LinkedInId);
                }
                else
                {
                    LinkedAccount = linkedinAccRepo.getUserInformation(LinkedInId);
                }
                oAuthLinkedIn Linkedin_oauth = new oAuthLinkedIn();
                Linkedin_oauth.ConsumerKey    = System.Configuration.ConfigurationSettings.AppSettings["LiApiKey"].ToString();
                Linkedin_oauth.ConsumerSecret = System.Configuration.ConfigurationSettings.AppSettings["LiSecretKey"].ToString();
                Linkedin_oauth.FirstName      = LinkedAccount.LinkedinUserName;
                Linkedin_oauth.Token          = LinkedAccount.OAuthToken;
                Linkedin_oauth.TokenSecret    = LinkedAccount.OAuthSecret;
                Linkedin_oauth.Verifier       = LinkedAccount.OAuthVerifier;
                string message = objScheduledMessage.ShareMessage;
                string picurl  = objScheduledMessage.PicUrl;
                if (LinkedAccount != null)
                {
                    try
                    {
                        //GlobusLinkedinLib.App.Core.LinkedInUser linkeduser = new GlobusLinkedinLib.App.Core.LinkedInUser();
                        if (string.IsNullOrEmpty(objScheduledMessage.ShareMessage) && string.IsNullOrEmpty(objScheduledMessage.PicUrl))
                        {
                            //objScheduledMessage.ShareMessage = "There is no data in Share Message !";
                            str = "There is no data in Share Message !";
                        }
                        else
                        {
                            var response = string.Empty;;
                            try
                            {
                                //response = linkeduser.SetStatusUpdate(Linkedin_oauth, objScheduledMessage.ShareMessage);
                                SocialStream sociostream = new SocialStream();
                                if (!string.IsNullOrEmpty(picurl))
                                {
                                    picurl   = ConfigurationManager.AppSettings["DomainName"].ToString() + Regex.Split(picurl, "wwwroot")[1].Replace("\\", "/");
                                    response = sociostream.SetImageStatusUpdate(Linkedin_oauth, message, picurl);
                                }
                                else
                                {
                                    response = sociostream.SetStatusUpdate(Linkedin_oauth, message);
                                }
                            }
                            catch (Exception ex)
                            {
                                Console.WriteLine(ex.StackTrace);
                                str = ex.Message;
                            }

                            if (!string.IsNullOrEmpty(response))
                            {
                                str = "Message post on linkedin for Id :" + LinkedAccount.LinkedinUserId + " and Message: " + objScheduledMessage.ShareMessage;
                                ScheduledMessage schmsg = new ScheduledMessage();
                                schmsg.UpdateScheduledMessageByMsgId(Guid.Parse(sscheduledmsgguid));
                            }
                            else
                            {
                                str = "Message not posted";
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                        str = ex.Message;
                    }
                }
                else
                {
                    str = "Linkedin account not found for id" + objScheduledMessage.ProfileId;
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
                str = ex.Message;
            }
            return(str);
        }
Esempio n. 23
0
         public void GetLinkedInUserProfile(dynamic data, oAuthLinkedIn _oauth, Guid user, string LinkedinUserId)
         {

             LinkedInAccount objLinkedInAccount = new LinkedInAccount();
             LinkedInAccountRepository objLiRepo = new LinkedInAccountRepository();
             try
             {
                 objLinkedInAccount.UserId = user;
                 objLinkedInAccount.LinkedinUserId = data.id.ToString();
                 try
                 {
                     objLinkedInAccount.EmailId = data.email.ToString();
                 }
                 catch { }
                 objLinkedInAccount.LinkedinUserName = data.first_name.ToString() + data.last_name.ToString();
                 objLinkedInAccount.OAuthToken = _oauth.Token;
                 objLinkedInAccount.OAuthSecret = _oauth.TokenSecret;
                 objLinkedInAccount.OAuthVerifier = _oauth.Verifier;
                 try
                 {
                     objLinkedInAccount.ProfileImageUrl = data.picture_url.ToString();
                 }
                 catch { }
                 try
                 {
                     objLinkedInAccount.ProfileUrl = data.profile_url.ToString();
                 }
                 catch (Exception ex)
                 {
                     Console.WriteLine(ex.StackTrace);
                 }
                 objLinkedInAccount.Connections = data.connections;
                 objLinkedInAccount.IsActive = true;
                 objLiRepo.updateLinkedinUser(objLinkedInAccount);
             }
             catch
             {
             }

         }
Esempio n. 24
0
        public string ScheduleLinkedinGroupMessage(string scheduledmsgguid, string Userid, string profileid)
        {
            string str = string.Empty;

            try
            {
                LinkedInAccount           linkacc;
                string                    authLink        = string.Empty;
                LinkedInAccountRepository linkedinAccRepo = new LinkedInAccountRepository();
                objScheduledMessage = objScheduledMessageRepository.GetScheduledMessageDetails(Guid.Parse(scheduledmsgguid));
                GroupScheduleMessageRepository grpschedulemessagerepo = new GroupScheduleMessageRepository();
                Domain.Socioboard.Domain.GroupScheduleMessage _GroupScheduleMessage = grpschedulemessagerepo.GetScheduleMessageId(objScheduledMessage.Id);
                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;

                string   imgurl  = objScheduledMessage.PicUrl;
                string   text    = objScheduledMessage.ShareMessage;
                string[] arrtext = null;
                try
                {
                    arrtext = System.Text.RegularExpressions.Regex.Split(text, "$%^_^%$");
                    if (arrtext.Count() == 1)
                    {
                        arrtext = null;
                        arrtext = text.Split(new string[] { "$%^_^%$" }, StringSplitOptions.None);
                    }
                }
                catch (Exception ex)
                {
                    return("somthing went wrong");
                }
                string Title    = arrtext[0];
                string Message  = arrtext[1];
                string response = string.Empty;
                if (linkacc != null)
                {
                    try
                    {
                        if (string.IsNullOrEmpty(objScheduledMessage.ShareMessage) && string.IsNullOrEmpty(objScheduledMessage.PicUrl))
                        {
                            str = "There is no data in Share Message !";
                        }
                        else
                        {
                            SocialStream sociostream = new SocialStream();
                            if (!string.IsNullOrEmpty(imgurl))
                            {
                                imgurl   = ConfigurationManager.AppSettings["DomainName"].ToString() + Regex.Split(imgurl, "wwwroot")[1].Replace("\\", "/");
                                response = sociostream.SetImagePostUpdate(oauthlin, _GroupScheduleMessage.GroupId, Message, Title, imgurl);
                            }
                            else
                            {
                                response = sociostream.SetPostUpdate(oauthlin, _GroupScheduleMessage.GroupId, Message, Title);
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                    }

                    str = "Message post on linkedingroup for Id :" + linkacc.LinkedinUserId + ", Title: " + Title + " and Message: " + Message;
                    ScheduledMessage schmsg = new ScheduledMessage();
                    schmsg.UpdateScheduledMessageByMsgId(Guid.Parse(scheduledmsgguid));
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                str = ex.Message;
            }
            return(str);
        }
Esempio n. 25
0
 public string LinkedinProfileDetails(string Userid, string ProfileId)
 {
     Domain.Socioboard.Domain.LinkedInAccount objLinkedinAccount = new Domain.Socioboard.Domain.LinkedInAccount();
     LinkedInAccountRepository _objLinkedInAccountRepository = new LinkedInAccountRepository();
     if (_objLinkedInAccountRepository.checkLinkedinUserExists(ProfileId, Guid.Parse(Userid)))
     {
         objLinkedinAccount = _objLinkedInAccountRepository.getUserInformation(Guid.Parse(Userid), ProfileId);
     }
     else
     {
         objLinkedinAccount = _objLinkedInAccountRepository.getUserInformation(ProfileId);
     }
     return new JavaScriptSerializer().Serialize(objLinkedinAccount);
 }
         public string LinkedinComposeMessageRss(string message, string profileid, string userid)
         {
             string ret = "";
             LinkedInAccount LinkedAccount;
             string authLink = string.Empty;
             LinkedInAccountRepository linkedinAccRepo = new LinkedInAccountRepository();
             if (linkedinAccRepo.checkLinkedinUserExists(profileid, Guid.Parse(userid)))
             {
                 LinkedAccount = linkedinAccRepo.getUserInformation(Guid.Parse(userid), profileid);
             }
             else
             {
                 LinkedAccount = linkedinAccRepo.getUserInformation(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();

             try
             {
                 ret = sociostream.SetStatusUpdate(Linkedin_oauth, message);
                 RssFeedsRepository objrssfeed = new RssFeedsRepository();
                 objrssfeed.updateFeedStatus(Guid.Parse(userid), message);
                 return ret = "Messages Posted Successfully";
             }
             catch (Exception ex)
             {
                 Console.WriteLine(ex.Message);
                 return ret = "Message Could Not Posted";
             }
         }