Ejemplo n.º 1
0
		public void showPopupDefer(BookingInfo bookingInfo, DeferInfo deferInfo){
			var confirmDeferView = LayoutInflater.Inflate (Resource.Layout.popup_confirm_layout, null);
			var tvTitle = confirmDeferView.FindViewById<TextView> (Resource.Id.tv_title_confirm_popup);
			var tvConfirm = confirmDeferView.FindViewById<TextView> (Resource.Id.tv_info_popup);
			var btnConfirmDefer = confirmDeferView.FindViewById<Button> (Resource.Id.btn_confirm_tv_popup);
			var btnDecline = confirmDeferView.FindViewById<Button> (Resource.Id.btn_decline_tv_popup);

			tvConfirm.Gravity = global::Android.Views.GravityFlags.Left;
			tvTitle.SetText (Android.Resource.String.delayed_title);
			btnConfirmDefer.Text = "Accept";
			btnDecline.Text = "Decline";
			if (deferInfo.IsDefer) {
				string strMinute = ((double)bookingInfo.Deferral).ToString ("C0", new CultureInfo ("en-us")).Substring (1) + " minutes.";
				tvConfirm.TextFormatted = Html.FromHtml (String.Format (_activity.GetString (Resource.String.delay_minute_info), bookingInfo.SpecialistName, strMinute));
			} else {
				int iHours = (int)(bookingInfo.Deferral / 60);
				tvConfirm.TextFormatted = Html.FromHtml (String.Format (_activity.GetString (Resource.String.delay_day_info), bookingInfo.SpecialistName, iHours));
			}

			OnTimerSendCancelDefer (bookingInfo.Id, deferInfo, 0);

			btnConfirmDefer.Click += (sender, e) => {
				dialog.Dismiss();
				sendDeferTalkNow(bookingInfo, deferInfo);
				if(timer != null) {
					timer.Stop();
					timer = null;
				}
			};

			btnDecline.Click += (sender, e) => {
				dialog.Dismiss();
				sendCancelDeferTalkNow(bookingInfo.Id, deferInfo);
				if(timer != null) {
					timer.Stop();
					timer = null;
				}
			};

			builder = new AlertDialog.Builder (_activity);
			builder.SetInverseBackgroundForced (true);
			builder.SetView (confirmDeferView);
			dialog = builder.Create ();
			dialog.SetCanceledOnTouchOutside(false);
			dialog.Show ();
		}
		private void showDeclinceConfirmed (BookingInfo info)
		{
			string text1 = "";
			string param1 = "";
			string text2 = "";

			if (MApplication.getInstance ().isConsultant && bookingInfo.IsApplyNoMinimumCharge) {
				this.alertDecline = new TCAlertViewController (this, TCLocalizabled.getText ("TextAlertTitleCancellation"), TCLocalizabled.getText ("TextAlertMessageSpecialistCancelNotApplyMinCharge"), null, TCLocalizabled.getText ("NoTitle"), TCLocalizabled.getText ("YesTitle"));
			} else {
				if (!MApplication.getInstance ().isConsultant) {
					text1 = TCLocalizabled.getText ("TextAlertMessageCustomerCancel1");
					param1 = "$" + MUtils.getCost (info.CustomerMinCharge);
					text2 = TCLocalizabled.getText ("TextAlertMessageCustomerCancel2");
				} else {
					text1 = TCLocalizabled.getText ("TextAlertMessageSpecialistCancel1");
					param1 = "$" + MUtils.getCost (info.SpecialistMinCharge);
					text2 = TCLocalizabled.getText ("TextAlertMessageSpecialistCancel2");
				}

				var attributedString = new NSMutableAttributedString (text1 + param1 + text2);
				UIFont fontMessage = MUtils.getFontWithSize (false, 14.0f);

				attributedString.SetAttributes (new UIStringAttributes {
					Font = fontMessage,
					ForegroundColor = TCTheme.getInstance.getThemeColor (Theme.TextColorBooking)

				}.Dictionary, new NSRange (text1.Length, param1.Length));


				TCMessageView customMessage = new TCMessageView (UIColor.Clear, attributedString, false);
				this.alertDecline = new TCAlertViewController (this, ALERT_TYPE.CUSTOM, TCLocalizabled.getText ("TextAlertTitleCancellation"), "", customMessage, TCLocalizabled.getText ("NoTitle"), TCLocalizabled.getText ("YesTitle"));
			}

			this.alertDecline.Delegate = this;
			this.alertDecline.display ();
		}
		public void getBookingSuccess (TCBookingHelper helper, BookingInfo info)
		{
			this.loadingView.dismiss ();
			this.bookingInfo = info;
			if (MApplication.getInstance ().isConsultant) {	
				this.isShowWaiveFee = !CoreSystem.Utils.isDisableWaivedFee (this.bookingInfo);
			}

			setUpWaive ();
			this.setupDataUI ();
		}
Ejemplo n.º 4
0
		public DeferDTO (BookingInfo BookingInfo, DeferInfo DeferInfo)
		{
			this.bookingInfo = BookingInfo;
			this.deferInfo = DeferInfo;
		}
		public void getBookingSuccess (TCBookingHelper helper, BookingInfo info)
		{
			NSMutableAttributedString stringAttribute;
			this.bookingInfo = info;
		
			if (this.deferInfo.IsDefer) {
				string time = MUtils.getMinuteDefer (info.Deferral);
				stringAttribute = createDeferStringAttributed (this.bookingInfo, time);
			} else {
				string time = MUtils.getHourReschedule (info.Deferral);
				stringAttribute = createRescheduleStringAttributed (this.bookingInfo, time);
			}
				
			TCMessageView customMessage = new TCMessageView (UIColor.Clear, stringAttribute, false);
			UIViewController root = UIApplication.SharedApplication.KeyWindow.RootViewController;
			this.alertDeferOrReschedule = new TCAlertViewController (root,  ALERT_TYPE.CUSTOM, TCLocalizabled.getText ("TextTitleDelay"), "", customMessage, TCLocalizabled.getText ("DeclineTitle"), TCLocalizabled.getText ("AcceptTitle"));
			this.alertDeferOrReschedule.Delegate = this;
			this.alertDeferOrReschedule.display ();
		}
		private NSMutableAttributedString createDeferStringAttributed (BookingInfo bookingInfo, string time)
		{
			string param1 = bookingInfo.SpecialistName;
			string text1 = TCLocalizabled.getText ("TextMessageDefer1");
			string param2 = time;
			string text2 = TCLocalizabled.getText ("TextMessageDefer2");

	
			var attributedString = new NSMutableAttributedString (param1 + text1 + param2 + text2);
			UIFont fontMessage = MUtils.getFontWithSize (false, 14.0f);

			attributedString.SetAttributes (new UIStringAttributes {
				Font = fontMessage,
				ForegroundColor = TCTheme.getInstance.getThemeColor (Theme.TextColorBooking)

			}.Dictionary, new NSRange (0, param1.Length));

			attributedString.SetAttributes (new UIStringAttributes {
				Font = fontMessage,
				ForegroundColor = UIColor.Black

			}.Dictionary, new NSRange (param1.Length, text1.Length));
					

			attributedString.SetAttributes (new UIStringAttributes {
				Font = fontMessage,
				ForegroundColor = TCTheme.getInstance.getThemeColor (Theme.TextColorBooking)

			}.Dictionary, new NSRange ((param1 + text1).Length, param2.Length));

			attributedString.SetAttributes (new UIStringAttributes {
				Font = fontMessage,
				ForegroundColor = UIColor.Black

			}.Dictionary, new NSRange ((param1 + text1 + param2).Length, text2.Length));


			return attributedString;
		}
Ejemplo n.º 7
0
		public void onSuccessGetBookingInfo (BookingInfo bookingInfo)
		{
			this.RunOnUiThread (() => {
				progressDialogParent.Hide();
				if (bookingInfo != null) {
					if (bookingInfo.PastBooking != null) {
						constants.bookingInfo = bookingInfo;
						setDataPastBookingToView();
					}
				} else {
					popupNotice.showNoticeDialogToDestroy(GetString(Resource.String.title_notice),GetString(Resource.String.cannot_get_data));
				}
			});
		}
Ejemplo n.º 8
0
		public void onSuccessGetBookingInfo (BookingInfo bookingInfo)
		{
			if (constants.currentActivity != null) {
				constants.currentActivity.RunOnUiThread (() => {
					if (progressDialogParentRootView != null)
						progressDialogParentRootView.Hide ();
					if (bookingInfo != null) {
						if (bookingInfo.PastBooking != null) {
							DeferTalkNowUI deferDialog = new DeferTalkNowUI (constants.currentActivity);
							deferDialog.actionDeferDelegate = this;
							deferDialog.showPopupDefer (bookingInfo, constants.deferInfo);
						} else {
							onTimerSendCacelDeferTalkNow ();
						}
					} else {
						onTimerSendCacelDeferTalkNow ();
					}
				});
			}
		}
Ejemplo n.º 9
0
		public void sendDeferTalkNow(BookingInfo bookingInfo, DeferInfo deferInfo){
			actionDeferDelegate.onDeferSending ();
			Action<String> successful = (response => {
				_activity.RunOnUiThread (() => {
					DeferTalkNow deferTalkNowInfo = ParseDataHelper.parseDataDeferTalknow(response);
					if(deferTalkNowInfo != null) {
						actionDeferDelegate.onDeferSuccess(deferTalkNowInfo, false);
					} else {
						actionDeferDelegate.onDeferFail(_activity.GetString(Resource.String.accept_defer_title), _activity.GetString(Resource.String.request_fail));
					}
				});				
			});

			Action<String> failure = (response => {
				_activity.RunOnUiThread (() => {
					actionDeferDelegate.onDeferFail(_activity.GetString(Resource.String.title_notice), _activity.GetString(Resource.String.connection_fail));
				});
			});

			DataHelperRequest.getInstance ().sendAcceptTalkNowDeferRequest(bookingInfo.Id, deferInfo.IsDefer, successful, failure);
		}
Ejemplo n.º 10
0
		public static bool isDisableWaivedFee(BookingInfo bookingInfo)
		{
			bool status = false;

			DateTime? tCreateInvoice = Utils.convertDateTime (bookingInfo.InvoiceCreatedDate);

			if (tCreateInvoice == null) {
				status = true;
			} else {
				DateTime timeCreateInvoice = (DateTime)tCreateInvoice;
				if (bookingInfo.IsWaiveFee || timeCreateInvoice.AddMinutes (CoreSystem.Constants.pTimeWaiveFee) <= CoreSystem.Utils.getDateTimeNow (MApplication.getInstance ().timezoneName)) {
					status = true;
				}
			}

			return status;
		}