Esempio n. 1
0
        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 = "[";
                int _spanIncoming = 0;
                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();
                    _spanIncoming = (int.Parse(strTwtCnt) + int.Parse(strFbCnt));
                }
                spanIncoming.InnerHtml = _spanIncoming.ToString();
                strArray = strArray.Substring(0, strArray.Length - 1) + "]";

                ArrayList alstTwtFeed = objtwttatsRepo.gettwtFeedsStats(user.Id, days);
                ArrayList alstFBFeed  = objfb.getFbFeedsStats(user.Id, days);
                strSentArray = "[";
                int _spanSent = 0;
                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();
                        _spanSent = (int.Parse(strFbFeedCnt) + int.Parse(strTwtFeedCnt));
                    }
                    spanSent.InnerHtml = (_spanSent).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);
            }
        }