Пример #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));
        }
Пример #2
0
        public static GroupStatDetails GetGroupStatsData(int days)
        {
            GroupStatDetails _GroupStatDetails = new GroupStatDetails();
            try
            {

                User objUser = (User)System.Web.HttpContext.Current.Session["User"];
                List<Domain.Socioboard.Domain.TeamMemberProfile> lstTeamMemberProfile = new List<Domain.Socioboard.Domain.TeamMemberProfile>();
                Api.Team.Team objApiTeam = new Api.Team.Team();
                objApiTeam.Timeout = 300000;
                string groupid = System.Web.HttpContext.Current.Session["group"].ToString();
                JObject team = JObject.Parse(objApiTeam.GetTeamByGroupId(System.Web.HttpContext.Current.Session["group"].ToString()));
                Api.TeamMemberProfile.TeamMemberProfile objApiTeamMemberProfile = new Api.TeamMemberProfile.TeamMemberProfile();
                objApiTeamMemberProfile.Timeout = 300000;
                //JArray TeamMemberProfiles = JArray.Parse(objApiTeamMemberProfile.GetTeamMemberProfilesByTeamId(Convert.ToString(team["Id"])));

                //  var asd=  objApiTeamMemberProfile.GetTeamMembeDetailsForGroupReport(Convert.ToString(team["Id"]), objUser.Id.ToString(), days.ToString());

                _GroupStatDetails = (GroupStatDetails)(new JavaScriptSerializer().Deserialize(objApiTeamMemberProfile.GetTeamMembeDetailsForGroupReport(Convert.ToString(team["Id"]), objUser.Id.ToString(), days.ToString()), typeof(GroupStatDetails)));


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


            return _GroupStatDetails;
        }
Пример #3
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);
                }
                try
                {
                    TwitterprofileId = TwitterprofileId.Substring(0, TwitterprofileId.Length - 1);
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.StackTrace);
                }
                try
                {
                    FacebookprofileId = FacebookprofileId.Substring(0, FacebookprofileId.Length - 1);
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.StackTrace);
                }
                #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);
                    }
                }
               
                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);
                    }
                }
               
                   
               
                _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);

           
        }