public void getgrphData(int days)
        {
            try
            {
                SocioBoard.Domain.User user = (User)Session["LoggedUser"];
                FacebookAccountRepository objfb = new FacebookAccountRepository();
                TwitterMessageRepository objtwttatsRepo = new TwitterMessageRepository();
                ArrayList alstfb = objfb.getFbMessageStats(user.Id,days);
                ArrayList alstTwt = objtwttatsRepo.gettwtMessageStats(user.Id, days);
                strArray = "[";

                    for (int i = 0; i < 7; i++)
                    {
                        string strTwtCnt = string.Empty;
                        string strFbCnt = string.Empty;
                        if (alstTwt.Count <= i)
                            strTwtCnt = "0";
                        else
                            strTwtCnt = alstTwt[i].ToString();
                        if (alstfb.Count <= i)
                            strFbCnt = "0";
                        else
                            strFbCnt = alstfb[i].ToString();
                        strArray = strArray + "[" + strFbCnt + "," + strTwtCnt + "],";
                        spanIncoming.InnerHtml = (int.Parse(strTwtCnt) + int.Parse(strFbCnt)).ToString();
                    }

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

                 ArrayList alstTwtFeed = objtwttatsRepo.gettwtFeedsStats(user.Id,days);
                ArrayList alstFBFeed = objfb.getFbFeedsStats(user.Id,days);
                strSentArray = "[";

                if (alstFBFeed.Count > 0 || alstTwtFeed.Count > 0)
                {
                    int alstSentCount = 0;
                    for (int i = 0; i < 7; i++)
                    {
                        string strTwtFeedCnt = string.Empty;
                        string strFbFeedCnt = string.Empty;
                        if (alstTwtFeed.Count <= i)
                            strTwtFeedCnt = "0";
                        else
                            strTwtFeedCnt = alstTwtFeed[i].ToString();
                        if (alstFBFeed.Count <= i)
                            strFbFeedCnt = "0";
                        else
                            strFbFeedCnt = alstFBFeed[i].ToString();
                        strSentArray = strSentArray + "[" + strFbFeedCnt + "," + strTwtFeedCnt + "],";
                        spanSent.InnerHtml = (int.Parse(strFbFeedCnt) + int.Parse(strTwtFeedCnt)).ToString();
                    }

                }
                if (alstFBFeed.Count == 0 || alstTwtFeed.Count == 0)
                {
                    for (int i = 0; i < 7; i++)
                    {
                        strSentArray += strSentArray + "[0,0],";
                    }
                }
                strSentArray = strSentArray.Substring(0, strSentArray.Length - 1) + "]";

                TwitterStatsRepository objtwtStatsRepo = new TwitterStatsRepository();
                ArrayList alstEng = objtwtStatsRepo.getAllTwitterStatsOfUser(user.Id,days);
                int ii = 1;
                strEng = "[";
                foreach (var item in alstEng)
                {
                    Array temp = (Array)item;
                    strEng = strEng + "{ x: new Date(2012, "+ ii +", "+ ii +"), y:" + temp.GetValue(7) + "},";
                    ii++;
                }
                if (alstEng.Count == 0)
                {
                    for (int i = 0; i < 10; i++)
                    {
                        strEng = strEng + "{ x: new Date(2012, " + ii + ", " + ii + "), y:0},";
                    }
                }
                strEng = strEng.Substring(0, strEng.Length - 1) + "]";

                hmsgsent.InnerHtml = alstTwtFeed.Count.ToString();
                hretweet.InnerHtml = objtwttatsRepo.getUserRetweetCount(user.Id).ToString();

            }
            catch (Exception Err)
            {
                Response.Write(Err.StackTrace);
            }
        }
Exemple #2
0
        public void getgrphData()
        {
            try
            {
                SocioBoard.Domain.User user = (User)Session["LoggedUser"];
                FacebookAccountRepository objfb = new FacebookAccountRepository();
                TwitterMessageRepository objtwttatsRepo = new TwitterMessageRepository();
                ArrayList alstfb = objfb.getFbMessageStats(user.Id,15);
                ArrayList alstTwt = objtwttatsRepo.gettwtMessageStats(user.Id, 15);
                strArray = "[";
                if (alstfb.Count > 0 && alstTwt.Count > 0)
                {
                    int alstCount = 0;
                    if (alstfb.Count < alstTwt.Count)
                        alstCount = alstfb.Count;
                    else
                        alstCount = alstTwt.Count;
                    for (int i = 0; i < alstCount; i++)
                    {
                        strArray = strArray + "[" + alstfb[i].ToString() + "," + alstTwt[i].ToString() + "]";
                    }
                }
                strArray += "]";

                ArrayList alstTwtFeed = objtwttatsRepo.gettwtFeedsStatsHome(user.Id,7);
                ArrayList alstFBFeed = objfb.getFbFeedsStatsHome(user.Id);
                strSentArray = "[";

                if (alstFBFeed.Count > 0 && alstTwtFeed.Count > 0)
                {
                    int alstSentCount = 0;
                    if (alstTwtFeed.Count < alstFBFeed.Count)
                        alstSentCount = alstTwtFeed.Count;
                    else
                        alstSentCount = alstFBFeed.Count;
                    for (int i = 0; i < alstSentCount; i++)
                    {
                        strSentArray = strSentArray + "[" + alstFBFeed[i].ToString() + "," + alstTwtFeed[i].ToString() + "]";
                    }
                }
                strSentArray += "]";
            }
            catch (Exception Err)
            {
                Console.Write(Err.StackTrace);
            }
        }