Exemplo n.º 1
0
        public string MiniCalendar(Post post)
        {
            DateTime eventDate = post.GetEventDate();

            if (eventDate != DateTime.MinValue)
            {
                return(CalendarFunctions.BuildCalendar(false, eventDate.Year, eventDate.Month, post));
            }
            else
            {
                DateTime startDate = post.GetStartDate();
                DateTime endDate   = post.GetEndDate();

                StringBuilder sb    = new StringBuilder();
                int           year  = startDate.Year;
                int           month = startDate.Month;

                do
                {
                    sb.AppendLine(CalendarFunctions.BuildCalendar(false, year, month, post));
                    ++month;
                    if (month == 13)
                    {
                        month = 1;
                        ++year;
                    }
                } while (year < endDate.Year || (year >= endDate.Year && month < endDate.Month));

                return(sb.ToString());
            }
        }
Exemplo n.º 2
0
        private string MiniCalendar(int year, int month)
        {
            DateTime currentMonth = new DateTime(year, month, 1);

            string ret = CalendarFunctions.BuildCalendar(false, year, month, null);

            return(ret);
        }
        public override string RenderData()
        {
            int year  = 0;
            int month = 0;

            CalendarFunctions.GetMonth(ref year, ref month);

            DateTime currentMonth  = new DateTime(year, month, 1);
            DateTime previousMonth = currentMonth.AddMonths(-1);
            DateTime nextMonth     = currentMonth.AddMonths(1);

            string ret = String.Format("<a class=\"previousMonth\" href=\"?d={0}{1}\">{2}</a>", previousMonth.Year.ToString().PadLeft(4, '0'), previousMonth.Month.ToString().PadLeft(2, '0'), previousMonth.ToString("MMMM yyyy"));

            ret += String.Format("<a class=\"nextMonth\" href=\"?d={0}{1}\">{2}</a>", nextMonth.Year.ToString().PadLeft(4, '0'), nextMonth.Month.ToString().PadLeft(2, '0'), nextMonth.ToString("MMMM yyyy"));
            ret += CalendarFunctions.BuildCalendar(true, year, month, null);

            return(ret);
        }