GetIsTimeZoneHeaderRequired method

  1. @override
bool GetIsTimeZoneHeaderRequired(
  1. bool isUpdateOperation
)
override
Gets a value indicating whether a time zone SOAP header should be emitted in a CreateItem or UpdateItem request so this item can be property saved or updated. Indicates whether the operation being petrformed is an update operation.

Implementation

@override
bool GetIsTimeZoneHeaderRequired(bool isUpdateOperation) {
  if (isUpdateOperation) {
    return false;
  } else {
    bool isStartTimeZoneSetOrUpdated = PropertyBag.IsPropertyUpdated(
      AppointmentSchema.StartTimeZone,
    );
    bool isEndTimeZoneSetOrUpdated = PropertyBag.IsPropertyUpdated(
      AppointmentSchema.EndTimeZone,
    );

    if (isStartTimeZoneSetOrUpdated && isEndTimeZoneSetOrUpdated) {
      // If both StartTimeZone and EndTimeZone have been set or updated and are the same as the service's
      // time zone, we emit the time zone header and StartTimeZone and EndTimeZone are not emitted.
      final serviceTimeZone = Service.TimeZone;
      return serviceTimeZone != null &&
          (PropertyBag[AppointmentSchema.StartTimeZone] == serviceTimeZone ||
              PropertyBag[AppointmentSchema.EndTimeZone] == serviceTimeZone);
    } else {
      return true;
    }
  }
}