Exemplo n.º 1
0
        public void GetData(object UserId)
        {
            try
            {
                Guid                     userId     = (Guid)UserId;
                oAuthTwitter             OAuth      = new oAuthTwitter(ConfigurationManager.AppSettings["consumerKey"], ConfigurationManager.AppSettings["consumerSecret"], ConfigurationManager.AppSettings["callbackurl"]);
                TwitterAccountRepository objTwtRepo = new TwitterAccountRepository();

                ArrayList arrTwtAcc = objTwtRepo.getAllTwitterAccountsOfUser(userId);
                foreach (TwitterAccount itemTwt in arrTwtAcc)
                {
                    OAuth.AccessToken       = itemTwt.OAuthToken;
                    OAuth.AccessTokenSecret = itemTwt.OAuthSecret;

                    getUserProile(OAuth, itemTwt.TwitterUserId, userId);
                    getUserTweets(OAuth, itemTwt.TwitterScreenName, itemTwt.TwitterUserId, userId);
                    getUserFeed(OAuth, itemTwt.TwitterScreenName, itemTwt.TwitterUserId, userId);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
            }
        }
Exemplo n.º 2
0
        public String getTwitterData(string UserId, string twitterid)
        {
            string ret = string.Empty;
            try
            {
                System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls;

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


                List<Domain.Socioboard.Domain.TwitterAccount> lstTwitterAccount = objTwtRepo.getAllTwitterAccountsOfUser(userId);
                foreach (Domain.Socioboard.Domain.TwitterAccount itemTwt in lstTwitterAccount)
                {
                    string profileId = string.Empty;

                    OAuth.AccessToken = itemTwt.OAuthToken;
                    OAuth.AccessTokenSecret = itemTwt.OAuthSecret;

                    getUserProile(OAuth, itemTwt.TwitterUserId, userId);
                    //getUserTweets(OAuth, itemTwt.TwitterScreenName, itemTwt.TwitterUserId, userId);
                    getUserTweets(OAuth, itemTwt.TwitterScreenName, itemTwt.TwitterUserId, userId, itemTwt);
                    gettwitterengagement(OAuth, userId, itemTwt);
                    getUserFeed(OAuth, itemTwt.TwitterScreenName, itemTwt.TwitterUserId, userId);

                    getTwitterDirectMessageSent(UserId, OAuth);
                    getTwittwrDirectMessageRecieved(OAuth, UserId);
                    getUserMentions(OAuth, itemTwt.TwitterUserId, Guid.Parse(UserId));
                    getUserFollowersData(OAuth, itemTwt.TwitterScreenName, itemTwt.TwitterUserId, Guid.Parse(UserId));
                    getUserRetweet(OAuth, itemTwt.TwitterUserId, Guid.Parse(UserId));

                    #region UpdateTeammemberprofile
                    Domain.Socioboard.Domain.TeamMemberProfile objTeamMemberProfile = new Domain.Socioboard.Domain.TeamMemberProfile();
                    objTeamMemberProfile.ProfileName = itemTwt.TwitterScreenName;
                    objTeamMemberProfile.ProfilePicUrl = itemTwt.ProfileImageUrl;
                    objTeamMemberProfile.ProfileId = itemTwt.TwitterUserId;
                    objTeamMemberProfileRepository.updateTeamMemberbyprofileid(objTeamMemberProfile);
                    #endregion
                    Domain.Socioboard.Domain.TwitterAccount _TwitterAccount = objTwtRepo.GetUserInformation(itemTwt.UserId, itemTwt.TwitterUserId);
                    if (_TwitterAccount != null)
                        getTwitterStats(_TwitterAccount);
                }
                return "twitter Info Updated Successfully";
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
            }
            return ret;

        }
Exemplo n.º 3
0
        public void GetSearchData(object parameters)
        {
            #region Twitter

            Array arrayParams = (Array)parameters;

            DiscoverySearch           dissearch       = (DiscoverySearch)arrayParams.GetValue(0);
            DiscoverySearchRepository dissearchrepo   = (DiscoverySearchRepository)arrayParams.GetValue(1);
            DiscoverySearch           discoverySearch = (DiscoverySearch)arrayParams.GetValue(2);

            oAuthTwitter oauth = new oAuthTwitter();
            oauth.ConsumerKey       = ConfigurationManager.AppSettings["consumerKey"].ToString();
            oauth.ConsumerKeySecret = ConfigurationManager.AppSettings["consumerSecret"].ToString();
            oauth.CallBackUrl       = ConfigurationManager.AppSettings["callbackurl"].ToString();


            TwitterAccountRepository twtAccRepo = new TwitterAccountRepository();
            //ArrayList alst = twtAccRepo.getAllTwitterAccounts();
            ArrayList alst = twtAccRepo.getAllTwitterAccountsOfUser(discoverySearch.UserId);
            foreach (TwitterAccount item in alst)
            {
                oauth.AccessToken       = item.OAuthToken;
                oauth.AccessTokenSecret = item.OAuthSecret;
                oauth.TwitterUserId     = item.TwitterUserId;
                oauth.TwitterScreenName = item.TwitterScreenName;
                if (TwitterHelper.CheckTwitterToken(oauth, discoverySearch.SearchKeyword))
                {
                    break;
                }
                else
                {
                }
            }

            GlobusTwitterLib.Twitter.Core.SearchMethods.Search search = new GlobusTwitterLib.Twitter.Core.SearchMethods.Search();
            Newtonsoft.Json.Linq.JArray twitterSearchResult           = search.Get_Search_Tweets(oauth, discoverySearch.SearchKeyword);

            foreach (var item in twitterSearchResult)
            {
                var results = item["statuses"];

                foreach (var chile in results)
                {
                    try
                    {
                        dissearch.CreatedTime     = SocioBoard.Helper.Extensions.ParseTwitterTime(chile["created_at"].ToString().TrimStart('"').TrimEnd('"'));;
                        dissearch.EntryDate       = DateTime.Now;
                        dissearch.FromId          = chile["user"]["id_str"].ToString().TrimStart('"').TrimEnd('"');
                        dissearch.FromName        = chile["user"]["screen_name"].ToString().TrimStart('"').TrimEnd('"');
                        dissearch.ProfileImageUrl = chile["user"]["profile_image_url"].ToString().TrimStart('"').TrimEnd('"');
                        dissearch.SearchKeyword   = discoverySearch.SearchKeyword;
                        dissearch.Network         = "twitter";
                        dissearch.Message         = chile["text"].ToString().TrimStart('"').TrimEnd('"');
                        dissearch.MessageId       = chile["id_str"].ToString().TrimStart('"').TrimEnd('"');
                        dissearch.Id     = Guid.NewGuid();
                        dissearch.UserId = discoverySearch.UserId;//user.Id;


                        if (!dissearchrepo.isKeywordPresent(dissearch.SearchKeyword, dissearch.MessageId))
                        {
                            dissearchrepo.addNewSearchResult(dissearch);
                        }
                    }
                    catch (Exception ex)
                    {
                        //logger.Error(ex.StackTrace);
                        Console.WriteLine(ex.StackTrace);
                    }
                }
            }
            #endregion
        }
Exemplo n.º 4
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);
        }
Exemplo n.º 5
0
        private void NewMethod(User user)
        {
            SocioBoard.Domain.Team team = (SocioBoard.Domain.Team)Session["GroupName"];

            TeamRepository           objTeamRepository  = new TeamRepository();
            GroupRepository          objGroupRepository = new GroupRepository();
            RssFeedsRepository       rssFeedsRepo       = new RssFeedsRepository();
            List <RssFeeds>          lstrssfeeds        = rssFeedsRepo.getAllActiveRssFeeds(user.Id);
            TwitterAccountRepository twtAccountRepo     = new TwitterAccountRepository();
            ArrayList arrTwtAcc = twtAccountRepo.getAllTwitterAccountsOfUser(user.Id);


            //===================================================================================================================================


            //====================================================================================================================================

            if (lstrssfeeds != null)
            {
                if (lstrssfeeds.Count != 0)
                {
                    //int rssCount = 0;
                    string rssData = string.Empty;
                    rssData += "<h2 class=\"league section-ttl rss_header\">Active RSS Feeds</h2>";
                    foreach (RssFeeds item in lstrssfeeds)
                    {
                        TwitterAccount twtAccount = twtAccountRepo.getUserInformation(item.ProfileScreenName, user.Id);
                        string         picurl     = string.Empty;


                        if (string.IsNullOrEmpty(twtAccount.ProfileUrl))
                        {
                            picurl = "../Contents/img/blank_img.png";
                        }
                        else
                        {
                            picurl = twtAccount.ProfileUrl;
                        }
                        rssData += " <section id=\"" + item.Id + "\" class=\"publishing\">" +
                                   "<section class=\"twothird\">" +
                                   "<article class=\"quarter\">" +
                                   "<div href=\"#\" class=\"avatar_link view_profile\" title=\"\">" +
                                   "<img title=\"" + item.ProfileScreenName + "\" src=\"" + picurl + "\" data-src=\"\" class=\"avatar sm\">" +
                                   "<article class=\"rss_ava_icon\"><span title=\"Twitter\" class=\"icon twitter_16\"></span></article>" +
                                   "</div>" +
                                   "</article>" +
                                   "<article class=\"threefourth\">" +
                                   "<ul>" +
                                   "<li>" + item.FeedUrl + "</li>" +
                                   "<li>Prefix: </li>" +
                                   "<li class=\"freq\" title=\"New items from this feed will be posted at most once every hour\">Max Frequency: " + item.Duration + "</li>" +
                                   "</ul>" +
                                   "</article>" +
                                   "</section>" +
                                   "<section class=\"third\">" +
                                   "<ul class=\"rss_action_buttons\">" +
                                   "<li onclick=\"pauseFunction('" + item.Id + "');\" class=\"\"><a id=\"pause_" + item.Id + "\" href=\"#\" title=\"Pause\" class=\"small_pause icon pause\"></a></li>" +
                                   "<li onclick=\"deleteRssFunction('" + item.Id + "');\" class=\"show-on-hover\"><a id=\"delete_" + item.Id + "\" href=\"#\" title=\"Delete\" class=\"small_remove icon delete\"></a></li>" +
                                   "</ul>" +
                                   "</section>" +
                                   "</section>";
                    }


                    rss.InnerHtml = rssData;
                    rss.Style.Add("display", "block");
                    rdata.Style.Add("display", "none");
                }
            }
            try
            {
                if (Session["IncomingTasks"] != null)
                {
                    //incom_tasks.InnerHtml = Convert.ToString((int)Session["IncomingTasks"]);
                    //incomTasks.InnerHtml = Convert.ToString((int)Session["IncomingTasks"]);
                }
                else
                {
                    TaskRepository taskRepo = new TaskRepository();
                    ArrayList      alst     = taskRepo.getAllIncompleteTasksOfUser(user.Id, team.GroupId);
                    Session["IncomingTasks"] = alst.Count;
                }
            }
            catch (Exception es)
            {
                logger.Error(es.StackTrace);
                Console.WriteLine(es.StackTrace);
            }
            if (Session["CountMessages"] != null)
            {
                //incom_messages.InnerHtml = Convert.ToString((int)Session["CountMessages"]);
                //incomMessages.InnerHtml = Convert.ToString((int)Session["CountMessages"]);
            }
            else
            {
                //incom_messages.InnerHtml = "0";
                //incomMessages.InnerHtml = "0";
            }
            //usernm.InnerHtml = "Hello, <a href=\"../Settings/PersonalSettings.aspx\"> " + user.UserName + "</a>";
            usernm.InnerHtml = "Hello, " + user.UserName + "";
            //usernm.InnerHtml = "Hello, <a href=\"../Settings/PersonalSettings.aspx\"> " + user.UserName + "</a>";


            usernm.InnerHtml = "Hello, " + user.UserName + "";
            //usernm.InnerHtml = "Hello, <a href=\"../Settings/PersonalSettings.aspx\"> " + user.UserName + "</a>";
            if (!string.IsNullOrEmpty(user.ProfileUrl))
            {
                //userimg.InnerHtml = "<a href=\"../Settings/PersonalSettings.aspx\"><img id=\"loggeduserimg\" src=\"" + user.ProfileUrl + "\" alt=\"" + user.UserName + "\"/></a>";
                userimg.InnerHtml = "<img id=\"loggeduserimg\" src=\"" + user.ProfileUrl + "\" alt=\"" + user.UserName + "\"/>";
                if (user.TimeZone != null)
                {
                    Datetime = TimeZoneInfo.ConvertTimeBySystemTimeZoneId(DateTime.UtcNow, user.TimeZone).ToLongDateString() + " " + TimeZoneInfo.ConvertTimeBySystemTimeZoneId(DateTime.UtcNow, user.TimeZone).ToShortTimeString() + " (" + user.TimeZone + ")";
                    //userinf.InnerHtml = Datetime;
                }
                if (user.TimeZone == null)
                {
                    Datetime = DateTime.Now.ToString();
                    //userinf.InnerHtml = Datetime;
                }
            }
            else
            {
                //userimg.InnerHtml = "<a href=\"../Settings/PersonalSettings.aspx\"><img id=\"loggeduserimg\" src=\"../Contents/img/blank_img.png\" alt=\"" + user.UserName + "\"/></a>";
                userimg.InnerHtml = "<img id=\"loggeduserimg\" src=\"../Contents/img/blank_img.png\" alt=\"" + user.UserName + "\"/>";
                if (user.TimeZone != null)
                {
                    Datetime = TimeZoneInfo.ConvertTimeBySystemTimeZoneId(DateTime.UtcNow, user.TimeZone).ToLongDateString() + " " + TimeZoneInfo.ConvertTimeBySystemTimeZoneId(DateTime.UtcNow, user.TimeZone).ToShortTimeString() + " (" + user.TimeZone + ")";
                    //userinf.InnerHtml = Datetime;
                }
                if (user.TimeZone == null)
                {
                    Datetime = DateTime.Now.ToString();
                    //userinf.InnerHtml = Datetime;
                }
            }

            try
            {
                GroupRepository grouprepo = new GroupRepository();
                List <Groups>   lstgroups = grouprepo.getAllGroups(user.Id);
                string          totgroups = string.Empty;
                if (lstgroups.Count != 0)
                {
                    foreach (Groups item in lstgroups)
                    {
                        totgroups += "<li><a href=\"../Settings/InviteMember.aspx?q=" + item.Id + "\" id=\"group_" + item.Id + "\"><img src=\"../Contents/img/groups_.png\"  alt=\"\"  style=\" margin-right:5px;\"/>" + item.GroupName + "</a></li>";
                    }
                    inviteRedirect.InnerHtml = totgroups;
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex.StackTrace);
                Console.WriteLine(ex.StackTrace);
            }
        }