Esempio n. 1
0
		protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);
			RequestWindowFeature (WindowFeatures.ActionBar);
			SetContentView (Resource.Layout.popup_reschedule_booking);

			ActionBar.NavigationMode = ActionBarNavigationMode.Standard;
			ActionBar.Title = GetString(Resource.String.consultation_titile) + constants.bookingInfo.ReferenceNo;
			ActionBar.SetDisplayShowTitleEnabled (false);
			ActionBar.SetDisplayHomeAsUpEnabled(true);
			ActionBar.SetDisplayShowHomeEnabled (true);

			setHeadingTitle (GetString(Resource.String.consultation_titile) + constants.bookingInfo.ReferenceNo);

			bookPreTimeDialog = new BookPreTimeUI (this, false);
			bookPreTimeDialog.actionDelegate = this;

			popupNotice = new PopupNoticeInfomation(this);
			popupNotice.noticeDelegate = this;

			llProgress = FindViewById<LinearLayout> (Resource.Id.llProgressBar);
			llProgress.Visibility = ViewStates.Gone;

			var avatar = FindViewById<ImageView> (Resource.Id.avatar_request_booking);
			var tvName = FindViewById<TextView> (Resource.Id.tv_name_request_booking);
			var tvProposedTime = FindViewById<TextView> (Resource.Id.tv_time_request_booking);
			var tvFee = FindViewById<TextView> (Resource.Id.tv_fee_request_booking);
			var tvEnquiry = FindViewById<TextView> (Resource.Id.tv_enquiry_request_booking);
			var llStartTime = FindViewById<LinearLayout> (Resource.Id.llStartTimeReschedule);
			var llEndTime = FindViewById<LinearLayout> (Resource.Id.llEndTimeReschedule);
			var tvTimeError = FindViewById<TextView> (Resource.Id.tv_time_error_reschedule);
			tvStartTime = FindViewById<TextView> (Resource.Id.tv_start_reschedule);
			tvEndTime = FindViewById<TextView> (Resource.Id.tv_end_reschedule);
			var tvFeeTitle = FindViewById<TextView> (Resource.Id.tv_title_cost_reschedule);
			var tvExpired = FindViewById<TextView> (Resource.Id.tv_expried_time_reschedule);

			var btnReschedule = FindViewById<Button> (Resource.Id.btn_reschedule_booking);
			var btnConfirm = FindViewById<Button> (Resource.Id.btn_confirm_booking);
			var btnDecline = FindViewById<Button> (Resource.Id.btn_decline_booking);

			var btnOk = FindViewById<Button> (Resource.Id.btn_ok_reschedule);
			var btnCancel = FindViewById<Button> (Resource.Id.btn_cancel_reschedule);

			var llGrSelectTimeReschedule = FindViewById<LinearLayout> (Resource.Id.llGrSelectTimeReschedule);
			var llGrButtonDetailReschedule = FindViewById<LinearLayout> (Resource.Id.llGrButtonDetailReschedule);
			var llGrButtonConfirmReschedule = FindViewById<LinearLayout> (Resource.Id.llGrButtonConfirmReschedule);

			tvExpired.Visibility = ViewStates.Gone;
			llGrSelectTimeReschedule.Visibility = ViewStates.Gone;
			llGrButtonConfirmReschedule.Visibility = ViewStates.Gone;
			tvTimeError.Visibility = ViewStates.Gone;
			if (MApplication.getInstance ().isConsultant && constants.bookingInfo.Type == (int)Constants.TALKNOWTYPE.ASAP && constants.bookingInfo.Status == (int)Constants.STATUS.Requested) {
				datetimeStart = Utils.getDateTimeNow (MApplication.getInstance ().timezoneName);
				datetimeEnd = Utils.getDateTimeNow (MApplication.getInstance ().timezoneName);
			} else {
				datetimeStart = DateTime.Parse (constants.bookingInfo.StartTime);
				datetimeEnd = DateTime.Parse (constants.bookingInfo.EndTime);
				tvStartTime.Text = datetimeStart.ToString (constants.sDateFormat) + " " + datetimeStart.ToString (constants.sTimeFormat, new CultureInfo("en-us")).ToUpper ();
				tvEndTime.Text = datetimeEnd.ToString (constants.sDateFormat) + " " + datetimeEnd.ToString (constants.sTimeFormat, new CultureInfo("en-us")).ToUpper ();
			}
				
			tvEnquiry.Text = constants.bookingInfo.Enquiry;
			if (datetimeStart.Date == datetimeEnd.Date) {
				tvProposedTime.Text = datetimeStart.ToString (constants.sDateFormat) + " " + datetimeStart.ToString (constants.sTimeFormat, new CultureInfo("en-us")).ToUpper () + " - " + datetimeEnd.ToString (constants.sTimeFormat, new CultureInfo("en-us")).ToUpper ();
			} else {
				tvProposedTime.Text = datetimeStart.ToString (constants.sDateFormat) + " " + datetimeStart.ToString (constants.sTimeFormat, new CultureInfo("en-us")).ToUpper () + " - " + datetimeEnd.ToString (constants.sDateFormat) + " " + datetimeEnd.ToString (constants.sTimeFormat, new CultureInfo("en-us")).ToUpper ();
			}
			if (constants.bookingInfo.Type == (int)Constants.TALKNOWTYPE.ASAP && constants.bookingInfo.Status == (int)Constants.STATUS.Requested) {
				tvProposedTime.Text = GetString (Resource.String.soonest_possible_time);
			}
			tvProposedTime.SetMinWidth (Utils.getScreenWidth ());
			string fee = "";
			if (MApplication.getInstance ().isConsultant) {
				fee = "$" + Utils.getCost (constants.bookingInfo.RatePerMinute) + " " + GetString (Resource.String.price_per_minute);
			} else {
				fee = "$" + Utils.getCost (constants.bookingInfo.CostPerMinute) + " " + GetString (Resource.String.price_per_minute);
			}
			if (!MApplication.getInstance ().isConsultant) {
				fee += " ($" + Utils.getCost(constants.bookingInfo.CustomerMinCharge) + " minimum)";
			} else if(!constants.bookingInfo.IsApplyNoMinimumCharge){
				fee += " ($" + Utils.getCost (constants.bookingInfo.SpecialistMinCharge) + " minimum)";
			}

			tvFee.Text = fee;

			if (MApplication.getInstance().isConsultant) {
				UrlImageViewHelper.UrlImageViewHelper.SetUrlDrawable(avatar, HttpConstants.BASE_URL + constants.bookingInfo.CustomerAvatar, Resource.Drawable.special_home, constants.iTimeLoading, this);
				tvName.Text = constants.bookingInfo.CustomerName;
				tvFeeTitle.Text = "CONSULTATION FEE";
				if (constants.bookingInfo.Type == (int)Constants.TALKNOWTYPE.ASAP && constants.bookingInfo.Status == (int)Constants.STATUS.Requested) {
					btnConfirm.Visibility = ViewStates.Gone;
					btnReschedule.Text = GetString (Resource.String.schedule_btn);
					isLoadConfig = true;
				} else {
					switch (constants.bookingInfo.Status) {
					case (int)Constants.STATUS.Requested:
						btnReschedule.Visibility = ViewStates.Visible;
						isLoadConfig = true;
						break;
					case (int)Constants.STATUS.CustomerRescheduled:
						btnReschedule.Visibility = ViewStates.Gone;
						isLoadConfig = false;
						break;
					case (int)Constants.STATUS.SpecialistRescheduled:
						btnConfirm.Visibility = ViewStates.Gone;
						btnDecline.Visibility = ViewStates.Gone;
						btnReschedule.Visibility = ViewStates.Gone;
						isLoadConfig = false;
						break;
					}
				}
			} else {
				UrlImageViewHelper.UrlImageViewHelper.SetUrlDrawable(avatar, HttpConstants.BASE_URL + constants.bookingInfo.SpecialistAvatar, Resource.Drawable.special_home, constants.iTimeLoading, this);
				tvName.Text = constants.bookingInfo.SpecialistName;
				tvFeeTitle.Text = "APPLICABLE COST";
				if (constants.bookingInfo.Status != (int)Constants.STATUS.SpecialistRescheduled) {
					btnConfirm.Visibility = ViewStates.Gone;
					btnDecline.Visibility = ViewStates.Gone;
					btnReschedule.Visibility = ViewStates.Gone;
					isLoadConfig = false;
				} else {
					isLoadConfig = true;
				}
			}

			// if start time < now ---> hide confirm
			if (DateTime.Compare (DateTime.Parse (constants.bookingInfo.StartTime), Utils.getDateTimeNow (MApplication.getInstance ().timezoneName)) < 0) { // Time now > start time
				btnConfirm.Visibility = ViewStates.Gone;
				if (constants.bookingInfo.Type != (int)Constants.TALKNOWTYPE.ASAP) {
					tvExpired.Visibility = ViewStates.Visible;
				}
			}

			btnConfirm.Click += (sender, e) => {
				if(updateBookingStatus == null){
					updateBookingStatus = new UpdateBookingStatus(this);
					updateBookingStatus.actionUpdateBookingStatus = this;
				}
				updateBookingStatus.updateBookingStatusRequest((int)Constants.STATUS.Confirmed);
			};

			btnReschedule.Click += (sender, e) => {
				llGrButtonDetailReschedule.Visibility = ViewStates.Gone;
				llGrButtonConfirmReschedule.Visibility = ViewStates.Visible;
				llGrSelectTimeReschedule.Visibility = ViewStates.Visible;
			};

			btnDecline.Click += (sender, e) => {
				if(updateBookingStatus == null){
					updateBookingStatus = new UpdateBookingStatus(this);
					updateBookingStatus.actionUpdateBookingStatus = this;
				}
				updateBookingStatus.updateBookingStatusRequest((int)Constants.STATUS.Cancel);
			};

			llStartTime.Click += (sender, e) => {
				tvTimeError.Visibility = ViewStates.Gone;
				isStart = true;
				bookPreTimeDialog.showSelectPreTime(isStart, datetimeStart);
			};
			llEndTime.Click += (sender, e) => {
				tvTimeError.Visibility = ViewStates.Gone;
				isStart = false;
				bookPreTimeDialog.showSelectPreTime(isStart, datetimeEnd);
			};

			btnOk.Click += (sender, e) => {
				if (utilsAndroid.checkValidateTimeBooking (this, Utils.getDateTimeNow (MApplication.getInstance ().timezoneName), datetimeStart, datetimeEnd, tvTimeError)) {
					rescheduleRequest ();
				} else {
					tvTimeError.Visibility = ViewStates.Visible;
				}
			};

			btnCancel.Click += (sender, e) => {
				llGrButtonDetailReschedule.Visibility = ViewStates.Visible;
				llGrButtonConfirmReschedule.Visibility = ViewStates.Gone;
				llGrSelectTimeReschedule.Visibility = ViewStates.Gone;
				tvTimeError.Visibility = ViewStates.Gone;
			};

			if (isLoadConfig) {
				GetSystemConfig getSysConfig = new GetSystemConfig (this);
				getSysConfig.actionGetConfigDelegate = this;
				getSysConfig.getSysConfig ();
			}
		}
Esempio n. 2
0
		protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);
			RequestWindowFeature (WindowFeatures.ActionBar);
			SetContentView (Resource.Layout.book_a_time_schedule);

			ActionBar.NavigationMode = ActionBarNavigationMode.Standard;
			ActionBar.SetTitle (Resource.String.book_time);
			ActionBar.SetDisplayShowTitleEnabled (false);
			ActionBar.SetDisplayHomeAsUpEnabled(true);
			ActionBar.SetDisplayShowHomeEnabled (true);

			setHeadingTitle (Resource.String.book_time);

			if (this.Intent.Extras != null) {
				isStandardHour = this.Intent.Extras.GetBoolean (constants.pIsStandard);
				strEnquiry = this.Intent.Extras.GetString (constants.pEnquiry);
			} 

			dialog = new BookPreTimeUI(this, isStandardHour);
			dialog.actionDelegate = this;

			llProgress = FindViewById<LinearLayout> (Resource.Id.llProgressBar);
			llProgress.Visibility = ViewStates.Gone;

			tvDatetimeStart = FindViewById<TextView> (Resource.Id.tv_book_time_start);
			tvDatetimeEnd = FindViewById<TextView> (Resource.Id.tv_book_time_end);
			tvTimeError = FindViewById<TextView> (Resource.Id.tv_time_booking_error);
			var btnBookTime = FindViewById<Button> (Resource.Id.btn_book_request);
			var tvDay = FindViewById<TextView> (Resource.Id.tv_day_standardhours_select);
			var tvStartTime = FindViewById<TextView> (Resource.Id.tv_start_standardhours_select);
			var tvEndTime = FindViewById<TextView> (Resource.Id.tv_end_standardhours_select);
			var llStartTime = FindViewById<LinearLayout> (Resource.Id.llStartTimeBooking);
			var llEndTime = FindViewById<LinearLayout> (Resource.Id.llEndTimeBooking);

			tvDay.Text = "";
			tvStartTime.Text = "";
			tvEndTime.Text = "";

//			foreach (var standarHour in constants.specialistInfo.SpecialistDetail.ListStandardHour) {
//				if (standarHour.Day != null) {
//					tvDay.Text += standarHour.Day.Trim ()+ ":" + "\n";
//					tvStartTime.Text += standarHour.Start.Trim () + "  -" + "\n";
//					tvEndTime.Text += standarHour.End.Trim ()+"\n";
//				}
//			}

//			datetimeStart = new DateTime (DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, DateTime.Now.Hour, DateTime.Now.Minute, DateTime.Now.Second);
//			datetimeEnd = new DateTime (DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, DateTime.Now.Hour, DateTime.Now.Minute, DateTime.Now.Second);

			llStartTime.Click += (sender, e) => {
				tvTimeError.Visibility = ViewStates.Gone;
				isStartDatepicker = true;
				dialog.showSelectPreTime(isStartDatepicker, datetimeStart);
			};

			llEndTime.Click += (sender, e) => {
				tvTimeError.Visibility = ViewStates.Gone;
				isStartDatepicker = false;
				dialog.showSelectPreTime(isStartDatepicker, datetimeEnd);
			};

			btnBookTime.Click += (sender, e) => {
				if (utilsAndroid.checkValidateTimeBooking (this, Utils.getDateTimeNow(MApplication.getInstance().timezoneName), datetimeStart, datetimeEnd, tvTimeError)) {
					if (isStandardHour) {
						if (Utils.checkIsStandarHour (datetimeStart, datetimeEnd, constants.specialistInfo.SpecialistDetail.ListStandardHour)) {
							dialog.showPreTimeConfirm(strEnquiry, datetimeStart, datetimeEnd);
						} else {
							tvTimeError.Visibility = ViewStates.Visible;
							tvTimeError.SetText(Resource.String.standard_time_error);
						}
					} else {
						if (!Utils.checkIsStandarHour (datetimeStart, datetimeEnd, constants.specialistInfo.SpecialistDetail.ListStandardHour)) {
							dialog.showPreTimeConfirm(strEnquiry, datetimeStart, datetimeEnd);
						} else {
							tvTimeError.Visibility = ViewStates.Visible;
							tvTimeError.SetText(Resource.String.out_of_time_error);
						}
					}
				} else {
					tvTimeError.Visibility = ViewStates.Visible;
				}
			};

			datetimeStart = Utils.getDateTimeNow (MApplication.getInstance ().timezoneName);// DateTime.Now;	
			tvDatetimeStart.Text = datetimeStart.ToString (constants.sDateFormat) + " " + datetimeStart.ToString(constants.sTimeFormat, new CultureInfo("en-us")).ToUpper();
			datetimeEnd = Utils.getDateTimeNow (MApplication.getInstance ().timezoneName); //DateTime.Now;	
			tvDatetimeEnd.Text = datetimeEnd.ToString (constants.sDateFormat) + " " + datetimeEnd.ToString(constants.sTimeFormat, new CultureInfo("en-us")).ToUpper();


			GetSystemConfig getSysConfig = new GetSystemConfig (this);
			getSysConfig.actionGetConfigDelegate = this;
			getSysConfig.getSysConfig ();
		}
Esempio n. 3
0
		private void setActionToView(){
			Background bgEmailProfile = new Background (this, Resource.Drawable.ic_emailprofile, Resource.Drawable.ic_emailprofile_pressed);
			imgEmailProfile.SetBackgroundDrawable (bgEmailProfile);
			imgEmailProfile.Click += (sender, e) => {
				if (constants.specialistInfo != null && constants.specialistInfo.SpecialistDetail != null) {
					SendEmailUI dialog = new SendEmailUI(this);
					dialog.actionDelegate = this;
					dialog.showEmailDialog(MApplication.getInstance ().specialistID);
				}
			};

			imgFavorite.Click += (sender, e) => {
				if (constants.specialistInfo != null && constants.specialistInfo.SpecialistDetail != null) {
					if (constants.specialistInfo.IsFavourite) {
						if(dialogFavorite == null){
							dialogFavorite = new FavoriteUI(this);
							dialogFavorite.actionFavoriteDelegate = this;
						}
						dialogFavorite.removeFavoriteRequest(MApplication.getInstance ().specialistID);
					} else {
						if(dialogFavorite == null){
							dialogFavorite = new FavoriteUI(this);
							dialogFavorite.actionFavoriteDelegate = this;
						}
						dialogFavorite.addToFavouriteRequest(MApplication.getInstance ().specialistID);
					}
				}
			};

			Background bgRating = new Background (this, Resource.Drawable.icon_feedback, Resource.Drawable.icon_feedback_pressed);
			imgRating.SetBackgroundDrawable (bgRating);
			imgRating.Click += (sender, e) => {
				if(constants.bookingInfo.IsFeedback){
					if(dialogFeedbackReview == null){
						dialogFeedbackReview = new RatingFeedbackReview(this);
					}
					dialogFeedbackReview.showFeedbackReview(constants.bookingInfo.Rating, constants.bookingInfo.Feedback);
				} else {
					if(dialogFeedback == null){
						dialogFeedback = new RatingFeedbackUI(this, constants.bookingInfo.PastBooking.CallId);
						dialogFeedback.actionRatingDelegate = this;
					}
					dialogFeedback.showRatingFeedback();
				}
			};

			llTalknow.Click += (sender, e) => {
				if (constants.specialistInfo != null && constants.specialistInfo.SpecialistDetail != null) {
					if(constants.specialistInfo.Account.CurrentAvailabilityStatus == (int)Constants.STATUS_CONSULTANT.NotAvailable){
						popupNotice.showNoticeDialog(GetString(Resource.String.title_notice), constants.specialistInfo.Account.Name +" is not available. You can't use this feature");
					} else{
						TalkNowUI dialog = new TalkNowUI(this);
						dialog.actionTalknowDelegate = this;
						dialog.ShowTalkNowEnquiry();
					}
				}
			};				

			llStandard.Click += delegate {
				if (constants.specialistInfo != null && constants.specialistInfo.SpecialistDetail != null) {
					isStandardHour = true;
					if(dialogBookPreTime == null)
						dialogBookPreTime = new BookPreTimeUI(this, isStandardHour);
					dialogBookPreTime.actionDelegate = this;
					dialogBookPreTime.showPreTimeEnquiry(isStandardHour);
				}
			};

			llSoonest.Click += delegate {
				if (constants.specialistInfo != null && constants.specialistInfo.SpecialistDetail != null) {
					BookASAPUI dialog = new BookASAPUI(this);
					dialog.actionDelegate = this;
					dialog.showASAPEnquiry();
				}
			};

			llAnother.Click += delegate {
				if (constants.specialistInfo != null && constants.specialistInfo.SpecialistDetail != null) {
					isStandardHour = false;
					if(dialogBookPreTime == null)
						dialogBookPreTime = new BookPreTimeUI(this, isStandardHour);
					dialogBookPreTime.actionDelegate = this;
					dialogBookPreTime.showPreTimeEnquiry(isStandardHour);
				}
			};
		}