Beispiel #1
0
 public string GetInstagramFeeds(string UserId, string InstagramId)
 {
     try
     {
         InstagramFeedRepository objInsFeedRepo = new InstagramFeedRepository();
         List <InstagramFeed>    lstInsFeed     = objInsFeedRepo.getAllInstagramFeedsOfUser(Guid.Parse(UserId), InstagramId);
         return(new JavaScriptSerializer().Serialize(lstInsFeed));
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.StackTrace);
         return(null);
     }
 }
Beispiel #2
0
        public DataSet bindFeedsIntoDataTable(User user, string network)
        {
            Messages mstable = new Messages();
            DataSet  ds      = DataTableGenerator.CreateDataSetForTable(mstable);



            if (!string.IsNullOrEmpty(network))
            {
                /*Facebook region*/
                if (network == "facebook")
                {
                    FacebookAccountRepository fbaccount = new FacebookAccountRepository();
                    FacebookMessageRepository fbmsg     = new FacebookMessageRepository();
                    ArrayList alstfbaccount             = fbaccount.getAllFacebookAccountsOfUser(user.Id);
                    foreach (FacebookAccount item in alstfbaccount)
                    {
                        List <FacebookMessage> lstfbmsg = fbmsg.getAllFacebookMessagesOfUser(user.Id, item.FbUserId);
                        foreach (FacebookMessage facebookmsg in lstfbmsg)
                        {
                            ds.Tables[0].Rows.Add(facebookmsg.ProfileId, "facebook", facebookmsg.FromId, facebookmsg.FromName, facebookmsg.FromProfileUrl, facebookmsg.MessageDate, facebookmsg.Message, facebookmsg.FbComment, facebookmsg.FbLike, facebookmsg.MessageId, facebookmsg.Type);
                        }
                    }
                }
                else if (network == "twitter")
                {
                    TwitterAccountRepository twtaccountrepo = new TwitterAccountRepository();
                    TwitterFeedRepository    twtfeedrepo    = new TwitterFeedRepository();
                    ArrayList alsttwtaccount = twtaccountrepo.getAllTwitterAccountsOfUser(user.Id);
                    foreach (TwitterAccount item in alsttwtaccount)
                    {
                        List <TwitterFeed> lsttwtmsg = twtfeedrepo.getAllTwitterFeedOfUsers(user.Id, item.TwitterUserId);
                        foreach (TwitterFeed twtmsg in lsttwtmsg)
                        {
                            ds.Tables[0].Rows.Add(twtmsg.ProfileId, "twitter", twtmsg.FromId, twtmsg.FromScreenName, twtmsg.FromProfileUrl, twtmsg.FeedDate, twtmsg.Feed, "", "", twtmsg.MessageId, twtmsg.Type);
                        }
                    }
                }
                else if (network == "linkedin")
                {
                    LinkedInAccountRepository liaccountrepo = new LinkedInAccountRepository();
                    LinkedInFeedRepository    lifeedrepo    = new LinkedInFeedRepository();
                    ArrayList alstliaccount = liaccountrepo.getAllLinkedinAccountsOfUser(user.Id);
                    foreach (LinkedInAccount item in alstliaccount)
                    {
                        List <LinkedInFeed> lsttwtmsg = lifeedrepo.getAllLinkedInFeedsOfUser(user.Id, item.LinkedinUserId);
                        foreach (LinkedInFeed limsg in lsttwtmsg)
                        {
                            ds.Tables[0].Rows.Add(limsg.ProfileId, "linkedin", limsg.FromId, limsg.FromName, limsg.FromPicUrl, limsg.FeedsDate, limsg.Feeds, "", "", "", limsg.Type);
                        }
                    }
                }
                else if (network == "instagram")
                {
                    InstagramAccountRepository insAccRepo  = new InstagramAccountRepository();
                    InstagramFeedRepository    insFeedRepo = new InstagramFeedRepository();
                    ArrayList alstlistaccount = insAccRepo.getAllInstagramAccountsOfUser(user.Id);
                    foreach (InstagramAccount item in alstlistaccount)
                    {
                        List <InstagramFeed> lstFeeed = insFeedRepo.getAllInstagramFeedsOfUser(user.Id, item.InstagramId);
                        foreach (InstagramFeed insFeed in lstFeeed)
                        {
                            ds.Tables[0].Rows.Add(insFeed.InstagramId, "instagram", "", "", "", insFeed.FeedDate, insFeed.FeedImageUrl, "", "", insFeed.FeedId, "");
                        }
                    }
                }
            }
            return(ds);
        }