Ejemplo n.º 1
0
        public StatisticsArticle GetStatisticsArticleCount()
        {
            StatisticsArticle sa = new StatisticsArticle();

            sa.TotalArticles = Assistant.Count <Article>(null);
            sa.TotalComments = Assistant.Count <Comments>(null);

            int      year      = DateTime.Now.Year;
            int      month     = DateTime.Now.Month;
            DateTime thisMonth = Convert.ToDateTime(year.ToString() + "-" + month.ToString() + "-01");
            Criteria c         = new Criteria(CriteriaType.MoreThanEquals, "Created", thisMonth);

            sa.MonthArticles = Assistant.Count <Article>(c);
            sa.MonthComments = Assistant.Count <Comments>(c);

            DateTime currentTime = DateTime.Now;
            string   currentWeek = currentTime.DayOfWeek.ToString();
            int      dayCount    = DayInWeek(currentWeek);
            DateTime thisWeek    = Convert.ToDateTime(currentTime.ToShortDateString()).AddDays(-(dayCount - 1));

            c = new Criteria(CriteriaType.MoreThanEquals, "Created", thisWeek);

            sa.WeekArticles = Assistant.Count <Article>(c);
            sa.WeekComments = Assistant.Count <Comments>(c);

            return(sa);
        }
Ejemplo n.º 2
0
        private void BindCount()
        {
            VisiteCount vc = PageVisitorHelper.GetCurrentVisiteCount();

            LabelTotalVisitors.Text = vc.TotalPageView.ToString();
            TodayPVLabel.Text       = vc.DayPageview.ToString();

            StatisticsArticle sa = PageViewReportHelper.GetStatisticsArticleCount();

            LabelTotalArticles.Text = sa.TotalArticles.ToString();
            LabelTotalComments.Text = sa.TotalComments.ToString();
            LabelMonthArticles.Text = sa.MonthArticles.ToString();
            LabelMonthComments.Text = sa.MonthComments.ToString();
            LabelWeekArticles.Text  = sa.WeekArticles.ToString();
            LabelWeekComments.Text  = sa.WeekComments.ToString();
        }