Exemplo n.º 1
0
        public void getgrphData()
        {
            try
            {
                SocioBoard.Domain.User user = (User)Session["LoggedUser"];
                FacebookAccountRepository objfb = new FacebookAccountRepository();
                TwitterMessageRepository objtwttatsRepo = new TwitterMessageRepository();
                ArrayList alstfb = objfb.getFbMessageStatsHome(user.Id, 7);
                ArrayList alstTwt = objtwttatsRepo.gettwtMessageStatsHome(user.Id, 7);
                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 < 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();
                    }
                }
                else
                {
                    for (int i = 0; i < 7; i++)
                    {
                        strArray = strArray + "[0,0],";
                    }
                }
                strArray = strArray.Substring(0, strArray.Length - 1) + "]";

                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 < 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();
                    }
                }
                else
                {
                    for (int i = 0; i < 7; i++)
                    {
                        strSentArray = strSentArray + "[0,0],";
                    }
                }
                strSentArray = strSentArray.Substring(0, strSentArray.Length - 1) + "]";

            }
            catch (Exception Err)
            {
                Console.Write(Err.StackTrace);
                logger.Error(Err.StackTrace);
            }
        }