Ejemplo n.º 1
0
        public string GetTeamMembeDetailsForGroupReport(string TeamId, string userid, string days)
        {
            string FacebookprofileId         = string.Empty;
            string TwitterprofileId          = string.Empty;
            string FacebookFanPageId         = string.Empty;
            string profid                    = string.Empty;
            string FacebookInboxMessagecount = string.Empty;
            string TwitterInboxMessagecount  = string.Empty;

            Domain.Socioboard.Domain.GroupStatDetails _GroupStatDetails = new Domain.Socioboard.Domain.GroupStatDetails();

            Guid UserId = Guid.Parse(userid);

            try
            {
                List <FacebookAccount> _facebookAccount = new List <FacebookAccount>();
                List <Domain.Socioboard.Domain.TeamMemberProfile> lstTeamMember = teammemberrepo.getAllTeamMemberProfilesOfTeam(Guid.Parse(TeamId));


                foreach (Domain.Socioboard.Domain.TeamMemberProfile TeamMemberProfile in lstTeamMember)
                {
                    #region MyRegion
                    try
                    {
                        if (TeamMemberProfile.ProfileType == "facebook" || TeamMemberProfile.ProfileType == "twitter")
                        {
                            profid += TeamMemberProfile.ProfileId + ',';
                        }
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                    }
                    try
                    {
                        if (TeamMemberProfile.ProfileType == "facebook")
                        {
                            FacebookprofileId += TeamMemberProfile.ProfileId + ',';
                        }
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                    }
                    try
                    {
                        if (TeamMemberProfile.ProfileType == "twitter")
                        {
                            TwitterprofileId += TeamMemberProfile.ProfileId + ',';
                        }
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                    }
                    try
                    {
                        if (TeamMemberProfile.ProfileType == "facebook_page")
                        {
                            FacebookFanPageId += TeamMemberProfile.ProfileId + ',';
                        }
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                    }
                    #endregion
                }

                #region MyRegion
                try
                {
                    profid = profid.Substring(0, profid.Length - 1);
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.StackTrace);
                }
                try
                {
                    FacebookFanPageId = FacebookFanPageId.Substring(0, FacebookFanPageId.Length - 1);
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.StackTrace);
                    FacebookFanPageId = null;
                }
                try
                {
                    TwitterprofileId = TwitterprofileId.Substring(0, TwitterprofileId.Length - 1);
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.StackTrace);
                    TwitterprofileId = null;
                }
                try
                {
                    FacebookprofileId = FacebookprofileId.Substring(0, FacebookprofileId.Length - 1);
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.StackTrace);
                    FacebookprofileId = null;
                }
                #endregion

                #region Inboxmessagecount
                if (!string.IsNullOrEmpty(FacebookprofileId))
                {
                    try
                    {
                        FacebookMessage _FacebookMessage = new FacebookMessage();
                        FacebookInboxMessagecount = _FacebookMessage.GetAllInboxMessage(userid, FacebookprofileId, days);
                    }
                    catch (Exception ex)
                    {
                        FacebookInboxMessagecount = (0).ToString();
                        Console.WriteLine(ex.StackTrace);
                    }
                }
                else
                {
                    FacebookInboxMessagecount = (0).ToString();
                }

                if (!string.IsNullOrEmpty(TwitterprofileId))
                {
                    try
                    {
                        TwitterFeed _TwitterFeed = new TwitterFeed();
                        TwitterInboxMessagecount = _TwitterFeed.TwitterInboxMessagecount(userid, TwitterprofileId, days);
                    }
                    catch (Exception ex)
                    {
                        TwitterInboxMessagecount = (0).ToString();
                        Console.WriteLine(ex.StackTrace);
                    }
                }

                else
                {
                    TwitterInboxMessagecount = (0).ToString();
                }

                _GroupStatDetails.IncommingMessage = (Convert.ToInt32(FacebookInboxMessagecount) + Convert.ToInt32(TwitterInboxMessagecount));
                #endregion

                #region sentmessage
                if (!string.IsNullOrEmpty(profid))
                {
                    try
                    {
                        ScheduledMessage _ScheduledMessage = new ScheduledMessage();
                        _GroupStatDetails.SentMessage = _ScheduledMessage.GetAllScheduledMessage(userid, profid, days);
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                        _GroupStatDetails.SentMessage = 0;
                    }
                }
                #endregion

                #region twitterfolllower
                try
                {
                    TwitterAccountFollowers _TwitterAccountFollowers = new TwitterAccountFollowers();
                    _GroupStatDetails.TwitterFollower = _TwitterAccountFollowers.FollowerCount(userid, TwitterprofileId, days);
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.StackTrace);
                    _GroupStatDetails.TwitterFollower = 0;
                }

                #endregion

                #region fancount
                try
                {
                    FacebookFanPage _FacebookFanPage = new FacebookFanPage();
                    _GroupStatDetails.FacebookFan = _FacebookFanPage.FacebookFans(userid, FacebookFanPageId, days);
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.StackTrace);
                    _GroupStatDetails.FacebookFan = 0;
                }

                #endregion


                #region MentionRetweetDetails
                try
                {
                    TwitterMessage _TwitterMessage = new TwitterMessage();
                    _GroupStatDetails.MentionGraph = string.Empty;
                    string graphdetails = _TwitterMessage.GetAllRetweetMentionBydays(userid, TwitterprofileId, days);

                    string[] data = graphdetails.Split('@');
                    foreach (var item in data)
                    {
                        if (item.Contains("usrtwet^"))
                        {
                            _GroupStatDetails.UserTweetGraph = item.Replace("usrtwet^", "");
                        }
                        else if (item.Contains("mention^"))
                        {
                            _GroupStatDetails.MentionGraph = item.Replace("mention^", "");
                        }
                        else if (item.Contains("retwet^"))
                        {
                            _GroupStatDetails.RetweetGraph = item.Replace("retwet^", "");
                        }
                        else if (item.Contains("metion"))
                        {
                            _GroupStatDetails.Mention = Convert.ToInt32(item.Replace("metion", ""));
                        }
                        else if (item.Contains("retwet"))
                        {
                            _GroupStatDetails.Retweet = Convert.ToInt32(item.Replace("retwet", ""));
                        }
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.StackTrace);
                }
                #endregion

                try
                {
                    ScheduledMessage _ScheduledMessage = new ScheduledMessage();

                    string   details = _ScheduledMessage.GetAllScheduleMsgDetailsForReport(userid, TwitterprofileId, days);
                    string[] data    = details.Split('@');
                    foreach (var item in data)
                    {
                        if (item.Contains("plaintext_"))
                        {
                            _GroupStatDetails.PlainText = Convert.ToInt32(item.Replace("plaintext_", ""));
                        }

                        else
                        {
                            _GroupStatDetails.PhotoLink = Convert.ToInt32(item);
                        }
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.StackTrace);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
                return("Something Went Wrong");
            }

            return(new JavaScriptSerializer().Serialize(_GroupStatDetails));
        }
Ejemplo n.º 2
0
        public string GetAllTwitterStatsDetails(string Profileid, string userid, string days)
        {
            int       dayscount             = Convert.ToInt32(days);
            Guid      Userid                = Guid.Parse(userid);
            ArrayList arrTwtStats           = new ArrayList();
            ArrayList arrTwtBeforestats     = new ArrayList();
            dynamic   _TwitterStatsReport_1 = null;
            dynamic   _TwitterStatsReport_2 = null;

            Domain.Socioboard.Domain.TwitterStatsReport _TwitterStats = new Domain.Socioboard.Domain.TwitterStatsReport();
            try
            {
                arrTwtStats = _TwitterStatsRepository.getTwitterStatsByIdDay(Profileid, Userid, dayscount);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
            }
            try
            {
                arrTwtBeforestats = _TwitterStatsRepository.getTwitterStatsByIdbeforeDay(Profileid, Userid, dayscount);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
            }

            if (arrTwtStats.Count != 0)
            {
                _TwitterStatsReport_1 = arrTwtStats[0];

                if (arrTwtBeforestats.Count != 0)
                {
                    _TwitterStatsReport_2 = arrTwtBeforestats[0];


                    _TwitterStats.FollowerCount   = Math.Abs(_TwitterStatsReport_1[4] - _TwitterStatsReport_2[4]);
                    _TwitterStats.FollowingCount  = Math.Abs(_TwitterStatsReport_1[3] - _TwitterStatsReport_2[3]);
                    _TwitterStats.DMRecievedCount = Math.Abs(_TwitterStatsReport_1[5] - _TwitterStatsReport_2[5]);
                    _TwitterStats.DMSentCount     = Math.Abs(_TwitterStatsReport_1[6] - _TwitterStatsReport_2[6]);
                    _TwitterStats.Age1820         = _TwitterStatsReport_1[9] - _TwitterStatsReport_2[9];
                    _TwitterStats.Age2124         = _TwitterStatsReport_1[10] - _TwitterStatsReport_2[10];
                    _TwitterStats.Age2534         = _TwitterStatsReport_1[11] - _TwitterStatsReport_2[11];
                    _TwitterStats.Age3544         = _TwitterStatsReport_1[12] - _TwitterStatsReport_2[12];
                    _TwitterStats.Age4554         = _TwitterStatsReport_1[13] - _TwitterStatsReport_2[13];
                    _TwitterStats.Age5564         = _TwitterStatsReport_1[14] - _TwitterStatsReport_2[14];
                    _TwitterStats.Age65           = _TwitterStatsReport_1[15] - _TwitterStatsReport_2[15];
                }
                else
                {
                    _TwitterStats.FollowerCount   = _TwitterStatsReport_1[4];
                    _TwitterStats.FollowingCount  = _TwitterStatsReport_1[3];
                    _TwitterStats.DMRecievedCount = _TwitterStatsReport_1[5];
                    _TwitterStats.DMSentCount     = _TwitterStatsReport_1[6];
                    _TwitterStats.Age1820         = _TwitterStatsReport_1[9];
                    _TwitterStats.Age2124         = _TwitterStatsReport_1[10];
                    _TwitterStats.Age2534         = _TwitterStatsReport_1[11];
                    _TwitterStats.Age3544         = _TwitterStatsReport_1[12];
                    _TwitterStats.Age4554         = _TwitterStatsReport_1[13];
                    _TwitterStats.Age5564         = _TwitterStatsReport_1[14];
                    _TwitterStats.Age65           = _TwitterStatsReport_1[15];
                }
            }

            List <Domain.Socioboard.Domain.TwitterStatsReport> _lstTwitterStats = new List <Domain.Socioboard.Domain.TwitterStatsReport>();

            string Engagement = Engagementreport(Profileid, Userid, dayscount);
            string influence  = Influencereport(Profileid, Userid, dayscount);
            string datetime   = DateTimereport(Profileid, Userid, dayscount);

            TwitterMessage _TwitterMessage = new TwitterMessage();
            string         twtmention      = _TwitterMessage.getTwtMention(Profileid, Userid, dayscount);
            string         twtretweet      = _TwitterMessage.getRetweets(Profileid, Userid, dayscount);

            TwitterAccount _TwitterAccount = new TwitterAccount();

            Domain.Socioboard.Domain.TwitterAccount obj = _TwitterAccount.AcccountDetails(Profileid, Userid);

            _TwitterStats.TwtProfImgUrl = obj.ProfileImageUrl;
            _TwitterStats.TwtUserName   = obj.TwitterScreenName;
            _TwitterStats.days          = dayscount;
            _TwitterStats.TwitterId     = Profileid;
            _TwitterStats.Engagement    = Engagement;
            _TwitterStats.Influence     = influence;
            _TwitterStats.EntryDate     = datetime;
            _TwitterStats.TwtRetweet    = Convert.ToInt32(twtretweet);
            _TwitterStats.TwtMention    = Convert.ToInt32(twtmention);


            _lstTwitterStats.Add(_TwitterStats);


            return(new JavaScriptSerializer().Serialize(_lstTwitterStats));
        }
Ejemplo n.º 3
0
        public string GetAllTwitterStatsDetails(string Profileid,string userid,string days)
        {
           
            int dayscount = Convert.ToInt32(days);
            Guid Userid=Guid.Parse(userid);
            ArrayList arrTwtStats = new ArrayList();
            TwitterDirectMessageRepository objTwitterDirectMessageRepository = new TwitterDirectMessageRepository();
            ArrayList arrTwtBeforestats = new ArrayList();
            dynamic _TwitterStatsReport_1 =null;
            dynamic _TwitterStatsReport_2 = null;
          
            Domain.Socioboard.Domain.TwitterStatsReport _TwitterStats = new Domain.Socioboard.Domain.TwitterStatsReport();
            try
            {
               arrTwtStats = _TwitterStatsRepository.getTwitterStatsByIdDay(Profileid, Userid, dayscount);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
            }
            try
            {
               arrTwtBeforestats = _TwitterStatsRepository.getTwitterStatsByIdbeforeDay(Profileid, Userid, dayscount);
            }
            catch (Exception ex)
            {
               Console.WriteLine(ex.StackTrace);
            }

            if (arrTwtStats.Count != 0)
            {
                _TwitterStatsReport_1 = arrTwtStats[0];

                if (arrTwtBeforestats.Count != 0)
                {
                    _TwitterStatsReport_2 = arrTwtBeforestats[0];


                    _TwitterStats.FollowerCount = Math.Abs(_TwitterStatsReport_1[4] - _TwitterStatsReport_2[4]);
                    _TwitterStats.FollowingCount = Math.Abs(_TwitterStatsReport_1[3] - _TwitterStatsReport_2[3]);
                    //_TwitterStats.DMRecievedCount = Math.Abs(_TwitterStatsReport_1[5] - _TwitterStatsReport_2[5]);
                    //_TwitterStats.DMSentCount = Math.Abs(_TwitterStatsReport_1[6] - _TwitterStatsReport_2[6]);
                    _TwitterStats.DMRecievedCount = objTwitterDirectMessageRepository.GetDirrectMessageReceiveCountByProfileIdAndUserId(Userid, Profileid, dayscount);
                    _TwitterStats.DMSentCount = objTwitterDirectMessageRepository.GetDirrectMessageCountByProfileIdAndUserId(Userid, Profileid, dayscount);
                    _TwitterStats.Age1820 = _TwitterStatsReport_1[9] - _TwitterStatsReport_2[9];
                    _TwitterStats.Age2124 = _TwitterStatsReport_1[10] - _TwitterStatsReport_2[10];
                    _TwitterStats.Age2534 = _TwitterStatsReport_1[11] - _TwitterStatsReport_2[11];
                    _TwitterStats.Age3544 = _TwitterStatsReport_1[12] - _TwitterStatsReport_2[12];
                    _TwitterStats.Age4554 = _TwitterStatsReport_1[13] - _TwitterStatsReport_2[13];
                    _TwitterStats.Age5564 = _TwitterStatsReport_1[14] - _TwitterStatsReport_2[14];
                    _TwitterStats.Age65 = _TwitterStatsReport_1[15] - _TwitterStatsReport_2[15];

                }
                else 
                {
                    _TwitterStats.FollowerCount = _TwitterStatsReport_1[4] ;
                    _TwitterStats.FollowingCount = _TwitterStatsReport_1[3] ;
                    //_TwitterStats.DMRecievedCount =_TwitterStatsReport_1[5];
                    //_TwitterStats.DMSentCount = _TwitterStatsReport_1[6];
                    _TwitterStats.DMRecievedCount = objTwitterDirectMessageRepository.GetDirrectMessageReceiveCountByProfileIdAndUserId(Userid, Profileid, dayscount);
                    _TwitterStats.DMSentCount = objTwitterDirectMessageRepository.GetDirrectMessageCountByProfileIdAndUserId(Userid, Profileid, dayscount);
                    _TwitterStats.Age1820 = _TwitterStatsReport_1[9];
                    _TwitterStats.Age2124 = _TwitterStatsReport_1[10];
                    _TwitterStats.Age2534 = _TwitterStatsReport_1[11];
                    _TwitterStats.Age3544 = _TwitterStatsReport_1[12];
                    _TwitterStats.Age4554 = _TwitterStatsReport_1[13];
                    _TwitterStats.Age5564 = _TwitterStatsReport_1[14];
                    _TwitterStats.Age65 = _TwitterStatsReport_1[15];

                }             
            }

            List<Domain.Socioboard.Domain.TwitterStatsReport> _lstTwitterStats = new List<Domain.Socioboard.Domain.TwitterStatsReport>();
   
            string Engagement = Engagementreport(Profileid, Userid, dayscount);
            string influence = Influencereport(Profileid, Userid, dayscount);
            string datetime = DateTimereport(Profileid, Userid, dayscount);

            TwitterMessage _TwitterMessage = new TwitterMessage();
           // string twtmention = _TwitterMessage.getTwtMention(Profileid, Userid, dayscount);
            //string twtretweet = _TwitterMessage.getRetweets(Profileid, Userid, dayscount);
            string twtmention = _TwitterMessage.GetMentionStatsCountByProfileIdAndUserId(Profileid, Userid, dayscount);
            string twtretweet = _TwitterMessage.GetRetweetStatsCountByProfileIdAndUserId(Profileid, Userid, dayscount);
            

            TwitterAccount _TwitterAccount = new TwitterAccount();
            Domain.Socioboard.Domain.TwitterAccount obj = _TwitterAccount.AcccountDetails(Profileid,Userid);

            _TwitterStats.TwtProfImgUrl = obj.ProfileImageUrl;
            _TwitterStats.TwtUserName = obj.TwitterScreenName;
            _TwitterStats.days = dayscount;
            _TwitterStats.TwitterId = Profileid;
            _TwitterStats.Engagement = Engagement;
            _TwitterStats.Influence = influence;
            _TwitterStats.EntryDate = datetime;
            _TwitterStats.TwtRetweet = Convert.ToInt32(twtretweet);
            _TwitterStats.TwtMention = Convert.ToInt32(twtmention); 


            _lstTwitterStats.Add(_TwitterStats);

           
            return new JavaScriptSerializer().Serialize(_lstTwitterStats);
        }