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 (); } }
protected override void OnCreate (Bundle bundle) { base.OnCreate (bundle); RequestWindowFeature (WindowFeatures.ActionBar); SetContentView (Resource.Layout.popup_confirm_bookings); 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); llProgress = FindViewById<LinearLayout> (Resource.Id.llProgressBar); llProgress.Visibility = ViewStates.Gone; popupNotice = new PopupNoticeInfomation(this); popupNotice.noticeDelegate = this; deleteFile = new DeleteFile (this); deleteFile.deleteFileAction = this; var avatar = FindViewById<ImageView> (Resource.Id.avatar_popup_booking); var tvName = FindViewById<TextView> (Resource.Id.tv_name_popup_booking); var tvTitleTime = FindViewById<TextView> (Resource.Id.tv_title_proposed_time); var tvConfirmedTime = FindViewById<TextView> (Resource.Id.tv_time_popup_booking); var tvFee = FindViewById<TextView> (Resource.Id.tv_fee_popup_booking); var btnAddfile = FindViewById<Button> (Resource.Id.btn_addfile_confirm_booking); var btnTalkNowRequest = FindViewById<Button> (Resource.Id.btn_request_talknow_booking); var btnDecline = FindViewById<Button> (Resource.Id.btn_decline_confirm_booking); llFileAttachment = FindViewById<LinearLayout> (Resource.Id.llFileAttachConfirmed); var tvEnquiry = FindViewById<TextView> (Resource.Id.tv_enquiry_booking); var tvFeeTitle = FindViewById<TextView> (Resource.Id.tv_title_cost_confirm); btnTalkNowRequest.SetText(Resource.String.talkNow_title_button); btnAddfile.SetText(Resource.String.add_file_btn); tvTitleTime.SetText(Resource.String.confirmed_time_title); btnTalkNowRequest.Visibility = ViewStates.Gone; if (MApplication.getInstance ().isConsultant) { if (Utils.isShowTalkNowRequest (DateTime.Parse (constants.bookingInfo.StartTime), DateTime.Parse (constants.bookingInfo.EndTime), MApplication.getInstance ().timezoneName)){ btnTalkNowRequest.Visibility = ViewStates.Visible; } } tvEnquiry.Text = constants.bookingInfo.Enquiry; datetimeStart = DateTime.Parse (constants.bookingInfo.StartTime); datetimeEnd = DateTime.Parse (constants.bookingInfo.EndTime); if (datetimeStart.Date == datetimeEnd.Date) { tvConfirmedTime.Text = datetimeStart.ToString (constants.sDateFormat) + " " + datetimeStart.ToString (constants.sTimeFormat, new CultureInfo("en-us")).ToUpper () + " - " + datetimeEnd.ToString (constants.sTimeFormat, new CultureInfo("en-us")).ToUpper (); } else { tvConfirmedTime.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 (); } 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"; } 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"; } btnTalkNowRequest.Click += (sender, e) => { if (Utils.isShowTalkNowRequest (DateTime.Parse (constants.bookingInfo.StartTime), DateTime.Parse (constants.bookingInfo.EndTime), MApplication.getInstance ().timezoneName)){ MApplication.getInstance().customerID = constants.bookingInfo.CustomerId; if(talkNowUI == null){ talkNowUI = new TalkNowUI(this); talkNowUI.actionTalknowDelegate = this; } talkNowUI.talknowRequest(false, constants.bookingInfo.Id); } else { showExpiredNotice(); } }; uploadPhoto = new UploadPhoto(this); uploadPhoto.actionUploadPhotoDelegate = this; btnAddfile.Click += (sender, e) => { if (!utilsAndroid.checkIsExpired(DateTime.Parse (constants.bookingInfo.EndTime))){ if(uploadPhoto == null){ uploadPhoto = new UploadPhoto(this); uploadPhoto.actionUploadPhotoDelegate = this; } uploadPhoto.selectActionUpload(); } else { showExpiredNotice(); } }; btnDecline.Text = GetString (Resource.String.cancel_consultation); btnDecline.Click += (sender, e) => { if (!utilsAndroid.checkIsExpired(DateTime.Parse (constants.bookingInfo.EndTime))){ if(updateBookingStatus == null){ updateBookingStatus = new UpdateBookingStatus(this); updateBookingStatus.actionUpdateBookingStatus = this; } updateBookingStatus.showDeclineBookingConfirm(); } else { showExpiredNotice(); } }; if (constants.bookingInfo.BookingDocuments != null && constants.bookingInfo.BookingDocuments.Count > 0) { int isize = constants.bookingInfo.BookingDocuments.Count; for (int i = 0; i < isize; i++) { bookingDocs.Add(constants.bookingInfo.BookingDocuments[i]); } utilsAndroid.addFileView (this, bookingDocs, true, addFiles, deleteFile, llFileAttachment); } TCNotificationCenter.defaultCenter.addObserver (this, Constants.kPostUploadFileSuccess, new TCSelector (onUploadFileSuccess)); TCNotificationCenter.defaultCenter.addObserver (this, Constants.kPostDeleteFileSuccess, new TCSelector (onDeleteFileSuccess)); }