Beispiel #1
0
        public string SheduleTumblrMessage(string TumblrId, string UserId, string sscheduledmsgguid)
        {
            string str = string.Empty;

            try
            {
                Guid         userId           = Guid.Parse(UserId);
                oAuthTumbler Obj_oAuthTumbler = new oAuthTumbler();
                oAuthTumbler.TumblrConsumerKey     = ConfigurationManager.AppSettings["TumblrClientKey"];
                oAuthTumbler.TumblrConsumerSecret  = ConfigurationManager.AppSettings["TumblrClientSec"];
                Obj_oAuthTumbler.TumblrCallBackUrl = ConfigurationManager.AppSettings["TumblrCallBackURL"];
                objScheduledMessage = objScheduledMessageRepository.GetScheduledMessageDetails(Guid.Parse(sscheduledmsgguid));
                Domain.Socioboard.Domain.TumblrAccount ObjTumblrAccount = objTumblrAccountRepository.getTumblrAccountDetailsById(TumblrId, Guid.Parse(UserId));
                oAuthTumbler.TumblrToken       = ObjTumblrAccount.tblrAccessToken;
                oAuthTumbler.TumblrTokenSecret = ObjTumblrAccount.tblrAccessTokenSecret;
                PublishedPosts objPublishedPosts = new PublishedPosts();
                string         picurl            = objScheduledMessage.PicUrl;
                string         message           = objScheduledMessage.ShareMessage;
                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
                {
                    try
                    {
                        //objPublishedPosts.PostData(ObjTumblrAccount.tblrAccessToken, ObjTumblrAccount.tblrAccessTokenSecret, ObjTumblrAccount.tblrUserName, objScheduledMessage.ShareMessage, "", "Text");
                        if (!string.IsNullOrEmpty(picurl))
                        {
                            objPublishedPosts.PostData(ObjTumblrAccount.tblrAccessToken, ObjTumblrAccount.tblrAccessTokenSecret, objScheduledMessage.ProfileId, message, picurl, "photo");
                        }
                        else
                        {
                            objPublishedPosts.PostData(ObjTumblrAccount.tblrAccessToken, ObjTumblrAccount.tblrAccessTokenSecret, objScheduledMessage.ProfileId, message, "", "text");
                        }
                        str = "Message post on tumblr for Id :" + ObjTumblrAccount.tblrUserName + " and Message: " + objScheduledMessage.ShareMessage;
                        ScheduledMessage schmsg = new ScheduledMessage();
                        schmsg.UpdateScheduledMessageByMsgId(Guid.Parse(sscheduledmsgguid));
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                        str = "Message is not posted";
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
                str = ex.Message;
            }
            return(str);
        }
Beispiel #2
0
        public string SheduleYoutubeMessage(string YoutubeId, string UserId, string sscheduledmsgguid)
        {
            string str = string.Empty;

            try
            {
                objScheduledMessage = objScheduledMessageRepository.GetScheduledMessageDetails(Guid.Parse(sscheduledmsgguid));
                Domain.Socioboard.Domain.YoutubeAccount ObjYoutubeAccount = objYoutubeAccountRepository.getYoutubeAccountDetailsById(YoutubeId, Guid.Parse(UserId));
                oAuthToken OAuthToken = new oAuthToken();
                OAuthToken.ConsumerKey    = ConfigurationManager.AppSettings["YtconsumerKey"];
                OAuthToken.ConsumerSecret = ConfigurationManager.AppSettings["YtconsumerSecret"];
            }
            catch (Exception ex)
            {
                throw;
            }
            return(str);
        }
        public string SheduleInstagramMessage(string InstagramId, string UserId, string sscheduledmsgguid)
        {
            string str = string.Empty;

            try
            {
                objScheduledMessage = objScheduledMessageRepository.GetScheduledMessageDetails(Guid.Parse(sscheduledmsgguid));
                objInstagramAccount = objInstagramAccountRepository.getInstagramAccountDetailsById(InstagramId, Guid.Parse(UserId));

                // oAuthInstagram Instagram_oauth = new oAuthInstagram();
                // Instagram_oauth.ConsumerKey = System.Configuration.ConfigurationSettings.AppSettings["LiApiKey"].ToString();
                //Instagram_oauth.
            }
            catch (Exception ex)
            {
                throw;
            }
            return(str);
        }
        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);
        }
Beispiel #5
0
        public string SheduleLinkedInMessage(string LinkedInId, string UserId, string sscheduledmsgguid)
        {
            string str = string.Empty;

            try
            {
                objScheduledMessage = objScheduledMessageRepository.GetScheduledMessageDetails(Guid.Parse(sscheduledmsgguid));
                objLinkedInAccount  = objLinkedInAccountRepository.getUserInformation(Guid.Parse(UserId), 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      = objLinkedInAccount.LinkedinUserName;
                Linkedin_oauth.Token          = objLinkedInAccount.OAuthToken;
                Linkedin_oauth.TokenSecret    = objLinkedInAccount.OAuthSecret;
                Linkedin_oauth.Verifier       = objLinkedInAccount.OAuthVerifier;
                if (objLinkedInAccount != null)
                {
                    try
                    {
                        GlobusLinkedinLib.App.Core.LinkedInUser linkeduser = new GlobusLinkedinLib.App.Core.LinkedInUser();

                        if (string.IsNullOrEmpty(objScheduledMessage.ShareMessage))
                        {
                            objScheduledMessage.ShareMessage = "There is no data in Share Message !";
                        }

                        var response = string.Empty;;
                        try
                        {
                            response = linkeduser.SetStatusUpdate(Linkedin_oauth, objScheduledMessage.ShareMessage);
                            str      = "Message post on linkedin for Id :" + objLinkedInAccount.LinkedinUserId + " and Message: " + objScheduledMessage.ShareMessage;
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);
                        }

                        if (string.IsNullOrEmpty(response))
                        {
                            ScheduledMessage schmsg = new ScheduledMessage();
                            schmsg.UpdateScheduledMessageByMsgId(Guid.Parse(sscheduledmsgguid));
                        }
                        else
                        {
                            str = "Message not posted";
                        }
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                    }
                }
                else
                {
                    str = "facebook account not found for id" + objScheduledMessage.ProfileId;
                }
            }

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

            return(str);
        }