/// <summary>
        /// Loads from XML.
        /// </summary>
        /// <param name="reader">The reader.</param>
        /// <param name="propertyBag">The property bag.</param>
        internal override void LoadPropertyValueFromXml(EwsServiceXmlReader reader, PropertyBag propertyBag)
        {
            TimeZoneDefinition timeZoneDefinition = new TimeZoneDefinition();
            timeZoneDefinition.LoadFromXml(reader, this.XmlElementName);

            propertyBag[this] = timeZoneDefinition.ToTimeZoneInfo(reader.Service);
        }
 /// <summary>
 /// Creates a time zone period transition of the appropriate type given an XML element name.
 /// </summary>
 /// <param name="timeZoneDefinition">The time zone definition to which the transition will belong.</param>
 /// <param name="xmlElementName">The XML element name.</param>
 /// <returns>A TimeZonePeriodTransition instance.</returns>
 internal static TimeZoneTransition Create(TimeZoneDefinition timeZoneDefinition, string xmlElementName)
 {
     switch (xmlElementName)
     {
         case XmlElementNames.AbsoluteDateTransition:
             return new AbsoluteDateTransition(timeZoneDefinition);
         case XmlElementNames.RecurringDayTransition:
             return new RelativeDayOfMonthTransition(timeZoneDefinition);
         case XmlElementNames.RecurringDateTransition:
             return new AbsoluteDayOfMonthTransition(timeZoneDefinition);
         case XmlElementNames.Transition:
             return new TimeZoneTransition(timeZoneDefinition);
         default:
             throw new ServiceLocalException(
                 string.Format(
                     Strings.UnknownTimeZonePeriodTransitionType,
                     xmlElementName));
     }
 }
        /// <summary>
        /// Creates a time zone transition based on the specified transition time.
        /// </summary>
        /// <param name="timeZoneDefinition">The time zone definition that will own the transition.</param>
        /// <param name="targetPeriod">The period the transition will target.</param>
        /// <param name="transitionTime">The transition time to initialize from.</param>
        /// <returns>A TimeZoneTransition.</returns>
        internal static TimeZoneTransition CreateTimeZoneTransition(
            TimeZoneDefinition timeZoneDefinition,
            TimeZonePeriod targetPeriod,
            TimeZoneInfo.TransitionTime transitionTime)
        {
            TimeZoneTransition transition;

            if (transitionTime.IsFixedDateRule)
            {
                transition = new AbsoluteDayOfMonthTransition(timeZoneDefinition, targetPeriod);
            }
            else
            {
                transition = new RelativeDayOfMonthTransition(timeZoneDefinition, targetPeriod);
            }

            transition.InitializeFromTransitionTime(transitionTime);

            return transition;
        }
        /// <summary>
        /// Reads response elements from XML.
        /// </summary>
        /// <param name="reader">The reader.</param>
        internal override void ReadElementsFromXml(EwsServiceXmlReader reader)
        {
            base.ReadElementsFromXml(reader);

            reader.ReadStartElement(XmlNamespace.Messages, XmlElementNames.TimeZoneDefinitions);

            if (!reader.IsEmptyElement)
            {
                do
                {
                    reader.Read();

                    if (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.TimeZoneDefinition))
                    {
                        TimeZoneDefinition timeZoneDefinition = new TimeZoneDefinition();
                        timeZoneDefinition.LoadFromXml(reader);

                        this.timeZones.Add(timeZoneDefinition.ToTimeZoneInfo(reader.Service));
                    }
                }
                while (!reader.IsEndElement(XmlNamespace.Messages, XmlElementNames.TimeZoneDefinitions));
            }
        }
Beispiel #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AbsoluteDayOfMonthTransition"/> class.
 /// </summary>
 /// <param name="timeZoneDefinition">The time zone definition this transition belongs to.</param>
 /// <param name="targetPeriod">The period the transition will target.</param>
 internal AbsoluteDayOfMonthTransition(TimeZoneDefinition timeZoneDefinition, TimeZonePeriod targetPeriod)
     : base(timeZoneDefinition, targetPeriod)
 {
 }
Beispiel #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AbsoluteDayOfMonthTransition"/> class.
 /// </summary>
 /// <param name="timeZoneDefinition">The time zone definition this transition belongs to.</param>
 internal AbsoluteDayOfMonthTransition(TimeZoneDefinition timeZoneDefinition)
     : base(timeZoneDefinition)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="AbsoluteDayOfMonthTransition"/> class.
 /// </summary>
 /// <param name="timeZoneDefinition">The time zone definition this transition belongs to.</param>
 /// <param name="targetPeriod">The period the transition will target.</param>
 internal AbsoluteDayOfMonthTransition(TimeZoneDefinition timeZoneDefinition, TimeZonePeriod targetPeriod)
     : base(timeZoneDefinition, targetPeriod)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="TimeZoneTransition"/> class.
 /// </summary>
 /// <param name="timeZoneDefinition">The time zone definition the transition will belong to.</param>
 /// <param name="targetPeriod">The period the transition will target.</param>
 internal TimeZoneTransition(TimeZoneDefinition timeZoneDefinition, TimeZonePeriod targetPeriod)
     : this(timeZoneDefinition)
 {
     this.targetPeriod = targetPeriod;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="AbsoluteDateTransition"/> class.
 /// </summary>
 /// <param name="timeZoneDefinition">The time zone definition the transition will belong to.</param>
 /// <param name="targetGroup">The transition group the transition will target.</param>
 internal AbsoluteDateTransition(TimeZoneDefinition timeZoneDefinition, TimeZoneTransitionGroup targetGroup)
     : base(timeZoneDefinition, targetGroup)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="TimeZoneTransition"/> class.
 /// </summary>
 /// <param name="timeZoneDefinition">The time zone definition the transition will belong to.</param>
 /// <param name="targetPeriod">The period the transition will target.</param>
 internal TimeZoneTransition(TimeZoneDefinition timeZoneDefinition, TimeZonePeriod targetPeriod)
     : this(timeZoneDefinition)
 {
     this.targetPeriod = targetPeriod;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="TimeZoneTransition"/> class.
 /// </summary>
 /// <param name="timeZoneDefinition">The time zone definition the transition will belong to.</param>
 /// <param name="targetGroup">The transition group the transition will target.</param>
 internal TimeZoneTransition(TimeZoneDefinition timeZoneDefinition, TimeZoneTransitionGroup targetGroup)
     : this(timeZoneDefinition)
 {
     this.targetGroup = targetGroup;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="TimeZoneTransition"/> class.
 /// </summary>
 /// <param name="timeZoneDefinition">The time zone definition the transition will belong to.</param>
 internal TimeZoneTransition(TimeZoneDefinition timeZoneDefinition)
     : base()
 {
     this.timeZoneDefinition = timeZoneDefinition;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="RelativeDayOfMonthTransition"/> class.
 /// </summary>
 /// <param name="timeZoneDefinition">The time zone definition this transition belongs to.</param>
 internal RelativeDayOfMonthTransition(TimeZoneDefinition timeZoneDefinition)
     : base(timeZoneDefinition)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="RelativeDayOfMonthTransition"/> class.
 /// </summary>
 /// <param name="timeZoneDefinition">The time zone definition this transition belongs to.</param>
 internal RelativeDayOfMonthTransition(TimeZoneDefinition timeZoneDefinition)
     : base(timeZoneDefinition)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="TimeZoneTransitionGroup"/> class.
 /// </summary>
 /// <param name="timeZoneDefinition">The time zone definition.</param>
 internal TimeZoneTransitionGroup(TimeZoneDefinition timeZoneDefinition)
     : base()
 {
     this.timeZoneDefinition = timeZoneDefinition;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="TimeZoneTransitionGroup"/> class.
 /// </summary>
 /// <param name="timeZoneDefinition">The time zone definition.</param>
 /// <param name="id">The Id of the new transition group.</param>
 internal TimeZoneTransitionGroup(TimeZoneDefinition timeZoneDefinition, string id)
     : this(timeZoneDefinition)
 {
     this.id = id;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="AbsoluteDateTransition"/> class.
 /// </summary>
 /// <param name="timeZoneDefinition">The time zone definition the transition will belong to.</param>
 /// <param name="targetGroup">The transition group the transition will target.</param>
 internal AbsoluteDateTransition(TimeZoneDefinition timeZoneDefinition, TimeZoneTransitionGroup targetGroup)
     : base(timeZoneDefinition, targetGroup)
 {
 }
        /// <summary>
        /// Writes to XML.
        /// </summary>
        /// <param name="writer">The writer.</param>
        /// <param name="propertyBag">The property bag.</param>
        /// <param name="isUpdateOperation">Indicates whether the context is an update operation.</param>
        internal override void WritePropertyValueToXml(
            EwsServiceXmlWriter writer,
            PropertyBag propertyBag,
            bool isUpdateOperation)
        {
            TimeZoneInfo value = (TimeZoneInfo)propertyBag[this];

            if (value != null)
            {
                // We emit time zone properties only if we have not emitted the time zone SOAP header
                // or if this time zone is different from that of the service through which the request
                // is being emitted.
                if (!writer.IsTimeZoneHeaderEmitted || value != writer.Service.TimeZone)
                {
                    TimeZoneDefinition timeZoneDefinition = new TimeZoneDefinition(value);

                    timeZoneDefinition.WriteToXml(writer, this.XmlElementName);
                }
            }
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="TimeZoneTransition"/> class.
 /// </summary>
 /// <param name="timeZoneDefinition">The time zone definition the transition will belong to.</param>
 /// <param name="targetGroup">The transition group the transition will target.</param>
 internal TimeZoneTransition(TimeZoneDefinition timeZoneDefinition, TimeZoneTransitionGroup targetGroup)
     : this(timeZoneDefinition)
 {
     this.targetGroup = targetGroup;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="AbsoluteDateTransition"/> class.
 /// </summary>
 /// <param name="timeZoneDefinition">The time zone definition the transition will belong to.</param>
 internal AbsoluteDateTransition(TimeZoneDefinition timeZoneDefinition)
     : base(timeZoneDefinition)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="TimeZoneTransitionGroup"/> class.
 /// </summary>
 /// <param name="timeZoneDefinition">The time zone definition.</param>
 /// <param name="id">The Id of the new transition group.</param>
 internal TimeZoneTransitionGroup(TimeZoneDefinition timeZoneDefinition, string id)
     : this(timeZoneDefinition)
 {
     this.id = id;
 }