Esempio n. 1
0
 public TestResult(ResourceType resourceType, CalendarProperties calendarProperties, AddressBookProperties addressBookProperties, AccessPrivileges accessPrivileges)
 {
     _resourceType          = resourceType;
     _calendarProperties    = calendarProperties;
     _addressBookProperties = addressBookProperties;
     _accessPrivileges      = accessPrivileges;
 }
Esempio n. 2
0
            /// <summary>
            /// Gets what the first day of the week is; e.g., Sunday in US, Monday in France.
            /// </summary>
            /// <param name="calendar">The calendar to get its first day of the week.</param>
            /// <returns>A System.DayOfWeek value indicating the first day of the week.</returns>
            public DayOfWeek GetFirstDayOfWeek(System.Globalization.Calendar calendar)
            {
                if (this[calendar] != null)
                {
                    if (((CalendarProperties)this[calendar]).dateTimeFormat == null)
                    {
                        ((CalendarProperties)this[calendar]).dateTimeFormat = new System.Globalization.DateTimeFormatInfo
                        {
                            FirstDayOfWeek = DayOfWeek.Sunday
                        };
                    }
                    return(((CalendarProperties)this[calendar]).dateTimeFormat.FirstDayOfWeek);
                }
                var tempProps = new CalendarProperties
                {
                    dateTime       = DateTime.Now,
                    dateTimeFormat = new System.Globalization.DateTimeFormatInfo
                    {
                        FirstDayOfWeek = DayOfWeek.Sunday
                    }
                };

                Add(calendar, tempProps);
                return(GetFirstDayOfWeek(calendar));
            }
 public TestResult(ResourceType resourceType, CalendarProperties calendarProperties, AddressBookProperties addressBookProperties, AccessPrivileges accessPrivileges, bool doesSupportWebDavCollectionSync)
 {
     _resourceType                    = resourceType;
     _calendarProperties              = calendarProperties;
     _addressBookProperties           = addressBookProperties;
     _accessPrivileges                = accessPrivileges;
     _doesSupportWebDavCollectionSync = doesSupportWebDavCollectionSync;
 }
Esempio n. 4
0
            /// <summary>
            /// Gets the value represented by the field specified.
            /// </summary>
            /// <param name="calendar">The calendar to get its date or time.</param>
            /// <param name="field">One of the field that composes a date/time.</param>
            /// <returns>The integer value for the field given.</returns>
            public int Get(System.Globalization.Calendar calendar, int field)
            {
                if (this[calendar] != null)
                {
                    int tempHour;
                    switch (field)
                    {
                    case CalendarManager.DATE:
                        return(((CalendarProperties)this[calendar]).dateTime.Day);

                    case CalendarManager.HOUR:
                        tempHour = ((CalendarProperties)this[calendar]).dateTime.Hour;
                        return(tempHour > 12 ? tempHour - 12 : tempHour);

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

                    case CalendarManager.MINUTE:
                        return(((CalendarProperties)this[calendar]).dateTime.Minute);

                    case CalendarManager.MONTH:
                        //Month value is 0-based. e.g., 0 for January
                        return(((CalendarProperties)this[calendar]).dateTime.Month - 1);

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

                    case CalendarManager.YEAR:
                        return(((CalendarProperties)this[calendar]).dateTime.Year);

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

                    case CalendarManager.DAY_OF_YEAR:
                        return((int)(((CalendarProperties)this[calendar]).dateTime.DayOfYear));

                    case CalendarManager.DAY_OF_WEEK:
                        return((int)(((CalendarProperties)this[calendar]).dateTime.DayOfWeek) + 1);

                    case CalendarManager.HOUR_OF_DAY:
                        return(((CalendarProperties)this[calendar]).dateTime.Hour);

                    case CalendarManager.AM_PM:
                        tempHour = ((CalendarProperties)this[calendar]).dateTime.Hour;
                        return(tempHour > 12 ? CalendarManager.PM : CalendarManager.AM);

                    default:
                        return(0);
                    }
                }
                else
                {
                    CalendarProperties tempProps = new CalendarProperties();
                    tempProps.dateTime = System.DateTime.Now;
                    this.Add(calendar, tempProps);
                    return(this.Get(calendar, field));
                }
            }
Esempio n. 5
0
            public void Set(Calendar calendar, int field, int fieldValue)
            {
                if (this[calendar] != null)
                {
                    DateTime tempDate = ((CalendarProperties)this[calendar]).dateTime;
                    switch (field)
                    {
                    case DATE:
                        tempDate = tempDate.AddDays(fieldValue - tempDate.Day);
                        break;

                    case HOUR:
                        tempDate = tempDate.AddHours(fieldValue - tempDate.Hour);
                        break;

                    case MILLISECOND:
                        tempDate = tempDate.AddMilliseconds(fieldValue - tempDate.Millisecond);
                        break;

                    case MINUTE:
                        tempDate = tempDate.AddMinutes(fieldValue - tempDate.Minute);
                        break;

                    case MONTH:
                        //Month value is 0-based. e.g., 0 for January
                        tempDate = tempDate.AddMonths(fieldValue - (tempDate.Month + 1));
                        break;

                    case SECOND:
                        tempDate = tempDate.AddSeconds(fieldValue - tempDate.Second);
                        break;

                    case YEAR:
                        tempDate = tempDate.AddYears(fieldValue - tempDate.Year);
                        break;

                    case DAY_OF_MONTH:
                        tempDate = tempDate.AddDays(fieldValue - tempDate.Day);
                        break;

                    case HOUR_OF_DAY:
                        tempDate = tempDate.AddHours(fieldValue - tempDate.Hour);
                        break;

                    default:
                        break;
                    }
                    ((CalendarProperties)this[calendar]).dateTime = tempDate;
                }
                else
                {
                    CalendarProperties tempProps = new CalendarProperties();
                    tempProps.dateTime = DateTime.Now;
                    Add(calendar, tempProps);
                    Set(calendar, field, fieldValue);
                }
            }
Esempio n. 6
0
            /// <summary>
            /// Gets the value represented by the field specified.
            /// </summary>
            /// <param name="calendar">The calendar to get its date or time.</param>
            /// <param name="field">One of the field that composes a date/time.</param>
            /// <returns>The integer value for the field given.</returns>
            public int Get(System.Globalization.Calendar calendar, int field)
            {
                if (this[calendar] != null)
                {
                    int tempHour;
                    switch (field)
                    {
                    case DATE:
                        return(((CalendarProperties)this[calendar]).dateTime.Day);

                    case HOUR:
                        tempHour = ((CalendarProperties)this[calendar]).dateTime.Hour;
                        return(tempHour > 12 ? tempHour - 12 : tempHour);

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

                    case MINUTE:
                        return(((CalendarProperties)this[calendar]).dateTime.Minute);

                    case MONTH:
                        //Month value is 0-based. e.g., 0 for January
                        return(((CalendarProperties)this[calendar]).dateTime.Month - 1);

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

                    case YEAR:
                        return(((CalendarProperties)this[calendar]).dateTime.Year);

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

                    case DAY_OF_YEAR:
                        return(((CalendarProperties)this[calendar]).dateTime.DayOfYear);

                    case DAY_OF_WEEK:
                        return((int)(((CalendarProperties)this[calendar]).dateTime.DayOfWeek) + 1);

                    case HOUR_OF_DAY:
                        return(((CalendarProperties)this[calendar]).dateTime.Hour);

                    case AM_PM:
                        tempHour = ((CalendarProperties)this[calendar]).dateTime.Hour;
                        return(tempHour > 12 ? PM : AM);

                    default:
                        return(0);
                    }
                }
                var tempProps = new CalendarProperties {
                    dateTime = DateTime.Now
                };

                Add(calendar, tempProps);
                return(Get(calendar, field));
            }
Esempio n. 7
0
 public void SetDateTime(Calendar calendar, DateTime date)
 {
     if (this[calendar] != null)
     {
         ((CalendarProperties)this[calendar]).dateTime = date;
     }
     else
     {
         CalendarProperties tempProps = new CalendarProperties();
         tempProps.dateTime = date;
         Add(calendar, tempProps);
     }
 }
Esempio n. 8
0
 public void SetTimeInMilliseconds(System.Globalization.Calendar calendar, long milliseconds)
 {
     if (this[calendar] != null)
     {
         ((CalendarProperties)this[calendar]).dateTime = new System.DateTime(milliseconds);
     }
     else
     {
         CalendarProperties tempProps = new CalendarProperties();
         tempProps.dateTime = new System.DateTime(System.TimeSpan.TicksPerMillisecond * milliseconds);
         this.Add(calendar, tempProps);
     }
 }
Esempio n. 9
0
            /// <summary>
            /// Gets the calendar current date and time.
            /// </summary>
            /// <param name="calendar">The calendar to get its current date and time.</param>
            /// <returns>A System.DateTime value that indicates the current date and time for the
            /// calendar given.</returns>
            public DateTime GetDateTime(System.Globalization.Calendar calendar)
            {
                if (this[calendar] != null)
                {
                    return(((CalendarProperties)this[calendar]).dateTime);
                }
                var tempProps = new CalendarProperties {
                    dateTime = DateTime.Now
                };

                Add(calendar, tempProps);
                return(GetDateTime(calendar));
            }
Esempio n. 10
0
 public void SetDateTime(System.Globalization.Calendar calendar, System.DateTime date)
 {
     if (this[calendar] != null)
     {
         ((CalendarProperties)this[calendar]).dateTime = date;
     }
     else
     {
         CalendarProperties tempProps = new CalendarProperties();
         tempProps.dateTime = date;
         this.Add(calendar, tempProps);
     }
 }
Esempio n. 11
0
 public DateTime GetDateTime(Calendar calendar)
 {
     if (this[calendar] != null)
     {
         return(((CalendarProperties)this[calendar]).dateTime);
     }
     else
     {
         CalendarProperties tempProps = new CalendarProperties();
         tempProps.dateTime = DateTime.Now;
         Add(calendar, tempProps);
         return(GetDateTime(calendar));
     }
 }
Esempio n. 12
0
 public System.DateTime GetDateTime(System.Globalization.Calendar calendar)
 {
     if (this[calendar] != null)
     {
         return(((CalendarProperties)this[calendar]).dateTime);
     }
     else
     {
         CalendarProperties tempProps = new CalendarProperties();
         tempProps.dateTime = System.DateTime.Now;
         this.Add(calendar, tempProps);
         return(this.GetDateTime(calendar));
     }
 }
Esempio n. 13
0
 public System.DayOfWeek GetFirstDayOfWeek(System.Globalization.Calendar calendar)
 {
     if (this[calendar] != null && ((CalendarProperties)this[calendar]).dateTimeFormat != null)
     {
         return(((CalendarProperties)this[calendar]).dateTimeFormat.FirstDayOfWeek);
     }
     else
     {
         CalendarProperties tempProps = new CalendarProperties();
         tempProps.dateTimeFormat = System.Globalization.DateTimeFormatInfo.CurrentInfo;
         this.Add(calendar, tempProps);
         return(this.GetFirstDayOfWeek(calendar));
     }
 }
Esempio n. 14
0
 public void SetFirstDayOfWeek(System.Globalization.Calendar calendar, System.DayOfWeek firstDayOfWeek)
 {
     if (this[calendar] != null && ((CalendarProperties)this[calendar]).dateTimeFormat != null)
     {
         ((CalendarProperties)this[calendar]).dateTimeFormat.FirstDayOfWeek = firstDayOfWeek;
     }
     else
     {
         CalendarProperties tempProps = new CalendarProperties();
         tempProps.dateTimeFormat = System.Globalization.DateTimeFormatInfo.CurrentInfo;
         this.Add(calendar, tempProps);
         this.SetFirstDayOfWeek(calendar, firstDayOfWeek);
     }
 }
Esempio n. 15
0
 public void SetFirstDayOfWeek(Calendar calendar, DayOfWeek firstDayOfWeek)
 {
     if (this[calendar] != null && ((CalendarProperties)this[calendar]).dateTimeFormat != null)
     {
         ((CalendarProperties)this[calendar]).dateTimeFormat.FirstDayOfWeek = firstDayOfWeek;
     }
     else
     {
         CalendarProperties tempProps = new CalendarProperties();
         tempProps.dateTimeFormat = new DateTimeFormatInfo();
         Add(calendar, tempProps);
         SetFirstDayOfWeek(calendar, firstDayOfWeek);
     }
 }
Esempio n. 16
0
 /// <summary>
 /// Sets the specified System.DateTime value to the specified calendar.
 /// </summary>
 /// <param name="calendar">The calendar to set its date.</param>
 /// <param name="date">The System.DateTime value to set to the calendar.</param>
 public void SetDateTime(System.Globalization.Calendar calendar, DateTime date)
 {
     if (this[calendar] != null)
     {
         ((CalendarProperties)this[calendar]).dateTime = date;
     }
     else
     {
         var tempProps = new CalendarProperties {
             dateTime = date
         };
         Add(calendar, tempProps);
     }
 }
Esempio n. 17
0
            public void Set(System.Globalization.Calendar calendar, int field, int fieldValue)
            {
                if (this[calendar] != null)
                {
                    System.DateTime tempDate = ((CalendarProperties)this[calendar]).dateTime;
                    switch (field)
                    {
                    case CalendarManager.DATE:
                        tempDate = tempDate.AddDays(fieldValue - tempDate.Year);
                        break;

                    case CalendarManager.HOUR:
                        tempDate = tempDate.AddHours(fieldValue - tempDate.Hour);
                        break;

                    case CalendarManager.MILLISECOND:
                        tempDate = tempDate.AddMilliseconds(fieldValue - tempDate.Millisecond);
                        break;

                    case CalendarManager.MINUTE:
                        tempDate = tempDate.AddMinutes(fieldValue - tempDate.Minute);
                        break;

                    case CalendarManager.MONTH:
                        //In java.util.Calendar, Month value is 0-based. e.g., 0 for January
                        tempDate = tempDate.AddMonths(fieldValue - (tempDate.Month + 1));
                        break;

                    case CalendarManager.SECOND:
                        tempDate = tempDate.AddSeconds(fieldValue - tempDate.Second);
                        break;

                    case CalendarManager.YEAR:
                        tempDate = tempDate.AddYears(fieldValue - tempDate.Year);
                        break;

                    default:
                        break;
                    }
                    ((CalendarProperties)this[calendar]).dateTime = tempDate;
                }
                else
                {
                    CalendarProperties tempProps = new CalendarProperties();
                    tempProps.dateTime = System.DateTime.Now;
                    this.Add(calendar, tempProps);
                    this.Set(calendar, field, fieldValue);
                }
            }
Esempio n. 18
0
 public DayOfWeek GetFirstDayOfWeek(Calendar calendar)
 {
     if (this[calendar] != null && ((CalendarProperties)this[calendar]).dateTimeFormat != null)
     {
         return(((CalendarProperties)this[calendar]).dateTimeFormat.FirstDayOfWeek);
     }
     else
     {
         CalendarProperties tempProps = new CalendarProperties();
         tempProps.dateTimeFormat = new DateTimeFormatInfo();
         tempProps.dateTimeFormat.FirstDayOfWeek = DayOfWeek.Sunday;
         Add(calendar, tempProps);
         return(GetFirstDayOfWeek(calendar));
     }
 }
Esempio n. 19
0
 /// <summary>
 /// Sets the corresponding date (day, month and year) to the calendar specified.
 /// If the calendar does not exist in the hash table, it creates a new instance and sets
 /// its values.
 /// </summary>
 /// <param name="calendar">The calendar to set its date.</param>
 /// <param name="year">Integer value that represent the year.</param>
 /// <param name="month">Integer value that represent the month.</param>
 /// <param name="day">Integer value that represent the day.</param>
 public void Set(System.Globalization.Calendar calendar, int year, int month, int day)
 {
     if (this[calendar] != null)
     {
         this.Set(calendar, CalendarManager.YEAR, year);
         this.Set(calendar, CalendarManager.MONTH, month);
         this.Set(calendar, CalendarManager.DATE, day);
     }
     else
     {
         CalendarProperties tempProps = new CalendarProperties();
         tempProps.dateTime = System.DateTime.Now;
         this.Add(calendar, tempProps);
         this.Set(calendar, year, month, day);
     }
 }
Esempio n. 20
0
 public void Set(Calendar calendar, int year, int month, int day)
 {
     if (this[calendar] != null)
     {
         Set(calendar, YEAR, year);
         Set(calendar, MONTH, month);
         Set(calendar, DATE, day);
     }
     else
     {
         CalendarProperties tempProps = new CalendarProperties();
         //Month value is 0-based. e.g., 0 for January
         tempProps.dateTime = new DateTime(year, month + 1, day);
         Add(calendar, tempProps);
     }
 }
Esempio n. 21
0
 public void Set(System.Globalization.Calendar calendar, int year, int month, int day)
 {
     if (this[calendar] != null)
     {
         this.Set(calendar, CalendarManager.YEAR, year);
         this.Set(calendar, CalendarManager.MONTH, month);
         this.Set(calendar, CalendarManager.DATE, day);
     }
     else
     {
         CalendarProperties tempProps = new CalendarProperties();
         //In java.util.Calendar, Month value is 0-based. e.g., 0 for January
         tempProps.dateTime = new System.DateTime(year, month + 1, day);
         this.Add(calendar, tempProps);
     }
 }
Esempio n. 22
0
            public int Get(Calendar calendar, int field)
            {
                if (this[calendar] != null)
                {
                    switch (field)
                    {
                    case DATE:
                        return(((CalendarProperties)this[calendar]).dateTime.Day);

                    case HOUR:
                        int tempHour = ((CalendarProperties)this[calendar]).dateTime.Hour;
                        return(tempHour > 12 ? tempHour - 12 : tempHour);

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

                    case MINUTE:
                        return(((CalendarProperties)this[calendar]).dateTime.Minute);

                    case MONTH:
                        //Month value is 0-based. e.g., 0 for January
                        return(((CalendarProperties)this[calendar]).dateTime.Month - 1);

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

                    case YEAR:
                        return(((CalendarProperties)this[calendar]).dateTime.Year);

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

                    case HOUR_OF_DAY:
                        return(((CalendarProperties)this[calendar]).dateTime.Hour);

                    default:
                        return(0);
                    }
                }
                else
                {
                    CalendarProperties tempProps = new CalendarProperties();
                    tempProps.dateTime = DateTime.Now;
                    Add(calendar, tempProps);
                    return(Get(calendar, field));
                }
            }
Esempio n. 23
0
 /// <summary>
 /// Sets the corresponding date (day, month and year) to the calendar specified.
 /// If the calendar does not exist in the hash table, it creates a new instance and sets
 /// its values.
 /// </summary>
 /// <param name="calendar">The calendar to set its date.</param>
 /// <param name="year">Integer value that represent the year.</param>
 /// <param name="month">Integer value that represent the month.</param>
 /// <param name="day">Integer value that represent the day.</param>
 public void Set(System.Globalization.Calendar calendar, int year, int month, int day)
 {
     if (this[calendar] != null)
     {
         Set(calendar, YEAR, year);
         Set(calendar, MONTH, month);
         Set(calendar, DATE, day);
     }
     else
     {
         var tempProps = new CalendarProperties {
             dateTime = DateTime.Now
         };
         Add(calendar, tempProps);
         Set(calendar, year, month, day);
     }
 }
Esempio n. 24
0
 /// <summary>
 /// Sets the corresponding date (day, month and year) and hour (hour, minute and second)
 /// to the calendar specified.
 /// If the calendar does not exist in the hash table, it creates a new instance and sets
 /// its values.
 /// </summary>
 /// <param name="calendar">The calendar to set its date and time.</param>
 /// <param name="year">Integer value that represent the year.</param>
 /// <param name="month">Integer value that represent the month.</param>
 /// <param name="day">Integer value that represent the day.</param>
 /// <param name="hour">Integer value that represent the hour.</param>
 /// <param name="minute">Integer value that represent the minutes.</param>
 /// <param name="second">Integer value that represent the seconds.</param>
 public void Set(System.Globalization.Calendar calendar, int year, int month, int day, int hour, int minute, int second)
 {
     if (this[calendar] != null)
     {
         this.Set(calendar, CalendarManager.YEAR, year);
         this.Set(calendar, CalendarManager.MONTH, month);
         this.Set(calendar, CalendarManager.DATE, day);
         this.Set(calendar, CalendarManager.HOUR, hour);
         this.Set(calendar, CalendarManager.MINUTE, minute);
         this.Set(calendar, CalendarManager.SECOND, second);
     }
     else
     {
         CalendarProperties tempProps = new CalendarProperties();
         tempProps.dateTime = System.DateTime.Now;
         this.Add(calendar, tempProps);
         this.Set(calendar, year, month, day, hour, minute, second);
     }
 }
Esempio n. 25
0
 public void Set(Calendar calendar, int year, int month, int day, int hour, int minute, int second)
 {
     if (this[calendar] != null)
     {
         Set(calendar, YEAR, year);
         Set(calendar, MONTH, month);
         Set(calendar, DATE, day);
         Set(calendar, HOUR, hour);
         Set(calendar, MINUTE, minute);
         Set(calendar, SECOND, second);
     }
     else
     {
         CalendarProperties tempProps = new CalendarProperties();
         //Month value is 0-based. e.g., 0 for January
         tempProps.dateTime = new DateTime(year, month + 1, day, hour, minute, second);
         Add(calendar, tempProps);
     }
 }
Esempio n. 26
0
 /// <summary>
 /// Sets the corresponding date (day, month and year) and hour (hour, minute and second)
 /// to the calendar specified.
 /// If the calendar does not exist in the hash table, it creates a new instance and sets
 /// its values.
 /// </summary>
 /// <param name="calendar">The calendar to set its date and time.</param>
 /// <param name="year">Integer value that represent the year.</param>
 /// <param name="month">Integer value that represent the month.</param>
 /// <param name="day">Integer value that represent the day.</param>
 /// <param name="hour">Integer value that represent the hour.</param>
 /// <param name="minute">Integer value that represent the minutes.</param>
 /// <param name="second">Integer value that represent the seconds.</param>
 public void Set(System.Globalization.Calendar calendar, int year, int month, int day, int hour, int minute, int second)
 {
     if (this[calendar] != null)
     {
         Set(calendar, YEAR, year);
         Set(calendar, MONTH, month);
         Set(calendar, DATE, day);
         Set(calendar, HOUR, hour);
         Set(calendar, MINUTE, minute);
         Set(calendar, SECOND, second);
     }
     else
     {
         var tempProps = new CalendarProperties {
             dateTime = DateTime.Now
         };
         Add(calendar, tempProps);
         Set(calendar, year, month, day, hour, minute, second);
     }
 }
Esempio n. 27
0
 /// <summary>
 /// Gets what the first day of the week is; e.g., Sunday in US, Monday in France.
 /// </summary>
 /// <param name="calendar">The calendar to get its first day of the week.</param>
 /// <returns>A System.DayOfWeek value indicating the first day of the week.</returns>
 public System.DayOfWeek GetFirstDayOfWeek(System.Globalization.Calendar calendar)
 {
     if (this[calendar] != null)
     {
         if (((CalendarProperties)this[calendar]).dateTimeFormat == null)
         {
             ((CalendarProperties)this[calendar]).dateTimeFormat = new System.Globalization.DateTimeFormatInfo();
             ((CalendarProperties)this[calendar]).dateTimeFormat.FirstDayOfWeek = System.DayOfWeek.Sunday;
         }
         return(((CalendarProperties)this[calendar]).dateTimeFormat.FirstDayOfWeek);
     }
     else
     {
         CalendarProperties tempProps = new CalendarProperties();
         tempProps.dateTime       = System.DateTime.Now;
         tempProps.dateTimeFormat = new System.Globalization.DateTimeFormatInfo();
         tempProps.dateTimeFormat.FirstDayOfWeek = System.DayOfWeek.Sunday;
         this.Add(calendar, tempProps);
         return(this.GetFirstDayOfWeek(calendar));
     }
 }
Esempio n. 28
0
            public int  Get(System.Globalization.Calendar calendar, int field)
            {
                if (this[calendar] != null)
                {
                    switch (field)
                    {
                    case CalendarManager.DATE:
                        return(((CalendarProperties)this[calendar]).dateTime.Day);

                    case CalendarManager.HOUR:
                        return(((CalendarProperties)this[calendar]).dateTime.Hour);

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

                    case CalendarManager.MINUTE:
                        return(((CalendarProperties)this[calendar]).dateTime.Minute);

                    case CalendarManager.MONTH:
                        //In java.util.Calendar, Month value is 0-based. e.g., 0 for January
                        return(((CalendarProperties)this[calendar]).dateTime.Month - 1);

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

                    case CalendarManager.YEAR:
                        return(((CalendarProperties)this[calendar]).dateTime.Year);

                    default:
                        return(0);
                    }
                }
                else
                {
                    CalendarProperties tempProps = new CalendarProperties();
                    tempProps.dateTime = System.DateTime.Now;
                    this.Add(calendar, tempProps);
                    return(this.Get(calendar, field));
                }
            }
Esempio n. 29
0
            /// <summary>
            /// Sets what the first day of the week is; e.g., Sunday in US, Monday in France.
            /// </summary>
            /// <param name="calendar">The calendar to set its first day of the week.</param>
            /// <param name="firstDayOfWeek">A System.DayOfWeek value indicating the first day of the week
            /// to be set.</param>
            public void SetFirstDayOfWeek(System.Globalization.Calendar calendar, DayOfWeek firstDayOfWeek)
            {
                if (this[calendar] != null)
                {
                    if (((CalendarProperties)this[calendar]).dateTimeFormat == null)
                    {
                        ((CalendarProperties)this[calendar]).dateTimeFormat = new System.Globalization.DateTimeFormatInfo();
                    }

                    ((CalendarProperties)this[calendar]).dateTimeFormat.FirstDayOfWeek = firstDayOfWeek;
                }
                else
                {
                    var tempProps = new CalendarProperties
                    {
                        dateTime       = DateTime.Now,
                        dateTimeFormat = new System.Globalization.DateTimeFormatInfo()
                    };
                    Add(calendar, tempProps);
                    SetFirstDayOfWeek(calendar, firstDayOfWeek);
                }
            }
Esempio n. 30
0
 public System.DayOfWeek GetFirstDayOfWeek(System.Globalization.Calendar calendar)
 {
     if (this[calendar] != null && ((CalendarProperties)this[calendar]).dateTimeFormat != null) {
     return ((CalendarProperties) this[calendar]).dateTimeFormat.FirstDayOfWeek;
     } else {
     CalendarProperties tempProps = new CalendarProperties();
     tempProps.dateTimeFormat = System.Globalization.DateTimeFormatInfo.CurrentInfo;
     this.Add(calendar, tempProps);
     return this.GetFirstDayOfWeek(calendar);
     }
 }
Esempio n. 31
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);
        }
Esempio n. 32
0
 public DateTime GetDateTime(Calendar calendar)
 {
   if (this[calendar] != null)
   {
     return ((CalendarProperties)this[calendar]).dateTime;
   }
   CalendarProperties properties = new CalendarProperties();
   properties.dateTime = DateTime.Now;
   this.Add(calendar, properties);
   return this.GetDateTime(calendar);
 }
Esempio n. 33
0
				/// <summary>
				/// Sets the corresponding date (day, month and year) and hour (hour, minute and second) 
				/// to the calendar specified.
				/// If the calendar does not exist in the hash table, it creates a new instance and sets 
				/// its values.
				/// </summary>
				/// <param name="calendar">The calendar to set its date and time.</param>
				/// <param name="year">Integer value that represent the year.</param>
				/// <param name="month">Integer value that represent the month.</param>
				/// <param name="day">Integer value that represent the day.</param>
				/// <param name="hour">Integer value that represent the hour.</param>
				/// <param name="minute">Integer value that represent the minutes.</param>
				/// <param name="second">Integer value that represent the seconds.</param>
				public void Set(Calendar calendar, int year, int month, int day, int hour, int minute, int second)
				{
					if (this[calendar] != null)
					{
						Set(calendar, YEAR, year);
						Set(calendar, MONTH, month);
						Set(calendar, DATE, day);
						Set(calendar, HOUR, hour);
						Set(calendar, MINUTE, minute);
						Set(calendar, SECOND, second);
					}
					else
					{
						CalendarProperties tempProps = new CalendarProperties();
						tempProps.dateTime = DateTime.Now;
						Add(calendar, tempProps);
						Set(calendar, year, month, day, hour, minute, second);
					}
				}
Esempio n. 34
0
 public void Set(Calendar calendar, int year, int month, int day, int hour, int minute, int second)
 {
   if (this[calendar] != null)
   {
     this.Set(calendar, 0, year);
     this.Set(calendar, 1, month);
     this.Set(calendar, 2, day);
     this.Set(calendar, 3, hour);
     this.Set(calendar, 4, minute);
     this.Set(calendar, 5, second);
   }
   else
   {
     CalendarProperties properties = new CalendarProperties();
     properties.dateTime = new DateTime(year, month + 1, day, hour, minute, second);
     this.Add(calendar, properties);
   }
 }
Esempio n. 35
0
        public void Set(Calendar calendar, int field, int fieldValue)
        {
          if (this[calendar] == null)
          {
            CalendarProperties properties = new CalendarProperties();
            properties.dateTime = DateTime.Now;
            this.Add(calendar, properties);
            this.Set(calendar, field, fieldValue);
          }
          else
          {
            DateTime dateTime = ((CalendarProperties)this[calendar]).dateTime;
            switch (field)
            {
              case 0:
                dateTime = dateTime.AddYears(fieldValue - dateTime.Year);
                break;

              case 1:
                dateTime = dateTime.AddMonths(fieldValue - (dateTime.Month + 1));
                break;

              case 2:
                dateTime = dateTime.AddDays((double)(fieldValue - dateTime.Day));
                break;

              case 3:
                dateTime = dateTime.AddHours((double)(fieldValue - dateTime.Hour));
                break;

              case 4:
                dateTime = dateTime.AddMinutes((double)(fieldValue - dateTime.Minute));
                break;

              case 5:
                dateTime = dateTime.AddSeconds((double)(fieldValue - dateTime.Second));
                break;

              case 6:
                dateTime = dateTime.AddMilliseconds((double)(fieldValue - dateTime.Millisecond));
                break;

              case 7:
                dateTime = dateTime.AddDays((double)(fieldValue - dateTime.Day));
                break;

              case 8:
                dateTime = dateTime.AddHours((double)(fieldValue - dateTime.Hour));
                break;
            }
            ((CalendarProperties)this[calendar]).dateTime = dateTime;
          }
        }
Esempio n. 36
0
 /// <summary>
 /// Sets the corresponding date (day, month and year) and hour (hour, minute and second)
 /// to the calendar specified.
 /// If the calendar does not exist in the hash table, it creates a new instance and sets
 /// its values.
 /// </summary>
 /// <param name="calendar">The calendar to set its date and time.</param>
 /// <param name="year">Integer value that represent the year.</param>
 /// <param name="month">Integer value that represent the month.</param>
 /// <param name="day">Integer value that represent the day.</param>
 /// <param name="hour">Integer value that represent the hour.</param>
 /// <param name="minute">Integer value that represent the minutes.</param>
 /// <param name="second">Integer value that represent the seconds.</param>
 public void Set( Calendar calendar, int year, int month, int day, int hour, int minute, int second )
 {
   if ( this[calendar] != null )
   {
     this.Set( calendar, CalendarManager.YEAR, year );
     this.Set( calendar, CalendarManager.MONTH, month );
     this.Set( calendar, CalendarManager.DATE, day );
     this.Set( calendar, CalendarManager.HOUR, hour );
     this.Set( calendar, CalendarManager.MINUTE, minute );
     this.Set( calendar, CalendarManager.SECOND, second );
   }
   else
   {
     CalendarProperties tempProps = new CalendarProperties();
     //Month value is 0-based. e.g., 0 for January
     tempProps.dateTime = new DateTime( year, month + 1, day, hour, minute, second );
     this.Add( calendar, tempProps );
   }
 }
Esempio n. 37
0
                /// <summary>
                /// Sets what the first day of the week is; e.g., Sunday in US, Monday in France.
                /// </summary>
                /// <param gridTemplateName="calendar">The calendar to set its first day of the week.</param>
                /// <param gridTemplateName="firstDayOfWeek">A System.DayOfWeek value indicating the first day of the week
                /// to be set.</param>
                public void SetFirstDayOfWeek(System.Globalization.Calendar calendar, System.DayOfWeek  firstDayOfWeek)
                {
                    if (this[calendar] != null)
                    {
                    if (((CalendarProperties)this[calendar]).dateTimeFormat == null)
                        ((CalendarProperties)this[calendar]).dateTimeFormat = new System.Globalization.DateTimeFormatInfo();

                    ((CalendarProperties) this[calendar]).dateTimeFormat.FirstDayOfWeek = firstDayOfWeek;
                    }
                    else
                    {
                    CalendarProperties tempProps = new CalendarProperties();
                    tempProps.dateTime = System.DateTime.Now;
                    tempProps.dateTimeFormat = new System.Globalization.DateTimeFormatInfo();
                    this.Add(calendar, tempProps);
                    this.SetFirstDayOfWeek(calendar, firstDayOfWeek);
                    }
                }
Esempio n. 38
0
            public int Get(Calendar calendar, int field)
            {
                if (this[calendar] != null)
                {
                    switch (field)
                    {
                        case DATE:
                            return ((CalendarProperties) this[calendar]).dateTime.Day;
                        case HOUR:
                            int tempHour = ((CalendarProperties) this[calendar]).dateTime.Hour;
                            return tempHour > 12 ? tempHour - 12 : tempHour;

                        case MILLISECOND:
                            return ((CalendarProperties) this[calendar]).dateTime.Millisecond;
                        case MINUTE:
                            return ((CalendarProperties) this[calendar]).dateTime.Minute;
                        case MONTH:
                            //Month value is 0-based. e.g., 0 for January
                            return ((CalendarProperties) this[calendar]).dateTime.Month - 1;
                        case SECOND:
                            return ((CalendarProperties) this[calendar]).dateTime.Second;
                        case YEAR:
                            return ((CalendarProperties) this[calendar]).dateTime.Year;
                        case DAY_OF_MONTH:
                            return ((CalendarProperties) this[calendar]).dateTime.Day;
                        case HOUR_OF_DAY:
                            return ((CalendarProperties) this[calendar]).dateTime.Hour;

                        default:
                            return 0;
                    }
                }
                else
                {
                    CalendarProperties tempProps = new CalendarProperties();
                    tempProps.dateTime = DateTime.Now;
                    Add(calendar, tempProps);
                    return Get(calendar, field);
                }
            }
 public TestResult (ResourceType resourceType, CalendarProperties calendarProperties, AddressBookProperties addressBookProperties)
 {
   _resourceType = resourceType;
   _calendarProperties = calendarProperties;
   _addressBookProperties = addressBookProperties;
 }
Esempio n. 40
0
 public void Set(Calendar calendar, int year, int month, int day, int hour, int minute)
 {
     if (this[calendar] != null)
     {
         Set(calendar, YEAR, year);
         Set(calendar, MONTH, month);
         Set(calendar, DATE, day);
         Set(calendar, HOUR, hour);
         Set(calendar, MINUTE, minute);
     }
     else
     {
         CalendarProperties tempProps = new CalendarProperties();
         //Month value is 0-based. e.g., 0 for January
         tempProps.dateTime = new DateTime(year, month + 1, day, hour, minute, 0);
         Add(calendar, tempProps);
     }
 }
Esempio n. 41
0
            public void Set(Calendar calendar, int field, int fieldValue)
            {
                if (this[calendar] != null)
                {
                    DateTime tempDate = ((CalendarProperties) this[calendar]).dateTime;
                    switch (field)
                    {
                        case DATE:
                            tempDate = tempDate.AddDays(fieldValue - tempDate.Day);
                            break;
                        case HOUR:
                            tempDate = tempDate.AddHours(fieldValue - tempDate.Hour);
                            break;
                        case MILLISECOND:
                            tempDate = tempDate.AddMilliseconds(fieldValue - tempDate.Millisecond);
                            break;
                        case MINUTE:
                            tempDate = tempDate.AddMinutes(fieldValue - tempDate.Minute);
                            break;
                        case MONTH:
                            //Month value is 0-based. e.g., 0 for January
                            tempDate = tempDate.AddMonths(fieldValue - (tempDate.Month + 1));
                            break;
                        case SECOND:
                            tempDate = tempDate.AddSeconds(fieldValue - tempDate.Second);
                            break;
                        case YEAR:
                            tempDate = tempDate.AddYears(fieldValue - tempDate.Year);
                            break;
                        case DAY_OF_MONTH:
                            tempDate = tempDate.AddDays(fieldValue - tempDate.Day);
                            break;
                        case HOUR_OF_DAY:
                            tempDate = tempDate.AddHours(fieldValue - tempDate.Hour);
                            break;

                        default:
                            break;
                    }
                    ((CalendarProperties) this[calendar]).dateTime = tempDate;
                }
                else
                {
                    CalendarProperties tempProps = new CalendarProperties();
                    tempProps.dateTime = DateTime.Now;
                    Add(calendar, tempProps);
                    Set(calendar, field, fieldValue);
                }
            }
Esempio n. 42
0
 public void SetDateTime(Calendar calendar, DateTime date)
 {
     if (this[calendar] != null)
     {
         ((CalendarProperties) this[calendar]).dateTime = date;
     }
     else
     {
         CalendarProperties tempProps = new CalendarProperties();
         tempProps.dateTime = date;
         Add(calendar, tempProps);
     }
 }
Esempio n. 43
0
 /// <summary>
 /// Sets the corresponding date (day, month and year) and hour (hour, minute and second) 
 /// to the calendar specified.
 /// If the calendar does not exist in the hash table, it creates a new instance and sets 
 /// its values.
 /// </summary>
 /// <param gridTemplateName="calendar">The calendar to set its date and time.</param>
 /// <param gridTemplateName="year">Integer value that represent the year.</param>
 /// <param gridTemplateName="month">Integer value that represent the month.</param>
 /// <param gridTemplateName="day">Integer value that represent the day.</param>
 /// <param gridTemplateName="hour">Integer value that represent the hour.</param>
 /// <param gridTemplateName="minute">Integer value that represent the minutes.</param>
 /// <param gridTemplateName="second">Integer value that represent the seconds.</param>
 public void Set(System.Globalization.Calendar calendar, int year, int month, int day, int hour, int minute, int second)
 {
     if (this[calendar] != null)
     {
     this.Set(calendar, CalendarManager.YEAR, year);
     this.Set(calendar, CalendarManager.MONTH, month);
     this.Set(calendar, CalendarManager.DATE, day);
     this.Set(calendar, CalendarManager.HOUR, hour);
     this.Set(calendar, CalendarManager.MINUTE, minute);
     this.Set(calendar, CalendarManager.SECOND, second);
     }
     else
     {
     CalendarProperties tempProps = new CalendarProperties();
     tempProps.dateTime = System.DateTime.Now;
     this.Add(calendar, tempProps);
     this.Set(calendar, year, month, day, hour, minute, second);
     }
 }
Esempio n. 44
0
 public void SetTimeInMilliseconds(Calendar calendar, long milliseconds)
 {
   if (this[calendar] != null)
   {
     ((CalendarProperties)this[calendar]).dateTime = new DateTime(milliseconds);
   }
   else
   {
     CalendarProperties properties = new CalendarProperties();
     properties.dateTime = new DateTime(0x2710L * milliseconds);
     this.Add(calendar, properties);
   }
 }
Esempio n. 45
0
 /// <summary>
 /// Sets the specified System.DateTime value to the specified calendar.
 /// </summary>
 /// <param gridTemplateName="calendar">The calendar to set its date.</param>
 /// <param gridTemplateName="date">The System.DateTime value to set to the calendar.</param>
 public void SetDateTime(System.Globalization.Calendar calendar, System.DateTime date)
 {
     if (this[calendar] != null)
     {
     ((CalendarProperties) this[calendar]).dateTime = date;
     }
     else
     {
     CalendarProperties tempProps = new CalendarProperties();
     tempProps.dateTime = date;
     this.Add(calendar, tempProps);
     }
 }
Esempio n. 46
0
 public void SetDateTime(Calendar calendar, DateTime date)
 {
   if (this[calendar] != null)
   {
     ((CalendarProperties)this[calendar]).dateTime = date;
   }
   else
   {
     CalendarProperties properties = new CalendarProperties();
     properties.dateTime = date;
     this.Add(calendar, properties);
   }
 }
Esempio n. 47
0
 /// <summary>
 /// Sets the time in the specified calendar with the long value.
 /// </summary>
 /// <param gridTemplateName="calendar">The calendar to set its date and time.</param>
 /// <param gridTemplateName="milliseconds">A long value that indicates the milliseconds to be set to 
 /// the hour for the calendar.</param>
 public void SetTimeInMilliseconds(System.Globalization.Calendar calendar, long milliseconds)
 {
     if (this[calendar] != null)
     {
     ((CalendarProperties) this[calendar]).dateTime = new System.DateTime(milliseconds);
     }
     else
     {
     CalendarProperties tempProps = new CalendarProperties();
     tempProps.dateTime = new System.DateTime(System.TimeSpan.TicksPerMillisecond * milliseconds);
     this.Add(calendar, tempProps);
     }
 }
Esempio n. 48
0
                /// <summary>
                /// Gets the value represented by the field specified.
                /// </summary>
                /// <param gridTemplateName="calendar">The calendar to get its date or time.</param>
                /// <param gridTemplateName="field">One of the field that composes a date/time.</param>
                /// <returns>The integer value for the field given.</returns>
                public int Get(System.Globalization.Calendar calendar, int field)
                {
                    if (this[calendar] != null)
                    {
                    int tempHour;
                    switch (field)
                    {
                        case CalendarManager.DATE:
                            return ((CalendarProperties) this[calendar]).dateTime.Day;
                        case CalendarManager.HOUR:
                            tempHour = ((CalendarProperties) this[calendar]).dateTime.Hour;
                            return tempHour > 12 ? tempHour - 12 : tempHour;
                        case CalendarManager.MILLISECOND:
                            return ((CalendarProperties) this[calendar]).dateTime.Millisecond;
                        case CalendarManager.MINUTE:
                            return ((CalendarProperties) this[calendar]).dateTime.Minute;
                        case CalendarManager.MONTH:
                            //Month value is 0-based. e.g., 0 for January
                            return ((CalendarProperties) this[calendar]).dateTime.Month - 1;
                        case CalendarManager.SECOND:
                            return ((CalendarProperties) this[calendar]).dateTime.Second;
                        case CalendarManager.YEAR:
                            return ((CalendarProperties) this[calendar]).dateTime.Year;
                        case CalendarManager.DAY_OF_MONTH:
                            return ((CalendarProperties) this[calendar]).dateTime.Day;
                        case CalendarManager.DAY_OF_YEAR:
                            return (int)(((CalendarProperties) this[calendar]).dateTime.DayOfYear);
                        case CalendarManager.DAY_OF_WEEK:
                            return (int)(((CalendarProperties) this[calendar]).dateTime.DayOfWeek) + 1;
                        case CalendarManager.HOUR_OF_DAY:
                            return ((CalendarProperties) this[calendar]).dateTime.Hour;
                        case CalendarManager.AM_PM:
                            tempHour = ((CalendarProperties) this[calendar]).dateTime.Hour;
                            return tempHour > 12 ? CalendarManager.PM : CalendarManager.AM;

                        default:
                            return 0;
                    }
                    }
                    else
                    {
                    CalendarProperties tempProps = new CalendarProperties();
                    tempProps.dateTime = System.DateTime.Now;
                    this.Add(calendar, tempProps);
                    return this.Get(calendar, field);
                    }
                }
Esempio n. 49
0
 public void Set(Calendar calendar, int year, int month, int day)
 {
   if (this[calendar] != null)
   {
     this.Set(calendar, 0, year);
     this.Set(calendar, 1, month);
     this.Set(calendar, 2, day);
   }
   else
   {
     CalendarProperties properties = new CalendarProperties();
     properties.dateTime = new DateTime(year, month + 1, day);
     this.Add(calendar, properties);
   }
 }
Esempio n. 50
0
 /// <summary>
 /// Gets the calendar current date and time.
 /// </summary>
 /// <param gridTemplateName="calendar">The calendar to get its current date and time.</param>
 /// <returns>A System.DateTime value that indicates the current date and time for the 
 /// calendar given.</returns>
 public System.DateTime GetDateTime(System.Globalization.Calendar calendar)
 {
     if (this[calendar] != null)
     return ((CalendarProperties) this[calendar]).dateTime;
     else
     {
     CalendarProperties tempProps = new CalendarProperties();
     tempProps.dateTime = System.DateTime.Now;
     this.Add(calendar, tempProps);
     return this.GetDateTime(calendar);
     }
 }
Esempio n. 51
0
 public DayOfWeek GetFirstDayOfWeek(Calendar calendar)
 {
   if ((this[calendar] != null) && (((CalendarProperties)this[calendar]).dateTimeFormat != null))
   {
     return ((CalendarProperties)this[calendar]).dateTimeFormat.FirstDayOfWeek;
   }
   CalendarProperties properties = new CalendarProperties();
   properties.dateTimeFormat = new DateTimeFormatInfo();
   properties.dateTimeFormat.FirstDayOfWeek = DayOfWeek.Sunday;
   this.Add(calendar, properties);
   return this.GetFirstDayOfWeek(calendar);
 }
Esempio n. 52
0
 /// <summary>
 /// Gets what the first day of the week is; e.g., Sunday in US, Monday in France.
 /// </summary>
 /// <param gridTemplateName="calendar">The calendar to get its first day of the week.</param>
 /// <returns>A System.DayOfWeek value indicating the first day of the week.</returns>
 public System.DayOfWeek GetFirstDayOfWeek(System.Globalization.Calendar calendar)
 {
     if (this[calendar] != null)
     {
     if (((CalendarProperties)this[calendar]).dateTimeFormat == null)
     {
         ((CalendarProperties)this[calendar]).dateTimeFormat = new System.Globalization.DateTimeFormatInfo();
         ((CalendarProperties)this[calendar]).dateTimeFormat.FirstDayOfWeek = System.DayOfWeek.Sunday;
     }
     return ((CalendarProperties) this[calendar]).dateTimeFormat.FirstDayOfWeek;
     }
     else
     {
     CalendarProperties tempProps = new CalendarProperties();
     tempProps.dateTime = System.DateTime.Now;
     tempProps.dateTimeFormat = new System.Globalization.DateTimeFormatInfo();
     tempProps.dateTimeFormat.FirstDayOfWeek = System.DayOfWeek.Sunday;
     this.Add(calendar, tempProps);
     return this.GetFirstDayOfWeek(calendar);
     }
 }
Esempio n. 53
0
			/// <summary>
			/// Sets the corresponding date (day, month and year) to the calendar specified.
			/// If the calendar does not exist in the hash table, it creates a new instance and sets
			/// its values.
			/// </summary>
			/// <param name="calendar">The calendar to set its date.</param>
			/// <param name="year">Integer value that represent the year.</param>
			/// <param name="month">Integer value that represent the month.</param>
			/// <param name="day">Integer value that represent the day.</param>
			public void Set(System.Globalization.Calendar calendar, int year, int month, int day)
			{
				if (this[calendar] != null)
				{
					this.Set(calendar, CalendarManager.YEAR, year);
					this.Set(calendar, CalendarManager.MONTH, month);
					this.Set(calendar, CalendarManager.DATE, day);
				}
				else
				{
					CalendarProperties tempProps = new CalendarProperties();
					//Month value is 0-based. e.g., 0 for January
					tempProps.dateTime = new System.DateTime(year, month + 1, day);
					this.Add(calendar, tempProps);
				}
			}
Esempio n. 54
0
                /// <summary>
                /// Sets the corresponding field in an specified calendar with the value given.
                /// If the specified calendar does not have exist in the hash table, it creates a 
                /// new instance of the calendar with the current date and time and then assings it 
                /// the new specified value.
                /// </summary>
                /// <param gridTemplateName="calendar">The calendar to set its date or time.</param>
                /// <param gridTemplateName="field">One of the fields that composes a date/time.</param>
                /// <param gridTemplateName="fieldValue">The value to be set.</param>
                public void Set(System.Globalization.Calendar calendar, int field, int fieldValue)
                {
                    if (this[calendar] != null)
                    {
                    System.DateTime tempDate = ((CalendarProperties) this[calendar]).dateTime;
                    switch (field)
                    {
                        case CalendarManager.DATE:
                            tempDate = tempDate.AddDays(fieldValue - tempDate.Day);
                            break;
                        case CalendarManager.HOUR:
                            tempDate = tempDate.AddHours(fieldValue - tempDate.Hour);
                            break;
                        case CalendarManager.MILLISECOND:
                            tempDate = tempDate.AddMilliseconds(fieldValue - tempDate.Millisecond);
                            break;
                        case CalendarManager.MINUTE:
                            tempDate = tempDate.AddMinutes(fieldValue - tempDate.Minute);
                            break;
                        case CalendarManager.MONTH:
                            //Month value is 0-based. e.g., 0 for January
                            tempDate = tempDate.AddMonths((fieldValue + 1) - tempDate.Month);
                            break;
                        case CalendarManager.SECOND:
                            tempDate = tempDate.AddSeconds(fieldValue - tempDate.Second);
                            break;
                        case CalendarManager.YEAR:
                            tempDate = tempDate.AddYears(fieldValue - tempDate.Year);
                            break;
                        case CalendarManager.DAY_OF_MONTH:
                            tempDate = tempDate.AddDays(fieldValue - tempDate.Day);
                            break;
                        case CalendarManager.DAY_OF_WEEK:
                            tempDate = tempDate.AddDays((fieldValue - 1) - (int)tempDate.DayOfWeek);
                            break;
                        case CalendarManager.DAY_OF_YEAR:
                            tempDate = tempDate.AddDays(fieldValue - tempDate.DayOfYear);
                            break;
                        case CalendarManager.HOUR_OF_DAY:
                            tempDate = tempDate.AddHours(fieldValue - tempDate.Hour);
                            break;

                        default:
                            break;
                    }
                    ((CalendarProperties) this[calendar]).dateTime = tempDate;
                    }
                    else
                    {
                    CalendarProperties tempProps = new CalendarProperties();
                    tempProps.dateTime = System.DateTime.Now;
                    this.Add(calendar, tempProps);
                    this.Set(calendar, field, fieldValue);
                    }
                }
Esempio n. 55
0
				/// <summary>
				/// Sets the corresponding date (day, month and year) to the calendar specified.
				/// If the calendar does not exist in the hash table, it creates a new instance and sets 
				/// its values.
				/// </summary>
				/// <param name="calendar">The calendar to set its date.</param>
				/// <param name="year">Integer value that represent the year.</param>
				/// <param name="month">Integer value that represent the month.</param>
				/// <param name="day">Integer value that represent the day.</param>
				public void Set(Calendar calendar, int year, int month, int day)
				{
					if (this[calendar] != null)
					{
						Set(calendar, YEAR, year);
						Set(calendar, MONTH, month);
						Set(calendar, DATE, day);
					}
					else
					{
						CalendarProperties tempProps = new CalendarProperties();
						tempProps.dateTime = DateTime.Now;
						Add(calendar, tempProps);
						Set(calendar, year, month, day);
					}
				}
Esempio n. 56
0
 /// <summary>
 /// Sets the corresponding date (day, month and year) to the calendar specified.
 /// If the calendar does not exist in the hash table, it creates a new instance and sets 
 /// its values.
 /// </summary>
 /// <param gridTemplateName="calendar">The calendar to set its date.</param>
 /// <param gridTemplateName="year">Integer value that represent the year.</param>
 /// <param gridTemplateName="month">Integer value that represent the month.</param>
 /// <param gridTemplateName="day">Integer value that represent the day.</param>
 public void Set(System.Globalization.Calendar calendar, int year, int month, int day)
 {
     if (this[calendar] != null)
     {
     this.Set(calendar, CalendarManager.YEAR, year);
     this.Set(calendar, CalendarManager.MONTH, month);
     this.Set(calendar, CalendarManager.DATE, day);
     }
     else
     {
     CalendarProperties tempProps = new CalendarProperties();
     tempProps.dateTime = System.DateTime.Now;
     this.Add(calendar, tempProps);
     this.Set(calendar, year, month, day);
     }
 }
Esempio n. 57
0
 /// <summary>
 /// Gets what the first day of the week is; e.g., Sunday in US, Monday in France.
 /// </summary>
 /// <param name="calendar">The calendar to get its first day of the week.</param>
 /// <returns>A DayOfWeek value indicating the first day of the week.</returns>
 public DayOfWeek GetFirstDayOfWeek( Calendar calendar )
 {
   if ( this[calendar] != null && ( (CalendarProperties)this[calendar] ).dateTimeFormat != null )
   {
     return ( (CalendarProperties)this[calendar] ).dateTimeFormat.FirstDayOfWeek;
   }
   else
   {
     CalendarProperties tempProps = new CalendarProperties();
     tempProps.dateTimeFormat = new DateTimeFormatInfo();
     tempProps.dateTimeFormat.FirstDayOfWeek = DayOfWeek.Sunday;
     this.Add( calendar, tempProps );
     return this.GetFirstDayOfWeek( calendar );
   }
 }
Esempio n. 58
0
        public CalendarioControl(MainForm form)
            : base(form)
        {
            try
            {
                _initializing = true;

                InitializeComponent();

                if (Properties.Settings.Default.Main_ActivateTaskPanelOnCalendar)
                {
                    splitContainerControl2.Collapsed = false;
                }
                else
                {
                    splitContainerControl2.Collapsed = true;
                }


                schedulerStorage1.FetchAppointments += new FetchAppointmentsEventHandler(schedulerStorage1_FetchAppointments);

                CustomGUI_SetCommandBarVisibility(false);
                //non permetto nessuna operazione dalla toolbar
                base.m_ChangeStateEnabled                 = false;
                schedulerControl1.Start                   = DateTime.Now;
                schedulerControl1.ActiveViewType          = CalendarProperties.GetViewType(Properties.Settings.Default.Main_Calendar_ViewType);
                schedulerControl1.DayView.TopRowTime      = new TimeSpan(8, 0, 0);
                schedulerControl1.WorkWeekView.TopRowTime = new TimeSpan(8, 0, 0);

                ResourceHandler h = new ResourceHandler();
                schedulerStorage1.Resources.DataSource = h.GetAll();

                //AppointmentHandler h1 = new AppointmentHandler();
                //h1.ExecuteQuery(new List<IsearchDTO>(), -1, Properties.Settings.Default.Main_DeadlineDaysBefore);
                //schedulerStorage1.Appointments.DataSource = h1.BindableResults;
                //schedulerStorage1.RefreshData();

                //imposto il raggruppamento del calendario
                if (Properties.Settings.Default.Main_CalendarGroupType == 0)
                {
                    schedulerControl1.GroupType = SchedulerGroupType.None;
                    comboBoxEdit1.SelectedIndex = 0;
                }
                else if (Properties.Settings.Default.Main_CalendarGroupType == 1)
                {
                    schedulerControl1.GroupType = SchedulerGroupType.Date;
                    comboBoxEdit1.SelectedIndex = 1;
                }
                else if (Properties.Settings.Default.Main_CalendarGroupType == 2)
                {
                    schedulerControl1.GroupType = SchedulerGroupType.Resource;
                    comboBoxEdit1.SelectedIndex = 2;
                }
                else
                {
                    schedulerControl1.GroupType = SchedulerGroupType.None;
                    comboBoxEdit1.SelectedIndex = 0;
                }
            }
            finally
            {
                _initializing = false;
            }


            PopulateGrid();
        }
Esempio n. 59
0
 public DateTime GetDateTime(Calendar calendar)
 {
     if (this[calendar] != null)
         return ((CalendarProperties) this[calendar]).dateTime;
     else
     {
         CalendarProperties tempProps = new CalendarProperties();
         tempProps.dateTime = DateTime.Now;
         Add(calendar, tempProps);
         return GetDateTime(calendar);
     }
 }
Esempio n. 60
0
 /// <summary>
 /// Sets what the first day of the week is; e.g., Sunday in US, Monday in France.
 /// </summary>
 /// <param name="calendar">The calendar to set its first day of the week.</param>
 /// <param name="firstDayOfWeek">A DayOfWeek value indicating the first day of the week
 /// to be set.</param>
 public void SetFirstDayOfWeek( Calendar calendar, DayOfWeek firstDayOfWeek )
 {
   if ( this[calendar] != null && ( (CalendarProperties)this[calendar] ).dateTimeFormat != null )
   {
     ( (CalendarProperties)this[calendar] ).dateTimeFormat.FirstDayOfWeek = firstDayOfWeek;
   }
   else
   {
     CalendarProperties tempProps = new CalendarProperties();
     tempProps.dateTimeFormat = new DateTimeFormatInfo();
     this.Add( calendar, tempProps );
     this.SetFirstDayOfWeek( calendar, firstDayOfWeek );
   }
 }