Exemplo n.º 1
0
        void ArchiveMonthList_Load(object sender, EventArgs e)
        {
            DateTime[] daysWithEntries;
            _requestPage = this.Page as SharedBasePage;
            TimeZone timezone = null;

            if (_requestPage.SiteConfig.AdjustDisplayTimeZone)
            {
                timezone = _requestPage.SiteConfig.GetConfiguredTimeZone();
            }
            else
            {
                timezone = new newtelligence.DasBlog.Util.UTCTimeZone();
            }
            daysWithEntries = _requestPage.DataService.GetDaysWithEntries(timezone);

            _monthTable = new Dictionary <string, int>();
            _monthList  = new List <DateTime>();

            string languageFilter = Page.Request.Headers["Accept-Language"];

            foreach (DateTime date in daysWithEntries)
            {
                if (date <= DateTime.UtcNow)
                {
                    DateTime month    = new DateTime(date.Year, date.Month, 1, 0, 0, 0);
                    string   monthKey = month.ToString("MMMM, yyyy");
                    if (!_monthTable.ContainsKey(monthKey))
                    {
                        EntryCollection entries = _requestPage.DataService.GetEntriesForMonth(month, timezone, languageFilter);
                        if (entries != null)
                        {
                            _monthTable.Add(monthKey, entries.Count);
                            _monthList.Add(month);
                        }
                    }
                }
            }

            _monthList.Sort();
            _monthList.Reverse();
        }
Exemplo n.º 2
0
        void ArchiveMonthList_Load(object sender, EventArgs e)
        {
            DateTime[] daysWithEntries;
            _requestPage = this.Page as SharedBasePage;
            TimeZone timezone = null;
            if (_requestPage.SiteConfig.AdjustDisplayTimeZone)
            {
                timezone = _requestPage.SiteConfig.GetConfiguredTimeZone();
            }
            else
            {
                timezone = new newtelligence.DasBlog.Util.UTCTimeZone();
            }
            daysWithEntries = _requestPage.DataService.GetDaysWithEntries(timezone);

            _monthTable = new Dictionary<string, int>();
            _monthList = new List<DateTime>();

            string languageFilter = Page.Request.Headers["Accept-Language"];
            foreach (DateTime date in daysWithEntries)
            {
                if (date <= DateTime.UtcNow)
                {
                    DateTime month = new DateTime(date.Year, date.Month, 1, 0, 0, 0);
                    string monthKey = month.ToString("MMMM, yyyy");
                    if (!_monthTable.ContainsKey(monthKey))
                    {
                        EntryCollection entries = _requestPage.DataService.GetEntriesForMonth(month, timezone, languageFilter);
                        if (entries != null)
                        {
                            _monthTable.Add(monthKey, entries.Count);
                            _monthList.Add(month);
                        }
                    }
                }
            }

            _monthList.Sort();
            _monthList.Reverse();
        }