Beispiel #1
0
		/// <summary>
		/// Merges the TripDetail returned from the API with the BookingEntry object used for the current booking.
		/// </summary>
		/// <returns>The atlas to mobile.</returns>
		public static BookingEntry MergeWithApi (BookingEntry mobile, TripDetail api)
		{
			//start with the api version since it has more properties
			Type apiType = api.GetType ();

			var properties = apiType.GetProperties ().Where (p => p.DeclaringType == typeof(TripDetail));
			foreach (PropertyInfo propertyInfo in properties) {

				if (propertyInfo.CanRead) {
					object apiValue = propertyInfo.GetValue (api, null);
					object bookingEntryValue = propertyInfo.GetValue (mobile, null);
					if (!object.Equals (apiValue, bookingEntryValue) && !apiValue.IsEmpty ()) {

						propertyInfo.SetValue (mobile, apiValue, null);
					}
				}

			}

			return mobile;

		}
Beispiel #2
0
		public TripClient GetRatedTrip (BookingEntry bookingEntry, bool async = false)
		{
		
			return InvokeStrategy<TripClient> (() => {
				if (async) {
					if (base.PostObjectAsync (UrlPaths.GetRated, bookingEntry.GetTripDetail (), GetRatedTripCompleted).HasErrors)
						return;
				} else {
					if (base.PostObject (UrlPaths.GetRated, bookingEntry.GetTripDetail ()).HasErrors)
						return;

					GetRatedTripCompleted ();
				}
			});			
		}