示例#1
0
		public static BookingNumber parseResponseBookingNumber (string response)
		{
			BookingNumber bookingNumber = null;
			try {
				Dictionary<string, object> result = JsonConvert.DeserializeObject<Dictionary<string, object>> (response);
				if ((result.ContainsKey ("status") && (bool)result ["status"]) && (result.ContainsKey ("numbers") && result ["numbers"] != null)) {
					DataContractJsonSerializer js = new DataContractJsonSerializer (typeof(BookingNumber));
					MemoryStream ms = new MemoryStream (System.Text.UTF8Encoding.UTF8.GetBytes (result ["numbers"].ToString ()));
					bookingNumber = (BookingNumber)js.ReadObject (ms);
					ms.Close ();
				} else {
					bookingNumber = new BookingNumber ();
				}
			} catch (Exception ex) {
				#if DEBUG
				Console.Write(ex.Message);
				#endif
				return new BookingNumber ();
			}
			return bookingNumber;
		}
示例#2
0
		private void updateNumOfBooking(BookingNumber bookingNumber){
			this.RunOnUiThread (() => {
				for (int i = 0; i < 4; i++) {
					switch (i) {
					case 0:
						changeTabTitle (i, GetString (Resource.String.alerts_title) + "\n(" + bookingNumber.alert + ")");
						break;
					case 1:
						changeTabTitle (i, GetString (Resource.String.booking_requests_title) + "\n(" + bookingNumber.request + ")");
						break;
					case 2:
						changeTabTitle (i, GetString (Resource.String.confirmed_booking_title) + "\n(" + bookingNumber.confirmed + ")");
						break;
					case 3:
						if(PastBookingActivity.pastBookingActivity == null) {
							changeTabTitle (i, GetString (Resource.String.past_booking_title) + "\n(" + bookingNumber.past + ")");
						}
						break;
					}
				}
			});
		}
示例#3
0
		public void onSuccessGetNumBooking (BookingNumber bookingNumber)
		{
			this.RunOnUiThread (() => {
				updateNumOfBooking(bookingNumber);
			});
		}