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

			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);

			var tvName = FindViewById<TextView> (Resource.Id.tv_name_past_detail);
			var avatar = FindViewById<ImageView> (Resource.Id.avatar_past_detail);
			numRating = FindViewById<ImageView> (Resource.Id.img_num_rating_pass);
			imgFavorite = FindViewById<ImageView> (Resource.Id.img_add_favorite_pass);
			imgEmailProfile = FindViewById<ImageView> (Resource.Id.img_email_profile_pass);
			imgRating = FindViewById<ImageView> (Resource.Id.img_rating_pass);

			tvExpiredNotice = FindViewById<TextView> (Resource.Id.tv_expired_notice);
			//llSoonest = FindViewById<LinearLayout> (Resource.Id.llSoonestDetail);
			//llStandard = FindViewById<LinearLayout> (Resource.Id.llStandardDetail);
			//llAnother = FindViewById<LinearLayout> (Resource.Id.llAnotherTimeDetail);
			llTalknow = FindViewById<LinearLayout> (Resource.Id.llTalkNowDetail);
			llActionBooking = FindViewById<LinearLayout> (Resource.Id.llActionBooking);

			tvDateStartCall = FindViewById<TextView> (Resource.Id.tv_start_date_past);
			tvTimeStartCall = FindViewById<TextView> (Resource.Id.tv_start_time_past);
			tvDateEndCall = FindViewById<TextView> (Resource.Id.tv_end_date_past);
			tvTimeEndCall = FindViewById<TextView> (Resource.Id.tv_end_time_past);
			tvDuration = FindViewById<TextView> (Resource.Id.tv_total_time_past);
			tvCost = FindViewById<TextView> (Resource.Id.tv_total_cost_past);
			tvFee = FindViewById<TextView> (Resource.Id.tv_total_fee_past);
			llFileAttachment = FindViewById<LinearLayout> (Resource.Id.llFileAtachment);
			llGroupFee = FindViewById<LinearLayout> (Resource.Id.llGroupFeePass);
			tvNoticeWaivedFee = FindViewById<TextView> (Resource.Id.tv_notice_waived_pass);
			tvStandardCost = FindViewById<TextView> (Resource.Id.tvDolarStandard);
			//tvAnotherCost = FindViewById<TextView> (Resource.Id.tvDolarAnotherTime);
			tvTalkNowCost = FindViewById<TextView> (Resource.Id.tvDolarTalkNow);
			llStatusPass = FindViewById<LinearLayout> (Resource.Id.llGroupStatus);
			llDetailPass = FindViewById<LinearLayout> (Resource.Id.llContentPass);
			imgIconStep2 = FindViewById<ImageView> (Resource.Id.imgIconCallingStep2);
			tvDeferInfo = FindViewById<TextView> (Resource.Id.tv_sub_waiting_call_1);
			tvDialStep2 = FindViewById<TextView> (Resource.Id.tvDialStep2);

			pastDetailActivity = this;

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

			deleteFile = new DeleteFile (this);
			deleteFile.deleteFileAction = this;

			uploadPhoto = new UploadPhoto(this);
			uploadPhoto.actionUploadPhotoDelegate = this;

			transcribe = new TranscribeRequest (this);
			transcribe.transcribeDelegate = this;

			tvDeferInfo.Visibility = ViewStates.Gone;
			llStatusPass.Visibility = ViewStates.Gone;
			tvExpiredNotice.Visibility = ViewStates.Gone;

			numRating.SetImageResource(utilsAndroid.getIconRatingResource(0));
			if (MApplication.getInstance ().isConsultant) {
				progressDialogParent.Show ();
				GetBookingInfo getBookingInfo = new GetBookingInfo (this);
				getBookingInfo.actionDelegate = this;
				getBookingInfo.getBookingInfo (constants.bookingInfo.Id);
			} else {
				llActionBooking.Visibility = ViewStates.Gone;
				progressDialogParent.Show ();
				GetSpecialistProfile getSpecInfo = new GetSpecialistProfile (this);
				getSpecInfo.actionDelegate = this;
				getSpecInfo.getSpecProfile (MApplication.getInstance ().specialistID);
			}

			tvNoticeWaivedFee.Visibility = ViewStates.Gone;

			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);
			}

			if (MApplication.getInstance ().isConsultant) {
				tvName.Text = constants.bookingInfo.CustomerName;
				UrlImageViewHelper.UrlImageViewHelper.SetUrlDrawable(avatar, HttpConstants.BASE_URL + constants.bookingInfo.CustomerAvatar, Resource.Drawable.special_home, constants.iTimeLoading, this);

				imgFavorite.Visibility = ViewStates.Gone;
				imgEmailProfile.Visibility = ViewStates.Gone;
				llSoonest.Visibility = ViewStates.Gone;
				llStandard.Visibility = ViewStates.Gone;
				llAnother.Visibility = ViewStates.Gone;
				llTalknow.Visibility = ViewStates.Gone;
			} else {
				tvName.Text = constants.bookingInfo.SpecialistName;
				UrlImageViewHelper.UrlImageViewHelper.SetUrlDrawable(avatar, HttpConstants.BASE_URL + constants.bookingInfo.SpecialistAvatar, Resource.Drawable.special_home, constants.iTimeLoading, this);

				llGroupFee.Visibility = ViewStates.Gone;
			}

			tvDateStartCall.Text = Utils.getDateTimeNow (MApplication.getInstance ().timezoneName).ToString (constants.sDateFormat);
			tvTimeStartCall.Text = Utils.getDateTimeNow (MApplication.getInstance ().timezoneName).ToString (constants.sTimeFormat, new CultureInfo("en-us")).ToUpper();
			tvDateEndCall.Text = Utils.getDateTimeNow (MApplication.getInstance ().timezoneName).ToString (constants.sDateFormat);
			tvTimeEndCall.Text = Utils.getDateTimeNow (MApplication.getInstance ().timezoneName).ToString (constants.sTimeFormat, new CultureInfo("en-us")).ToUpper();

			setDataPastBookingToView ();

			setActionToView ();

			TCNotificationCenter.defaultCenter.addObserver (this, Constants.kPostUploadFileSuccess, new TCSelector (onUploadFileSuccess));
			TCNotificationCenter.defaultCenter.addObserver (this, Constants.kPostDeleteFileSuccess, new TCSelector (onDeleteFileSuccess));
		}
		protected override void OnResume ()
		{
			base.OnResume ();
			if (MApplication.getInstance ().isLoginAfterSearch && !constants.specialistInfo.isLoaded) {
				GetSpecialistProfile getSpecInfo = new GetSpecialistProfile (this);
				getSpecInfo.actionDelegate = this;
				getSpecInfo.getSpecProfile (MApplication.getInstance ().specialistID);
			}

			if (MApplication.getInstance ().isLogedIn) {
				constants.currentActivity = this;
			} else {
				constants.currentActivity = null;
				constants.currentActivityNotLogIn = this;
			}

			if (MApplication.getInstance ().isConsultant) {
				llBookTime.Visibility = ViewStates.Gone;
				llBookTime1.Visibility = ViewStates.Gone;

				btnAddFavorite.Visibility = ViewStates.Gone;
				btnEmailProfile.Visibility = ViewStates.Gone;
			}
			if (constants.specialistInfo.IsFavourite)
				btnAddFavorite.SetImageResource (Resource.Drawable.ic_favorite_selected);
		}