Exemplo n.º 1
0
 // Methods
 public void Clear(Calendar calendar)
 {
   if (this[calendar] != null)
   {
     this.Remove(calendar);
   }
 }
Exemplo n.º 2
0
        /// <summary>
        /// Checks that each day from the given start year to the end year (inclusive) is equal
        /// between the BCL and the Noda Time calendar. Additionally, the number of days in each month and year
        /// and the number of months (and leap year status) in each year is checked.
        /// </summary>
        internal static void AssertEquivalent(Calendar bcl, CalendarSystem noda, int fromYear, int toYear)
        {
            // We avoid asking the BCL to create a DateTime on each iteration, simply
            // because the BCL implementation is so slow. Instead, we just check at the start of each month that
            // we're at the date we expect.
            DateTime bclDate = bcl.ToDateTime(fromYear, 1, 1, 0, 0, 0, 0);
            for (int year = fromYear; year <= toYear; year++)
            {
                Assert.AreEqual(bcl.GetDaysInYear(year), noda.GetDaysInYear(year), "Year: {0}", year);
                Assert.AreEqual(bcl.GetMonthsInYear(year), noda.GetMonthsInYear(year), "Year: {0}", year);
                for (int month = 1; month <= noda.GetMonthsInYear(year); month++)
                {
                    // Sanity check at the start of each month. Even this is surprisingly slow.
                    // (These three tests make up about 20% of the total execution time for the test.)
                    Assert.AreEqual(year, bcl.GetYear(bclDate));
                    Assert.AreEqual(month, bcl.GetMonth(bclDate));
                    Assert.AreEqual(1, bcl.GetDayOfMonth(bclDate));

                    Assert.AreEqual(bcl.GetDaysInMonth(year, month), noda.GetDaysInMonth(year, month),
                        "Year: {0}; Month: {1}", year, month);
                    Assert.AreEqual(bcl.IsLeapYear(year), noda.IsLeapYear(year), "Year: {0}", year);
                    for (int day = 1; day <= noda.GetDaysInMonth(year, month); day++)
                    {
                        LocalDate nodaDate = new LocalDate(year, month, day, noda);
                        Assert.AreEqual(bclDate, nodaDate.ToDateTimeUnspecified(),
                            "Original calendar system date: {0:yyyy-MM-dd}", nodaDate);
                        Assert.AreEqual(nodaDate, LocalDate.FromDateTime(bclDate, noda));
                        Assert.AreEqual(year, nodaDate.Year);
                        Assert.AreEqual(month, nodaDate.Month);
                        Assert.AreEqual(day, nodaDate.Day);
                        bclDate = bclDate.AddDays(1);
                    }
                }
            }
        }
 public DateTimeFormatInfo()
 {
     // Construct an invariant culture DateTimeFormatInfo
     char[] comma = new char[] { ',' };
     this.isReadOnly = true;
     this.abbreviatedDayNames = "Sun,Mon,Tue,Wed,Thu,Fri,Sat".Split(comma);
     this.abbreviatedMonthGenitiveNames = "Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec,".Split(comma);
     this.abbreviatedMonthNames = "Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec,".Split(comma);
     this.amDesignator = "AM";
     this.calendarWeekRule = CalendarWeekRule.FirstDay;
     this.dateSeparator = "/";
     this.dayNames = "Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday".Split(comma);
     this.firstDayOfWeek = DayOfWeek.Sunday;
     this.fullDateTimePattern = "dddd, dd MMMM yyyy HH:mm:ss";
     this.longDatePattern = "dddd, dd MMMM yyyy";
     this.longTimePattern = "HH:mm:ss";
     this.monthDayPattern = "MMMM dd";
     this.monthGenitiveNames = "January,February,March,April,May,June,July,August,September,October,November,December,".Split(comma);
     this.monthNames = "January,February,March,April,May,June,July,August,September,October,November,December,".Split(comma);
     this.nativeCalendarName = "Gregorian Calendar";
     this.pmDesignator = "PM";
     this.rfc1123Pattern = "ddd, dd MMM yyyy HH':'mm':'ss 'GMT'";
     this.shortDatePattern = "MM/dd/yyyy";
     this.shortestDayNames = "Su,Mo,Tu,We,Th,Fr,Sa".Split(comma);
     this.shortTimePattern = "HH:mm";
     this.sortableDateTimePattern = "yyyy'-'MM'-'dd'T'HH':'mm':'ss";
     this.timeSeparator = ":";
     this.universalSortableDateTimePattern = "yyyy'-'MM'-'dd HH':'mm':'ss'Z'";
     this.yearMonthPattern = "yyyy MMMM";
     this.calendar = new GregorianCalendar();
 }
Exemplo n.º 4
0
      /// <summary>
      /// Gets the week of the year for the specified date, culture and calendar.
      /// </summary>
      /// <param name="info">The <see cref="CultureInfo"/> to use.</param>
      /// <param name="cal">The <see cref="Calendar"/> to use.</param>
      /// <param name="date">The date value to get the week of year for.</param>
      /// <returns>The week of the year.</returns>
      public static int GetWeekOfYear(CultureInfo info, Calendar cal, DateTime date)
      {
         CultureInfo ci = info ?? CultureInfo.CurrentUICulture;
         Calendar c = cal ?? ci.Calendar;

         return c.GetWeekOfYear(date, ci.DateTimeFormat.CalendarWeekRule, ci.DateTimeFormat.FirstDayOfWeek);
      }
Exemplo n.º 5
0
        /// <summary>
        /// Initializes a new instance of <see cref="Age"/>.
        /// </summary>
        /// <param name="start">The date and time when the age started.</param>
        /// <param name="end">The date and time when the age ended.</param>
        /// <param name="calendar">Calendar used to calculate age.</param>
        public Age(DateTime start, DateTime end, Calendar calendar)
        {
            if (start > end) throw new ArgumentException("The starting date cannot be later than the end date.");

            var startDate = start.Date;
            var endDate = end.Date;

            _years = _months = _days = 0;
            _days += calendar.GetDayOfMonth(endDate) - calendar.GetDayOfMonth(startDate);
            if (_days < 0)
            {
                _days += calendar.GetDaysInMonth(calendar.GetYear(startDate), calendar.GetMonth(startDate));
                _months--;
            }
            _months += calendar.GetMonth(endDate) - calendar.GetMonth(startDate);
            if (_months < 0)
            {
                _months += calendar.GetMonthsInYear(calendar.GetYear(startDate));
                _years--;
            }
            _years += calendar.GetYear(endDate) - calendar.GetYear(startDate);

            var ts = endDate.Subtract(startDate);
            _totalDays = (Int32)ts.TotalDays;
        }
Exemplo n.º 6
0
   public PersianCulture(string cultureName, bool useUserOverride)
      : base(cultureName, useUserOverride)
   {
      cal = base.OptionalCalendars[0];
      var optionalCalendars = new List<System.Globalization.Calendar>();
      optionalCalendars.AddRange(base.OptionalCalendars);
      optionalCalendars.Insert(0, new PersianCalendar());
      Type formatType = typeof(DateTimeFormatInfo);
      Type calendarType = typeof(System.Globalization.Calendar);
      PropertyInfo idProperty = calendarType.GetProperty("ID", BindingFlags.Instance | BindingFlags.NonPublic);
      FieldInfo optionalCalendarfield = formatType.GetField("optionalCalendars", BindingFlags.Instance | BindingFlags.NonPublic);
      var newOptionalCalendarIDs = new Int32[optionalCalendars.Count];

      for (int i = 0; i < newOptionalCalendarIDs.Length; i++)

         newOptionalCalendarIDs[i] = (Int32)idProperty.GetValue(optionalCalendars[i], null);
      optionalCalendarfield.SetValue(DateTimeFormat, newOptionalCalendarIDs);

      optionals = optionalCalendars.ToArray();

      cal = optionals[0];

      DateTimeFormat.Calendar = optionals[0];

      DateTimeFormat.MonthNames = new[] { "فروردین", "اردیبهشت", "خرداد", "تیر", "مرداد", "شهریور", "مهر", "آبان", "آذر", "دی", "بهمن", "اسفند", "" };
      DateTimeFormat.MonthGenitiveNames = new[] { "فروردین", "اردیبهشت", "خرداد", "تیر", "مرداد", "شهریور", "مهر", "آبان", "آذر", "دی", "بهمن", "اسفند", "" };
      DateTimeFormat.AbbreviatedMonthNames = new[] { "فروردین", "اردیبهشت", "خرداد", "تیر", "مرداد", "شهریور", "مهر", "آبان", "آذر", "دی", "بهمن", "اسفند", "" };
      DateTimeFormat.AbbreviatedMonthGenitiveNames = new[] { "فروردین", "اردیبهشت", "خرداد", "تیر", "مرداد", "شهریور", "مهر", "آبان", "آذر", "دی", "بهمن", "اسفند", "" };
      DateTimeFormat.AbbreviatedDayNames = new string[] { "ی", "د", "س", "چ", "پ", "ج", "ش" };
      DateTimeFormat.ShortestDayNames = new string[] { "ی", "د", "س", "چ", "پ", "ج", "ش" };
      DateTimeFormat.DayNames = new string[] { "یکشنبه", "دوشنبه", "ﺳﻪشنبه", "چهارشنبه", "پنجشنبه", "جمعه", "شنبه" };
      DateTimeFormat.AMDesignator = "ق.ظ";
      DateTimeFormat.PMDesignator = "ب.ظ";

   }
Exemplo n.º 7
0
 private void VerifyXamlValues(Calendar calendar)
 {
     Assert.IsTrue(CompareDates(calendar.SelectedDate.Value, new DateTime(2008, 4, 30)));
     Assert.IsTrue(CompareDates(calendar.DisplayDateStart.Value, new DateTime(2008, 4, 30)));
     Assert.IsTrue(CompareDates(calendar.DisplayDate, new DateTime(2008, 4, 30)));
     Assert.IsTrue(CompareDates(calendar.DisplayDateEnd.Value, new DateTime(2010, 4, 30)));
     _isLoaded = false;
 }
Exemplo n.º 8
0
 public DateTimeFormatter(string dateTimePattern, Calendar calendar)
     : this(dateTimePattern,
         calendar,
         Thread.CurrentThread.CurrentCulture.DateTimeFormat.AMDesignator,
         Thread.CurrentThread.CurrentCulture.DateTimeFormat.PMDesignator)
 {
     // Nothing.
 }
 private void ExecutePosTest(Calendar myCalendar, int year, int month, int day, int hour, int minute,
     int second, int millisecond, int era)
 {
     DateTime actualTime, expectedTime;
     expectedTime = new DateTime(year, month, day, hour, minute, second, millisecond);
     actualTime = myCalendar.ToDateTime(year, month, day, hour, minute, second, millisecond, era);
     Assert.Equal(expectedTime, actualTime);
 }
Exemplo n.º 10
0
 public static void ReadOnlyTest(Calendar calendar, int yearHasLeapMonth, CalendarAlgorithmType algorithmType)
 {
     Assert.False(calendar.IsReadOnly);
     var readOnlyCal = Calendar.ReadOnly(calendar);
     Assert.True(readOnlyCal.IsReadOnly, "expect readOnlyCal.IsReadOnly returns true");
     var colnedCal = (Calendar) readOnlyCal.Clone();
     Assert.False(colnedCal.IsReadOnly, "expect colnedCal.IsReadOnly returns false");
 }
Exemplo n.º 11
0
        /*=================================GetDefaultInstance==========================
        **Action: Internal method to provide a default intance of TaiwanCalendar.  Used by NLS+ implementation
        **       and other calendars.
        **Returns:
        **Arguments:
        **Exceptions:
        ============================================================================*/

        internal static Calendar GetDefaultInstance()
        {
            if (s_defaultInstance == null)
            {
                s_defaultInstance = new TaiwanCalendar();
            }
            return (s_defaultInstance);
        }
Exemplo n.º 12
0
 internal GregorianCalendarHelper(Calendar cal, EraInfo[] eraInfo)
 {
     this.m_Cal = cal;
     this.m_EraInfo = eraInfo;
     this.m_minDate = this.m_Cal.MinSupportedDateTime;
     this.m_maxYear = this.m_EraInfo[0].maxEraYear;
     this.m_minYear = this.m_EraInfo[0].minEraYear;
 }
        public MonthCalendarControl()
        {
            InitializeComponent();

            _DisplayMonth = _DisplayStartDate.Month;
            _DisplayYear = _DisplayStartDate.Year;
            _cultureInfo = new CultureInfo(CultureInfo.CurrentUICulture.LCID);
            sysCal = _cultureInfo.Calendar;
        }
        public MonthCalendarControl()
        {
            InitializeComponent();

            _displayMonth = _DisplayStartDate.Month;
            _displayYear = _DisplayStartDate.Year;
            sysCal = Thread.CurrentThread.CurrentUICulture.Calendar;

            BuildCalendarUi();
        }
Exemplo n.º 15
0
 // ----------------------------------------------------------------------
 public static TimeSpan Halfyear( Calendar calendar, int year, YearHalfyear yearHalfyear )
 {
     YearMonth[] halfyearMonths = TimeTool.GetMonthsOfHalfyear( yearHalfyear );
     TimeSpan duration = TimeSpec.NoDuration;
     foreach ( YearMonth halfyearMonth in halfyearMonths )
     {
         duration = duration.Add( Month( calendar, year, halfyearMonth ) );
     }
     return duration;
 }
        public PersianCulture(string cultureName, bool useUserOverride)
            : base(cultureName, useUserOverride)
        {
            //Temporary Value for cal.
            cal = base.OptionalCalendars[0];

            //populating new list of optional calendars.
            var optionalCalendars = new List<Calendar>();
            optionalCalendars.AddRange(base.OptionalCalendars);
            optionalCalendars.Insert(0, new PersianCalendar());


            Type formatType = typeof(DateTimeFormatInfo);
            Type calendarType = typeof(Calendar);


            PropertyInfo idProperty = calendarType.GetProperty("ID", BindingFlags.Instance | BindingFlags.NonPublic);
            FieldInfo optionalCalendarfield = formatType.GetField("optionalCalendars",
                                                                  BindingFlags.Instance | BindingFlags.NonPublic);

            //populating new list of optional calendar ids
            var newOptionalCalendarIDs = new Int32[optionalCalendars.Count];
            for (int i = 0; i < newOptionalCalendarIDs.Length; i++)
                newOptionalCalendarIDs[i] = (Int32)idProperty.GetValue(optionalCalendars[i], null);

            optionalCalendarfield.SetValue(DateTimeFormat, newOptionalCalendarIDs);

            optionals = optionalCalendars.ToArray();
            cal = optionals[0];
            DateTimeFormat.Calendar = optionals[0];

            DateTimeFormat.MonthNames = new[] { "فروردین", "اردیبهشت", "خرداد", "تیر", "مرداد", "شهریور", "مهر", "آبان", "آذر", "دی", "بهمن", "اسفند", "" };
            DateTimeFormat.MonthGenitiveNames = new[] { "فروردین", "اردیبهشت", "خرداد", "تیر", "مرداد", "شهریور", "مهر", "آبان", "آذر", "دی", "بهمن", "اسفند", "" };
            DateTimeFormat.AbbreviatedMonthNames = new[] { "فروردین", "اردیبهشت", "خرداد", "تیر", "مرداد", "شهریور", "مهر", "آبان", "آذر", "دی", "بهمن", "اسفند", "" };
            DateTimeFormat.AbbreviatedMonthGenitiveNames = new[] { "فروردین", "اردیبهشت", "خرداد", "تیر", "مرداد", "شهریور", "مهر", "آبان", "آذر", "دی", "بهمن", "اسفند", "" };


            DateTimeFormat.AbbreviatedDayNames = new string[] { "ی", "د", "س", "چ", "پ", "ج", "ش" };
            DateTimeFormat.ShortestDayNames = new string[] { "ی", "د", "س", "چ", "پ", "ج", "ش" };
            DateTimeFormat.DayNames = new string[] { "یکشنبه", "دوشنبه", "ﺳﻪشنبه", "چهارشنبه", "پنجشنبه", "جمعه", "شنبه" };

            DateTimeFormat.AMDesignator = "ق.ظ";
            DateTimeFormat.PMDesignator = "ب.ظ";


            //DateTimeFormat.ShortDatePattern = "yyyy/MM/dd";
            //DateTimeFormat.LongDatePattern = "yyyy/MM/dd";

            //DateTimeFormat.SetAllDateTimePatterns(new[] { "yyyy/MM/dd" }, 'd');
            //DateTimeFormat.SetAllDateTimePatterns(new[] { "dddd, dd MMMM yyyy" }, 'D');
            //DateTimeFormat.SetAllDateTimePatterns(new[] { "yyyy MMMM" }, 'y');
            //DateTimeFormat.SetAllDateTimePatterns(new[] { "yyyy MMMM" }, 'Y');


        }
Exemplo n.º 17
0
	public void FromDateTime(Calendar cal, DateTime time) {
		Date dmy = new Date();
		dmy.Day = cal.GetDayOfMonth(time);
		dmy.Month = cal.GetMonth(time);
		dmy.Year = cal.GetYear(time);
		dmy.Era = cal.GetEra(time);
		Day = dmy.Day;
		Month = dmy.Month;
		Year = dmy.Year;
		Era = dmy.Era;
	}
Exemplo n.º 18
0
 public void Clear(Calendar calendar, int field)
 {
   if (this[calendar] != null)
   {
     this.Remove(calendar);
   }
   else
   {
     this.Set(calendar, field, 0);
   }
 }
Exemplo n.º 19
0
 public static void GetLeapMonthTest(Calendar calendar, int yearHasLeapMonth, CalendarAlgorithmType algorithmType)
 {
     if (yearHasLeapMonth > 0)
     {
         Assert.NotEqual(calendar.GetLeapMonth(yearHasLeapMonth),  0);
         Assert.Equal(0, calendar.GetLeapMonth(yearHasLeapMonth - 1));
     }
     else
         Assert.True(calendar.GetLeapMonth(calendar.GetYear(DateTime.Today)) == 0, 
                     "calendar.GetLeapMonth returned wrong value");
 }
Exemplo n.º 20
0
        private static bool IsValidMonth( Calendar calendar, int year, int month, int era )
        {
            Contract.Requires( calendar != null );

            if ( month < 1 )
                return false;

            if ( year == calendar.MinSupportedDateTime.Year && month < calendar.MinSupportedDateTime.Month )
                return false;

            return month <= calendar.GetMonthsInYear( year, era );
        }
        public new void CreateSampleModels()
        {
            var calendar = new Calendar("CAL_0000");
            calendar.AddMetadata("a", new MetadataValue("A"));
            calendar.AddMetadata("b", new MetadataValue("B"));
            calendar.AddLocale(new CultureInfo("en"), new CalendarLocale {Name = "Calendar"});
            calendar.AddLocale(new CultureInfo("ko"), new CalendarLocale {Name = "달력"});
            Repository<Calendar>.SaveOrUpdate(calendar);

            var calendarRule = new CalendarRule(calendar, "테스트규칙");
            Repository<CalendarRule>.SaveOrUpdate(calendarRule);
        }
Exemplo n.º 22
0
 public TimelineCalendar(             
     string                                      cultureCalendar,
     TimelineCalendarType                        itemType,
     DateTime                                    minDateTime,
     DateTime                                    maxDateTime
 )
 {
     m_type = itemType;
     m_calendar = CalendarFromString(cultureCalendar);
     m_minDate = minDateTime;
     m_maxDate = maxDateTime;
 }
      /// <summary>
      /// Initializes a new instance of the <see cref="MonthCalendarFormatProvider"/> class.
      /// </summary>
      /// <param name="ci">The <see cref="CultureInfo"/> object to use.</param>
      /// <param name="cal">The calendar to use. If <c>null</c>, the calendar of the <paramref name="ci"/> is used.</param>
      /// <param name="rtlCulture">true if culture is right to left; otherwise false.</param>
      /// <exception cref="ArgumentNullException">If <paramref name="ci"/> is <c>null</c>.</exception>
      public MonthCalendarFormatProvider(CultureInfo ci, Calendar cal, bool rtlCulture)
      {
         if (ci == null)
         {
            throw new ArgumentNullException("ci", "parameter 'ci' cannot be null.");
         }

         this.DateTimeFormat = ci.DateTimeFormat;
         this.nfi = ci.NumberFormat;
         this.Calendar = cal;
         this.IsRTLLanguage = rtlCulture;
      }
Exemplo n.º 24
0
 public DateTime ToDateTime(Calendar calendar) {
     return new DateTime(
         _year > 0 ? _year : DateTime.MinValue.Year,
         _month > 0 ? _month : DateTime.MinValue.Month,
         _day > 0 ? _day : DateTime.MinValue.Day,
         DateTime.MinValue.Hour,
         DateTime.MinValue.Minute,
         DateTime.MinValue.Second,
         DateTime.MinValue.Millisecond,
         calendar
     );
 }
Exemplo n.º 25
0
 public DateTime ToDateTime(Calendar calendar) {
     return new DateTime(
         Date.Year > 0 ? Date.Year : DateTime.MinValue.Year,
         Date.Month > 0 ? Date.Month : DateTime.MinValue.Month,
         Date.Day > 0 ? Date.Day : DateTime.MinValue.Day,
         Time.Hour > 0 ? Time.Hour : DateTime.MinValue.Hour,
         Time.Minute > 0 ? Time.Minute : DateTime.MinValue.Minute,
         Time.Second > 0 ? Time.Second : DateTime.MinValue.Second,
         Time.Millisecond > 0 ? Time.Millisecond : DateTime.MinValue.Millisecond,
         calendar,
         Time.Kind
     );
 }
Exemplo n.º 26
0
        public static DateTime LastDayOfWeekInMonth( this DateTime date, DayOfWeek dayOfWeek, Calendar calendar )
        {
            Arg.NotNull( calendar, nameof( calendar ) );
            Contract.Ensures( Contract.Result<DateTime>().Month == Contract.OldValue( date.Month ) );
            Contract.Ensures( Contract.Result<DateTime>().Year == Contract.OldValue( date.Year ) );
            Contract.Ensures( Contract.Result<DateTime>().DayOfWeek == dayOfWeek );

            date = date.EndOfMonth( calendar );

            while ( date.DayOfWeek != dayOfWeek )
                date = date.AddDays( -1.0 );

            return date;
        }
Exemplo n.º 27
0
 // ----------------------------------------------------------------------
 public DateDiff( DateTime date1, DateTime date2, Calendar calendar,
     DayOfWeek firstDayOfWeek, YearMonth yearBaseMonth = TimeSpec.CalendarYearStartMonth)
 {
     if ( calendar == null )
     {
         throw new ArgumentNullException( "calendar" );
     }
     this.calendar = calendar;
     this.yearBaseMonth = yearBaseMonth;
     this.firstDayOfWeek = firstDayOfWeek;
     this.date1 = date1;
     this.date2 = date2;
     difference = date2.Subtract( date1 );
 }
Exemplo n.º 28
0
        public CalendarController()
            : base()
        {
            CurrentCalendar = new GregorianCalendar(GregorianCalendarTypes.Localized);
            MonthDays = new List<DateTime>();
            //Weeks = GetWeeks(UserDateTime.ToString());
            try
            {

            }
            catch (Exception e)
            {

            }
        }
        public void CalendarTestByUnitOfWork()
        {
            var calendar = new Calendar("CAL_0001");
            calendar.AddMetadata("a", new MetadataValue("A"));
            calendar.AddMetadata("b", new MetadataValue("B"));
            calendar.AddLocale(new CultureInfo("en"), new CalendarLocale {Name = "System Calendar"});
            calendar.AddLocale(new CultureInfo("ko"), new CalendarLocale {Name = "시스템달력"});

            Repository<Calendar>.SaveOrUpdate(calendar);
            UnitOfWork.Current.TransactionalFlush();
            UnitOfWork.Current.Clear();

            var loaded = Repository<Calendar>.Get(calendar.Id);
            Assert.AreEqual(calendar, loaded);

            loaded.LocaleMap.Count.Should().Be(2);
        }
Exemplo n.º 30
0
        public int Get(Calendar calendar, int field)
        {
          if (this[calendar] != null)
          {
            switch (field)
            {
              case 0:
                return ((CalendarProperties)this[calendar]).dateTime.Year;

              case 1:
                return (((CalendarProperties)this[calendar]).dateTime.Month - 1);

              case 2:
                return ((CalendarProperties)this[calendar]).dateTime.Day;

              case 3:
                {
                  var hour = ((CalendarProperties)this[calendar]).dateTime.Hour;
                  if (hour <= 12)
                  {
                    return hour;
                  }
                  return (hour - 12);
                }
              case 4:
                return ((CalendarProperties)this[calendar]).dateTime.Minute;

              case 5:
                return ((CalendarProperties)this[calendar]).dateTime.Second;

              case 6:
                return ((CalendarProperties)this[calendar]).dateTime.Millisecond;

              case 7:
                return ((CalendarProperties)this[calendar]).dateTime.Day;

              case 8:
                return ((CalendarProperties)this[calendar]).dateTime.Hour;
            }
            return 0;
          }
          CalendarProperties properties = new CalendarProperties {dateTime = DateTime.Now};
          this.Add(calendar, properties);
          return this.Get(calendar, field);
        }