/// <summary>
        /// Serializes the property to a Json value.
        /// </summary>
        /// <param name="service"></param>
        /// <returns>
        /// A Json value (either a JsonObject, an array of Json values, or a Json primitive)
        /// </returns>
        internal override object InternalToJson(ExchangeService service)
        {
            JsonObject jsonProperty = new JsonObject();

            if (this.BaseOffset.HasValue)
            {
                jsonProperty.Add(
                    XmlElementNames.BaseOffset,
                    EwsUtilities.TimeSpanToXSDuration(this.BaseOffset.Value));
            }

            if (this.Standard != null)
            {
                jsonProperty.Add(XmlElementNames.Standard, this.Standard.InternalToJson(service));
            }

            if (this.Daylight != null)
            {
                jsonProperty.Add(XmlElementNames.Daylight, this.Daylight.InternalToJson(service));
            }

            jsonProperty.Add(XmlAttributeNames.TimeZoneName, this.Name);

            return(jsonProperty);
        }
        /// <summary>
        /// Writes elements to XML.
        /// </summary>
        /// <param name="writer">The writer.</param>
        internal override void WriteElementsToXml(EwsServiceXmlWriter writer)
        {
            if (this.Offset.HasValue)
            {
                writer.WriteElementValue(
                    XmlNamespace.Types,
                    XmlElementNames.Offset,
                    EwsUtilities.TimeSpanToXSDuration(this.Offset.Value));
            }

            if (this.Recurrence != null)
            {
                this.Recurrence.WriteToXml(writer, XmlElementNames.RelativeYearlyRecurrence);
            }

            if (this.AbsoluteDate.HasValue)
            {
                writer.WriteElementValue(
                    XmlNamespace.Types,
                    XmlElementNames.AbsoluteDate,
                    EwsUtilities.DateTimeToXSDate(new DateTime(this.AbsoluteDate.Value.Ticks, DateTimeKind.Unspecified)));
            }

            if (this.Time != null)
            {
                writer.WriteElementValue(
                    XmlNamespace.Types,
                    XmlElementNames.Time,
                    this.Time.ToXSTime());
            }
        }
Example #3
0
        /// <summary>
        /// Serializes the property to a Json value.
        /// </summary>
        /// <param name="service">The service.</param>
        /// <returns>
        /// A Json value (either a JsonObject, an array of Json values, or a Json primitive)
        /// </returns>
        internal override object InternalToJson(ExchangeService service)
        {
            JsonObject jsonTimeZonePeriod = new JsonObject();

            jsonTimeZonePeriod.Add(XmlAttributeNames.Bias, EwsUtilities.TimeSpanToXSDuration(this.bias));
            jsonTimeZonePeriod.Add(XmlAttributeNames.Name, this.name);
            jsonTimeZonePeriod.Add(XmlAttributeNames.Id, this.id);

            return(jsonTimeZonePeriod);
        }
        /// <summary>
        /// Writes elements to XML.
        /// </summary>
        /// <param name="writer">The writer.</param>
        internal override void WriteElementsToXml(EwsServiceXmlWriter writer)
        {
            base.WriteElementsToXml(writer);

            writer.WriteElementValue(
                XmlNamespace.Types,
                XmlElementNames.TimeOffset,
                EwsUtilities.TimeSpanToXSDuration(this.timeOffset));

            writer.WriteElementValue(
                XmlNamespace.Types,
                XmlElementNames.Month,
                this.month);
        }
        /// <summary>
        /// Writes elements to XML.
        /// </summary>
        /// <param name="writer">The writer.</param>
        internal override void WriteElementsToXml(EwsServiceXmlWriter writer)
        {
            if (this.BaseOffset.HasValue)
            {
                writer.WriteElementValue(
                    XmlNamespace.Types,
                    XmlElementNames.BaseOffset,
                    EwsUtilities.TimeSpanToXSDuration(this.BaseOffset.Value));
            }

            if (this.Standard != null)
            {
                this.Standard.WriteToXml(writer, XmlElementNames.Standard);
            }

            if (this.Daylight != null)
            {
                this.Daylight.WriteToXml(writer, XmlElementNames.Daylight);
            }
        }
Example #6
0
 /// <summary>
 /// Writes the attributes to XML.
 /// </summary>
 /// <param name="writer">The writer.</param>
 internal override void WriteAttributesToXml(EwsServiceXmlWriter writer)
 {
     writer.WriteAttributeValue(XmlAttributeNames.Bias, EwsUtilities.TimeSpanToXSDuration(this.bias));
     writer.WriteAttributeValue(XmlAttributeNames.Name, this.name);
     writer.WriteAttributeValue(XmlAttributeNames.Id, this.id);
 }
Example #7
0
 /// <summary>
 /// Converts instance to a string.
 /// </summary>
 /// <param name="value">The value.</param>
 /// <returns>TimeSpan value.</returns>
 internal override string ToString(object value)
 {
     return(EwsUtilities.TimeSpanToXSDuration((TimeSpan)value));
 }