/// <summary> /// Serializes to json. /// </summary> /// <param name="service">The service.</param> /// <returns></returns> internal JsonObject InternalToJson(ExchangeService service) { JsonObject jsonProperty = new JsonObject(); jsonProperty.Add(XmlElementNames.StartTime, EwsUtilities.DateTimeToXSDateTime(startTime)); jsonProperty.Add(XmlElementNames.EndTime, EwsUtilities.DateTimeToXSDateTime(endTime)); return(jsonProperty); }
/// <summary> /// Writes the json value. /// </summary> /// <param name="jsonObject">The json object.</param> /// <param name="propertyBag">The property bag.</param> /// <param name="service">The service.</param> /// /// <param name="isUpdateOperation">if set to <c>true</c> [is update operation].</param> internal override void WriteJsonValue(JsonObject jsonObject, PropertyBag propertyBag, ExchangeService service, bool isUpdateOperation) { object value = propertyBag[this]; if (value != null) { DateTime convertedDateTime = GetConvertedDateTime(service, propertyBag, isUpdateOperation, value); jsonObject.Add(this.XmlElementName, EwsUtilities.DateTimeToXSDateTime(convertedDateTime)); } }
/// <summary> /// Writes the property value 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) { object value = propertyBag[this]; if (value != null) { writer.WriteStartElement(XmlNamespace.Types, this.XmlElementName); DateTime convertedDateTime = GetConvertedDateTime(writer.Service, propertyBag, isUpdateOperation, value); writer.WriteValue(EwsUtilities.DateTimeToXSDateTime(convertedDateTime), this.Name); writer.WriteEndElement(); } }
/// <summary> /// Writes DateTime value. /// </summary> /// <param name="value">The value.</param> public void WriteValue(DateTime value) { this.WriteValue(EwsUtilities.DateTimeToXSDateTime(value)); }