예제 #1
0
		private void openCamera()
		{
			if (UIImagePickerController.IsSourceTypeAvailable (UIImagePickerControllerSourceType.Camera)) {
				this.imagePicker.SourceType = UIImagePickerControllerSourceType.Camera;
				this.imagePicker.MediaTypes = UIImagePickerController.AvailableMediaTypes (UIImagePickerControllerSourceType.Camera);
				parentVC.PresentModalViewController (imagePicker, true);
			} else {
				TCAlertViewController alert = new TCAlertViewController (this.parentVC, TCLocalizabled.getText ("TitleAlert"),"Camera is not available", null, null, TCLocalizabled.getText ("OkTitle"));
				alert.display ();
			}
		}
		private void sendRequestBeginConsultation ()
		{
			Action<string> successful = (response => {
				#if DEBUG
				Console.Out.WriteLine (response);
				#endif

				this.InvokeOnMainThread (delegate {

					TalkNowDTO talkDto = CoreSystem.ParseDataHelper.parseDataTalkNow (response);

					if (talkDto.success) {
						this.alertInProgress = new TCAlertViewController (this, TCLocalizabled.getText ("AlertTitleConsultationTalkNow"), TCLocalizabled.getText ("TextMessageBeginConsultationSuccess"), null, null, TCLocalizabled.getText ("OkTitle"));
						this.alertInProgress.Delegate = this;
						this.alertInProgress.display ();
					} else {
						MAlertDTO alertDto = MUtils.getMessageTalkRequest (talkDto);
						if (alertDto != null) {
							this.alertExpired = new TCAlertViewController (this, alertDto.title, alertDto.message, null, null, TCLocalizabled.getText ("OkTitle"));
							if (alertDto.isDelegate) {
								this.alertExpired.Delegate = this;
							}

							this.alertExpired.display ();
						}
					}

					this.loadingView.dismiss ();
				});
			});

			Action<string> failure = (response => {
				Console.WriteLine ("FAILURE");
				this.InvokeOnMainThread (delegate {
					this.loadingView.dismiss ();
					MUtils.showAlert (this, TCLocalizabled.getText ("TitleAlert"), TCLocalizabled.getText ("TextRequestFail"));
				});
			});
				
			DataHelperRequest.getInstance ().sendTalkNowRequest (MApplication.getInstance ().userId,
				this.bookingInfo.CustomerId,
				"",
				(int)CoreSystem.Constants.TALKNOWTYPE.TALKNOW, 
				false,
				this.bookingInfo.Id,
				successful, failure);
		}
		public void updateBookingStatusRequest (int status)
		{
			this.loadingView.show ();
				
			Action<string> successful = (response => {

				ResultDTO resultDTO = ParseDataHelper.parseDataUpdateBookingStatus (response);

				this.InvokeOnMainThread (delegate {
					this.loadingView.dismiss ();
					if (resultDTO != null) {
						if (resultDTO.status) {
							this.goBack ();
						} else {
							if (resultDTO.message != null) {
								TCAlertViewController alertVC = new TCAlertViewController(this, TCLocalizabled.getText("TitleAlert"), resultDTO.message, null, null, TCLocalizabled.getText("OkTitle"));
								alertVC.Delegate = this;
								alertVC.display();
							} else {
								MUtils.showRequestFail (this);
							}
						}
					} else {
						MUtils.showRequestFail (this);
					}
				});
			});

			Action<string> failure = (response => {
				this.InvokeOnMainThread (delegate {
					this.loadingView.dismiss ();
					MUtils.showNetworkFailed (this);
				});
			});

			DataHelperRequest.getInstance ().sendUpdateBookingStatus (bookingInfo.Id, status, successful, failure);
		}
		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 override void alertCancelClicked (TCAlertViewController alert)
		{

		}
		public void alertOkClicked (TCAlertViewController alert)
		{
			if (alert == this.alertNotReceiveData) {
				if (this.NavigationController != null) {
					this.NavigationController.PopViewController (true);
				}
			} else {
				this.PerformSegue("FromProfileSpecialistToUpdateMyProfile", this);
			}

		}
		public void getBookingFail (TCBookingHelper helper)
		{
			this.loadingView.dismiss ();
			TCAlertViewController alert = new TCAlertViewController (this, TCLocalizabled.getText ("TitleAlertNotice"), TCLocalizabled.getText ("TextMessageNotReceiveConfig"), null, null, TCLocalizabled.getText ("OkTitle"));
			alert.Delegate = this;
			alert.display ();
		}
		public void alertOkClicked (TCAlertViewController alert)
		{
			if (alert == this.alertNetwork) {
				finshedSplash (null);
			} else {
				stopTimer ();
				acceptDeferOrSchedule ();
			}
		}
		public void alertCancelClicked (TCAlertViewController alert)
		{
			stopTimer ();
			cancelDeferOrSchedule ();
		}
		public override void alertOkClicked (TCAlertViewController alert)
		{
			if (alert == this.alertConfirm) {
				if (this.buttonSender == this.btnOK)
					sendRescheduleRequest ();
				else {
					updateBookingStatusRequest (this.statusSender);
				}		
			} else {
				goBack ();
			}
		}
		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 void showConfirm (NSObject pSender)
		{
			string textMessage = "";
			string title = TCLocalizabled.getText("TitleConfirm");

			this.buttonSender = (UIButton)pSender;
			if (this.buttonSender == this.btnOK) {
				if (isBookingASAP)
					textMessage = "Are you sure schedule this booking?";
				else
					textMessage = "Are you sure reschedule this booking?";
					
			} else if (this.buttonSender == this.btnCancelBooking) {
				title = TCLocalizabled.getText ("TextAlertTitleCancellation");
				textMessage = "Are you sure cancel this booking?";
				this.statusSender = (int)CoreSystem.Constants.STATUS.Cancel;
			} else if (this.buttonSender == this.btnConfirm1 || this.buttonSender == this.btnConfirm2) {
				textMessage = "Are you sure confirm this booking?";
				this.statusSender = (int)CoreSystem.Constants.STATUS.Confirmed;
			} else {
				title = TCLocalizabled.getText ("TextAlertTitleCancellation");
				textMessage = "Are you sure decline this booking?";
				this.statusSender = (int)CoreSystem.Constants.STATUS.Cancel;
			}

			this.alertConfirm = new TCAlertViewController (this, title, textMessage, null, TCLocalizabled.getText ("NoTitle"), TCLocalizabled.getText ("YesTitle"));
			this.alertConfirm.Delegate = this;
			this.alertConfirm.display ();
		}
		private void showWarningMessage (string title, string message)
		{
			TCAlertViewController alert = new TCAlertViewController (this, title, message, null, null, TCLocalizabled.getText ("OkTitle"));
			alert.display ();
		}
		private void noticeNotRetrieveData ()
		{
			if (!this.isShowAlertNoGetData) {

				TCAlertViewController alertVC = new TCAlertViewController (this, TCLocalizabled.getText ("TitleAlertNotice"), TCLocalizabled.getText ("TextMessageNotReceiveConfig"), null, null, TCLocalizabled.getText ("OkTitle"));
				alertVC.Delegate = this;
				alertVC.display ();

				this.isShowAlertNoGetData = true;
			}
		}
예제 #15
0
		public void alertCancelClicked (TCAlertViewController alert)
		{
			removeVC ();
		}
예제 #16
0
파일: MUtils.cs 프로젝트: borain89vn/demo2
		public static void showAlert (UIViewController controller, string title, string message)
		{
			if (controller != null) {
				if (MApplication.getInstance ().isLogedIn || TCGlobals.getInstance.isAllowShowAlert) {
					TCAlertViewController alertVC = new TCAlertViewController (controller, title, message, null, null, TCLocalizabled.getText ("OkTitle"));
					alertVC.display ();
				}
			}
		}
		public void getProfileFail (TCProfileSpecialistHelper helper)
		{
			this.loadingView.dismiss ();
			this.alertNotReceiveData = new TCAlertViewController (this, TCLocalizabled.getText ("TitleAlertNotice"), TCLocalizabled.getText ("TextMessageNotReceiveConfig"), null, null, TCLocalizabled.getText ("OkTitle"));
			this.alertNotReceiveData.Delegate = this;
			this.alertNotReceiveData.display ();
		}
예제 #18
0
파일: MUtils.cs 프로젝트: borain89vn/demo2
		public static void showMessageForceLogout (UIViewController controller)
		{
			TCAlertViewController alertVC = new TCAlertViewController (controller, TCLocalizabled.getText ("TitleAlertNotice"), TCLocalizabled.getText ("TextMessageForceLogout"), null, null, TCLocalizabled.getText ("OkTitle"));
			alertVC.display (ALERT_SHOW_TYPE.ONLY);
		}
		private void waiveFeeClicked ()
		{
			this.isShowWaiveFee = !CoreSystem.Utils.isDisableWaivedFee (this.bookingInfo);

			if (this.isShowWaiveFee) {
				this.waiveAlert = new TCAlertViewController (this, TCLocalizabled.getText ("TextAlertTitleWaiveFee"), TCLocalizabled.getText ("TextAlertMessageConfirmWaiveFee"), null, TCLocalizabled.getText ("NoTitle"), TCLocalizabled.getText ("YesTitle"));
				this.waiveAlert.Delegate = this;
				this.waiveAlert.display ();
			} else {
				MUtils.showWaiveFeeTimeExpired (this);
			}
		}
예제 #20
0
		private void showSuccessASAP ()
		{
			NSMutableAttributedString stringAttribute = createASAPSuccessAttributed (TCLocalizabled.getText ("TextMessageASAPSuccess"));
			TCMessageView customMessage = new TCMessageView (UIColor.Clear, stringAttribute, false);
			TCAlertViewController alertVC = new TCAlertViewController (this, ALERT_TYPE.CUSTOM, TCLocalizabled.getText ("TextAlertTitleSoonestSuccess"), "", customMessage, null, TCLocalizabled.getText ("OkTitle"));
			alertVC.display ();

			removeVC ();
		}
		public override void alertOkClicked (TCAlertViewController alert)
		{
			if (this.waiveAlert == alert) {
				TCUpdateWaiveFeeHelper waiveFeeHelper = new TCUpdateWaiveFeeHelper (this);
				waiveFeeHelper.Delegate = this;
				waiveFeeHelper.update (this.bookingInfo.Id);
			} else {
				back ();
			}
		}
예제 #22
0
		private void showFailASAP ()
		{
			TCAlertViewController alertVC = new TCAlertViewController (this, TCLocalizabled.getText ("TitleAlertBookATime"), TCLocalizabled.getText ("TextRequestFail"), null, null, TCLocalizabled.getText ("OkTitle"));
			alertVC.display ();

			removeVC ();
		}
		public override void alertOkClicked (TCAlertViewController alert)
		{
			if (this.alertDecline == alert) {
				updateBookingStatusRequest ((int)CoreSystem.Constants.STATUS.Cancel);
			} else if (this.alertInProgress == alert) {
				TCNotificationCenter.defaultCenter.postNotification (MConstants.kPostRefreshConfirmBooking, null);
				this.goBack ();
			} else {
				TCNotificationCenter.defaultCenter.postNotification (MConstants.kPostRefreshAllBooking, null);
				this.goBack ();
			}
		}
예제 #24
0
		public void alertOkClicked (TCAlertViewController alert)
		{
			parentController.loadingView.show ();
			sendRequestASAP ();
		}
		private void rejectBookingExpired ()
		{
			this.alertExpired = new TCAlertViewController (this, TCLocalizabled.getText ("TitleAlert"), TCLocalizabled.getText ("TextMessageCanNotBeginConsultation"), null, null, TCLocalizabled.getText ("OkTitle"));
			this.alertExpired.Delegate = this;
			this.alertExpired.display ();
		}
예제 #26
0
		private void showConfirm ()
		{
			NSMutableAttributedString stringAttribute = createTalknowAttributed (specialistInfo);
			TCMessageView customMessage = new TCMessageView (UIColor.Clear, stringAttribute, false);

			TCAlertViewController alertVC = new TCAlertViewController (this, ALERT_TYPE.CUSTOM, TCLocalizabled.getText ("TextAlertTitleTalknowConfirm"), "", customMessage, TCLocalizabled.getText ("CancelTitle"), TCLocalizabled.getText ("OkTitle"));
			alertVC.Delegate = this;
			alertVC.display ();
		}
예제 #27
0
		private bool checkValidAccount ()
		{
			bool result = true;

			if (!MApplication.getInstance ().isLogedIn) {
				requireLogin ();
				result = false;
			} else if (!MApplication.getInstance ().isCompleteProfile) {
				TCAlertViewController alertVC = new TCAlertViewController (this.parentController, TCLocalizabled.getText ("TextAlertTitleRequiredUpdateProfile"), TCLocalizabled.getText ("TextMessageRequireUpdateProfile"), null, TCLocalizabled.getText("NoTitle"), TCLocalizabled.getText("YesTitle"));
				alertVC.Delegate = DelegateAlertCompleteProfile;
				alertVC.display ();
				result = false;
			}
				
			return result;
		}
예제 #28
0
		public void alertOkClicked (TCAlertViewController alert)
		{
			if (parentController != null)
				parentController.loadingView.show ();

			sendRequestTalknow ();

			removeVC ();
		}
		public virtual void alertCancelClicked (TCAlertViewController alert)
		{

		}
예제 #30
0
		public void pop (TCAlertViewController alert) 
		{
			this.alerts.Remove (new NSString (alert.ToString()));
		}