コード例 #1
0
        public string Influencereport(string profileid, Guid userid, int days)
        {
            string strArray = string.Empty;

            try
            {
                //TwitterStatsRepository objtwtstatsRepo = new TwitterStatsRepository();
                //ArrayList alstTwt = objtwtstatsRepo.getTwitterStatsById(profileid,userid, days);
                TwitterEngagementRepository objTwitterEngagementRepository = new TwitterEngagementRepository();
                ArrayList alstTwt    = objTwitterEngagementRepository.getTwitterStatsById(profileid, userid, days);
                int       increament = 0;
                if (alstTwt.Count > 5)
                {
                    increament = alstTwt.Count / 5;
                }

                //  strArray = "[";
                string str = string.Empty;
                int    cnt = 0;
                if (alstTwt.Count > 0)
                {
                    if (increament > 0)
                    {
                        for (int i = 0; i < alstTwt.Count; i = i + increament)
                        {
                            Array temp = (Array)alstTwt[i];
                            strArray = strArray + temp.GetValue(7).ToString() + ",";
                            cnt++;
                        }
                    }
                    else
                    {
                        foreach (var itemTS in alstTwt)
                        {
                            Array temp = (Array)itemTS;
                            strArray = strArray + temp.GetValue(7).ToString() + ",";
                            cnt++;
                        }
                    }
                }
                if (cnt < 7)
                {
                    for (int j = 0; j < 7 - cnt; j++)
                    {
                        str = str + "0,";
                    }
                }

                strArray = str + strArray;
                strArray = strArray.Substring(0, strArray.Length - 1);

                //  strArray += "]";
            }
            catch (Exception Err)
            {
                Console.Write(Err.StackTrace);
            }

            return(strArray);
        }
コード例 #2
0
        public string DateTimereport(string profileid, Guid userid, int days)
        { 
           string strArray = string.Empty;
            try
            {
                TwitterEngagementRepository objTwitterEngagementRepository = new TwitterEngagementRepository();
                ArrayList alstTwt = objTwitterEngagementRepository.getTwitterStatsById(profileid, userid, days);
                int increament = 0;
                if (alstTwt.Count > 5)
                {
                    increament = alstTwt.Count / 5;
                }

                //  strArray = "[";
                string str = string.Empty;
                int cnt = 0;
                if (alstTwt.Count > 0)
                {
                    if (increament > 0)
                    {
                        for (int i = 0; i < alstTwt.Count; i = i + increament)
                        {
                            Array temp = (Array)alstTwt[i];
                            strArray = strArray + temp.GetValue(6).ToString() + ",";
                            cnt++;
                        }
                    }
                    else
                    {
                        foreach (var itemTS in alstTwt)
                        {
                            Array temp = (Array)itemTS;
                            strArray = strArray + temp.GetValue(6).ToString() + ",";
                            cnt++;
                        }
                    }




                }
                if (cnt < 7)
                {
                    for (int j = 0; j < 7 - cnt; j++)
                    {
                        str = str + "0,";
                    }
                }

                strArray = str + strArray;
                strArray = strArray.Substring(0, strArray.Length - 1);

                //  strArray += "]";
            }
            catch (Exception Err)
            {
                Console.Write(Err.StackTrace);
            }

            //for (int i = 0; i < 7; i++)
            //{

            //    strArray += RandomDay() + ",";
            //    //strImpression += getrandomno() + ",";
            //    System.Threading.Thread.Sleep(10);
            //}
            return strArray;
        
        
        }
コード例 #3
0
        public string Influencereport(string profileid, Guid userid, int days)
        {
            string strArray = string.Empty;
            try
            {
                //TwitterStatsRepository objtwtstatsRepo = new TwitterStatsRepository();
                //ArrayList alstTwt = objtwtstatsRepo.getTwitterStatsById(profileid,userid, days);
                TwitterEngagementRepository objTwitterEngagementRepository = new TwitterEngagementRepository();
                ArrayList alstTwt = objTwitterEngagementRepository.getTwitterStatsById(profileid, userid, days);
                int increament = 0;
                if (alstTwt.Count > 5)
                {
                    increament = alstTwt.Count / 5;
                }

                //  strArray = "[";
                string str = string.Empty;
                int cnt = 0;
                if (alstTwt.Count > 0)
                {
                    if (increament > 0)
                    {
                        for (int i = 0; i < alstTwt.Count; i = i + increament)
                        {
                            Array temp = (Array)alstTwt[i];
                            strArray = strArray + temp.GetValue(7).ToString() + ",";
                            cnt++;
                        }
                    }
                    else
                    {
                        foreach (var itemTS in alstTwt)
                        {
                            Array temp = (Array)itemTS;
                            strArray = strArray + temp.GetValue(7).ToString() + ",";
                            cnt++;
                        }
                    }

                }
                if (cnt < 7)
                {
                    for (int j = 0; j < 7 - cnt; j++)
                    {
                        str = str + "0,";
                    }
                }

                strArray = str + strArray;
                strArray = strArray.Substring(0, strArray.Length - 1);

                //  strArray += "]";
            }
            catch (Exception Err)
            {
                Console.Write(Err.StackTrace);
            }
           
            return strArray;
        
        
        }
コード例 #4
0
        public string DateTimereport(string profileid, Guid userid, int days)
        {
            string strArray = string.Empty;

            try
            {
                TwitterEngagementRepository objTwitterEngagementRepository = new TwitterEngagementRepository();
                ArrayList alstTwt    = objTwitterEngagementRepository.getTwitterStatsById(profileid, userid, days);
                int       increament = 0;
                if (alstTwt.Count > 5)
                {
                    increament = alstTwt.Count / 5;
                }

                //  strArray = "[";
                string str = string.Empty;
                int    cnt = 0;
                if (alstTwt.Count > 0)
                {
                    if (increament > 0)
                    {
                        for (int i = 0; i < alstTwt.Count; i = i + increament)
                        {
                            Array temp = (Array)alstTwt[i];
                            strArray = strArray + temp.GetValue(6).ToString() + ",";
                            cnt++;
                        }
                    }
                    else
                    {
                        foreach (var itemTS in alstTwt)
                        {
                            Array temp = (Array)itemTS;
                            strArray = strArray + temp.GetValue(6).ToString() + ",";
                            cnt++;
                        }
                    }
                }
                if (cnt < 7)
                {
                    for (int j = 0; j < 7 - cnt; j++)
                    {
                        str = str + "0,";
                    }
                }

                strArray = str + strArray;
                strArray = strArray.Substring(0, strArray.Length - 1);

                //  strArray += "]";
            }
            catch (Exception Err)
            {
                Console.Write(Err.StackTrace);
            }

            //for (int i = 0; i < 7; i++)
            //{

            //    strArray += RandomDay() + ",";
            //    //strImpression += getrandomno() + ",";
            //    System.Threading.Thread.Sleep(10);
            //}
            return(strArray);
        }
コード例 #5
0
        public void getTwitterEngagement(string UserId, oAuthTwitter OAuth)
        {
            #region Add Twitter Engagement
            Tweet objTweet = new Tweet();
            TwitterEngagement objTwitterEngagement = new TwitterEngagement();
            TwitterEngagementRepository objTwitterEngagementRepository = new TwitterEngagementRepository();

            //TwitterMessageRepository objTwitterMessageRepository=new TwitterMessageRepository ();
            List<Domain.Myfashion.Domain.TwitterMessage> lsttwtmessage = objTwitterMessageRepository.getAllTwitterMessagesRetweet(Guid.Parse(UserId), objTwitterAccount.TwitterUserId);
            List<Domain.Myfashion.Domain.TwitterMessage> tsttwtwmessagetweet = objTwitterMessageRepository.getAllTwitterMessagestweet(Guid.Parse(UserId), objTwitterAccount.TwitterUserId);
            foreach (var itemmsg in lsttwtmessage)
            {

                JArray EngagementData = objTweet.Get_Statuses_RetweetsById(OAuth, itemmsg.MessageId);
                foreach (var item in EngagementData)
                {
                    objTwitterEngagement.Id = Guid.NewGuid();
                    objTwitterEngagement.UserId = Guid.Parse(UserId);
                    objTwitterEngagement.EntryDate = DateTime.Now;
                    objTwitterEngagement.ProfileId = objTwitterAccount.TwitterUserId;
                    try
                    {
                        objTwitterEngagement.RetweetCount = item["retweet_count"].ToString().TrimStart('"').TrimEnd('"');
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                    }
                    try
                    {
                        objTwitterEngagement.ReplyCount = objTwitterMessageRepository.getReplyCountbyProfileId(objTwitterAccount.TwitterUserId, Guid.Parse(UserId)).ToString();
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                    }
                    try
                    {
                        objTwitterEngagement.Engagement = ((Int32.Parse(objTwitterEngagement.ReplyCount) + Int32.Parse(objTwitterEngagement.RetweetCount)) * 100 / (objTwitterAccount.FollowersCount)).ToString();
                    }
                    catch (Exception ex)
                    {
                        objTwitterEngagement.Engagement = "0".ToString();
                        Console.WriteLine(ex.StackTrace);
                    } try
                    {
                        objTwitterEngagement.Influence = (((tsttwtwmessagetweet.Count)) * 100 / (objTwitterAccount.FollowersCount)).ToString();
                    }
                    catch (Exception ex)
                    {
                        objTwitterEngagement.Influence = "0".ToString();
                        Console.WriteLine(ex.StackTrace);
                    }
                    objTwitterEngagementRepository.Add(objTwitterEngagement);

                }
            }
            #endregion
        }