Ejemplo n.º 1
0
        private static HolidaySchedule HolidayFromString(string schedule, bool fromAD)
        {
            if (schedule == null || schedule.Length == 0)
            {
                throw new FormatException(DataStrings.InvalidHolidayScheduleFormat);
            }
            string[] array = schedule.Split(new char[]
            {
                ','
            });
            if (array == null || array.Length < 3 || array.Length > 4)
            {
                throw new FormatException(DataStrings.InvalidHolidayScheduleFormat);
            }
            DateTime dateTime = DateTime.MinValue;

            dateTime = HolidaySchedule.StringToDate(array[2], fromAD);
            DateTime end = dateTime;

            if (array.Length > 3)
            {
                end = HolidaySchedule.StringToDate(array[3], fromAD);
            }
            return(new HolidaySchedule(array[0], array[1], dateTime, end));
        }
Ejemplo n.º 2
0
        public HolidaySchedule(PSObject importedObject)
        {
            this.name = (string)importedObject.Properties["Name"].Value;
            this.introductoryGreeting = (string)importedObject.Properties["Greeting"].Value;
            string datestring = (string)importedObject.Properties["StartDate"].Value;

            this.scheduleDate = HolidaySchedule.StringToDate(datestring, false);
            datestring        = (string)importedObject.Properties["EndDate"].Value;
            this.endDate      = HolidaySchedule.StringToDate(datestring, false);
            this.Validate();
        }