public UpdateReservationMobileResponse updateReservationMobile(UpdateReservationMobileRequest reservationMobileRequest, string token) { UpdateReservationMobileResponse result = null; try { using (var client = new HttpClient()) { client.BaseAddress = new Uri(ConstantData.ApiURL.ToString() + "ReservationMobile/UpdateReservationMobile"); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token); var myContent = JsonConvert.SerializeObject(reservationMobileRequest); var buffer = Encoding.UTF8.GetBytes(myContent); var byteContent = new ByteArrayContent(buffer); byteContent.Headers.ContentType = new MediaTypeHeaderValue("application/json"); var response = client.PostAsync(client.BaseAddress, byteContent).Result; if (response.IsSuccessStatusCode) { var responseStream = response.Content.ReadAsStringAsync().Result; result = JsonConvert.DeserializeObject <UpdateReservationMobileResponse>(responseStream); } } } catch (Exception ex) { throw ex; } return(result); }
private async void updateAgreement() { ExtendAgreementRequest request = new ExtendAgreementRequest(); ExtendAgreementResponse response = null; request.agreementId = agreementDetail.AgreementID; request.extendDate = agreementDetail.CheckinDate.AddDays(int.Parse(NumberOfDays.SelectedItem.ToString())).ToString("MM/dd/yyyy hh:mm tt").Replace("PM", "pm").Replace("AM", "am"); int agreementID = 0; //AgreementReview agreementReview = new AgreementReview(); //agreementReview = agreementDetail; //agreementReview.OldChcekInDate = agreementReview.CheckinDate; //agreementReview.CheckinDate = extendedDate.Date + extendedTime.Time; //agreementReview.CheckinDateString = (extendedDate.Date + extendedTime.Time).ToString(); //agreementReview.CheckoutDateString = agreementReview.CheckoutDate.ToString(); //agreementReview.AgreementReferral = new Referral(); //agreementReview.UpdatedDate = DateTime.Now; //agreementReview.ChangedDate = DateTime.Now; //agreementReview.AgreementStatus = NativeCamperVansModel.Constants.AgreementStatusConst.Open; //agreementReview.AgreementInsurance = new AgreementInsurence(); //agreementReview.Customer = new Customer(); AgreementController controller = new AgreementController(); bool isAgBusy = false; if (!isAgBusy) { try { isAgBusy = true; await PopupNavigation.Instance.PushAsync(new LoadingPopup("")); await Task.Run(() => { response = controller.extendAgreement(request, _token); }); } catch (Exception ex) { await PopupNavigation.Instance.PushAsync(new Error_popup(ex.Message)); } finally { isAgBusy = false; await PopupNavigation.Instance.PopAsync(); if (response != null) { if (response.message.ErrorCode == "200") { MessagingCenter.Send(this, "agreementUpdated"); await PopupNavigation.Instance.PopAllAsync(); } else { await PopupNavigation.Instance.PushAsync(new Error_popup("Update failed. Please try again.")); } } } } }
private void updateAgreement() { ExtendAgreementRequest request = new ExtendAgreementRequest(); ExtendAgreementResponse response = null; request.agreementId = agreementDetail.AgreementID; request.extendDate = agreementDetail.CheckinDate.AddDays(int.Parse(NumberOfDays.SelectedItem.ToString())).ToString("MM/dd/yyyy hh:mm tt").Replace("PM", "pm").Replace("AM", "am"); int agreementID = 0; //AgreementReview agreementReview = new AgreementReview(); //agreementReview = agreementDetail; //agreementReview.OldChcekInDate = agreementReview.CheckinDate; //agreementReview.CheckinDate = extendedDate.Date + extendedTime.Time; //agreementReview.CheckinDateString = (extendedDate.Date + extendedTime.Time).ToString(); //agreementReview.CheckoutDateString = agreementReview.CheckoutDate.ToString(); //agreementReview.AgreementReferral = new Referral(); //agreementReview.UpdatedDate = DateTime.Now; //agreementReview.ChangedDate = DateTime.Now; //agreementReview.AgreementStatus = BespokeMobileModel.Constants.AgreementStatusConst.Open; //agreementReview.AgreementInsurance = new AgreementInsurence(); //agreementReview.Customer = new Customer(); AgreementController controller = new AgreementController(); response = controller.extendAgreement(request, _token); if (response.message.ErrorCode == "200") { MessagingCenter.Send(this, "agreementUpdated"); PopupNavigation.Instance.PopAllAsync(); } else { PopupNavigation.Instance.PushAsync(new Error_popup("Update failed. Please try again.")); } PopupNavigation.Instance.PopAllAsync(); }
public UpdateReservationMobileResponse updateReservationMobile(UpdateReservationMobileRequest reservationMobileRequest, string token) { UpdateReservationMobileResponse mobileResponse = null; try { mobileResponse = reservationservice.updateReservationMobile(reservationMobileRequest, token); } catch (Exception ex) { throw ex; } return(mobileResponse); }
private UpdateReservationMobileResponse updateReservationMobile(UpdateReservationMobileRequest reservationMobileRequest, string token) { UpdateReservationMobileResponse response = null; ReservationController reservationController = new ReservationController(); try { response = reservationController.updateReservationMobile(reservationMobileRequest, token); } catch (Exception ex) { throw ex; } return(response); }
public EditSummaryOfCharges(ReservationView reservationView, ReservationViewModel reservationData) { InitializeComponent(); var assembly = typeof(SummaryOfChargesPage); this.reservationView = reservationView; summaryMobileRequest = new GetCalculateSummaryMobileRequest(); summaryMobileResponsecs = null; ReservationMobileResponse = null; ReservationMobileRequest = new UpdateReservationMobileRequest(); summaryMobileRequest.reservation = reservationView; token = App.Current.Properties["currentToken"].ToString(); termsandConditionByTypeRequest = new GetTermsandConditionByTypeRequest(); termsandConditionByTypeRequest.clientId = Constants.ClientId; termsandConditionByTypeRequest.typeId = 3; termsandConditionByTypeResponse = null; this.reservationData = reservationData; }
public ExtendPopup(ReservationViewModel reservationData) { InitializeComponent(); _token = App.Current.Properties["currentToken"].ToString(); this.reservationData = reservationData; reservationView = new ReservationView(); reservationView = reservationData.Reservationview; reservationView.RateDetailsList = reservationData.RateDetailsList; reservationView.MiscList2 = reservationData.MiscChargeList; reservationView.TaxList2 = reservationData.TaxList; extendedDate.MinimumDate = ((DateTime)reservationView.EndDate).AddHours(24); extendedDate.Format = "dddd, MMMM d, yyyy"; extendedTime.Time = new TimeSpan(((DateTime)reservationView.EndDate).Hour, ((DateTime)reservationView.EndDate).Minute, ((DateTime)reservationView.EndDate).Second); extendedTime.Format = "hh mm tt"; ReservationMobileRequest = new UpdateReservationMobileRequest(); response = null; search = new ReservationConfigurationVehicleSearch(); vehicleMobileRequest = new GetReservationConfigurationMobileRequest(); vehicleMobileResponse = null; search.ClientId = Constants.ClientId; search.LocationId = (int)reservationView.StartLocationId; search.CheckInLocationId = (int)reservationView.EndLocationId; search.IsOnline = true; search.StartDate = (DateTime)reservationView.StartDate; search.EndDate = (DateTime)reservationView.EndDate; search.VehicleTypeId = (int)reservationView.VehicleTypeID; search.VehicleCategoryId = 0; search.VehicleMakeID = 0; search.ModelId = 0; search.NumberOfSeats = 0; search.RentalPeriod = 0; search.VehicleId = 0; vehicleMobileRequest.search = search; type = ReferenceType.Reservation; summaryMobileRequest = new GetCalculateSummaryMobileRequest(); summaryMobileResponsecs = null; paidAmmount = (decimal)reservationData.ReservationTotal.AmountPaid; }
private async void BookNowBtn_Clicked(object sender, EventArgs e) { if (TCcheckBox.IsChecked) { if ((int)App.Current.Properties["CustomerId"] == 0) { await PopupNavigation.Instance.PushAsync(new AskForLogin("Please login for continue your booking")); } else { reservationView.CustomerId = (int)App.Current.Properties["CustomerId"]; reservationView.BasePrice = Convert.ToDecimal(summaryMobileResponsecs.rate.ReservationSummary.BaseRate); reservationView.ReservationNumber = reservationData.Reservationview.ReservationNumber; reservationView.EstimatedTotal = Convert.ToDecimal(summaryMobileResponsecs.rate.ReservationSummary.EstimatedTotal); reservationView.Status = reservationData.Reservationview.Status; reservationView.ReservationStatus = reservationData.Reservationview.ReservationStatus; reservationView.StatusId = reservationData.Reservationview.StatusId; ReservationMobileRequest.reservationData = reservationView; bool busy = false; if (!busy) { try { busy = true; await PopupNavigation.Instance.PushAsync(new LoadingPopup("Upadating reservation...")); await Task.Run(() => { try { ReservationMobileResponse = updateReservationMobile(ReservationMobileRequest, token); } catch (Exception ex) { PopupNavigation.Instance.PushAsync(new ErrorWithClosePagePopup(ex.Message)); } }); } finally { busy = false; if (PopupNavigation.Instance.PopupStack.Count == 1) { await PopupNavigation.Instance.PopAllAsync(); } if (PopupNavigation.Instance.PopupStack.Count > 1) { if (PopupNavigation.Instance.PopupStack[PopupNavigation.Instance.PopupStack.Count - 1].GetType() != typeof(ErrorWithClosePagePopup)) { await PopupNavigation.Instance.PopAllAsync(); } } if (ReservationMobileResponse != null) { if (ReservationMobileResponse.message.ErrorCode == "200") { if (Convert.ToInt32(ReservationMobileResponse.ReservationNumber) > 0) { await PopupNavigation.Instance.PushAsync(new ReservationSavedPopup(Convert.ToInt32(ReservationMobileResponse.ReservationNumber))); } } else { await PopupNavigation.Instance.PushAsync(new ErrorWithClosePagePopup(ReservationMobileResponse.message.ErrorMessage)); } } } } } } else { await PopupNavigation.Instance.PushAsync(new Error_popup("Please accept the terms and conditions")); } }
private async void updateReservation() { DateTime endDate = ((DateTime)reservationView.EndDate).AddDays(int.Parse(NumberOfDays.SelectedItem.ToString())); string endDateStr = endDate.ToString("MM/dd/yyyy hh:mm tt").Replace("-", "/"); reservationView.EndDate = endDate; reservationView.EndDateStr = endDateStr; vehicleMobileRequest.search.EndDate = endDate; if (reservationView.VehicleId > 0) { vehicleMobileRequest.search.VehicleId = reservationView.VehicleId; } ; bool busy = false; if (!busy) { try { busy = true; await PopupNavigation.Instance.PushAsync(new LoadingPopup("Getting vehicles informations...")); await Task.Run(() => { try { vehicleMobileResponse = getVehicleTypesMobileNew(vehicleMobileRequest, _token); } catch (Exception ex) { PopupNavigation.Instance.PushAsync(new ErrorWithClosePagePopup(ex.Message)); } }); } finally { busy = false; await PopupNavigation.Instance.PopAsync(); if (vehicleMobileResponse != null) { if (vehicleMobileResponse.listVehicle != null) { if (vehicleMobileResponse.listVehicle.Count > 0) { if (reservationView.VehicleId > 0) { foreach (ReservationVehicleSearchViewModel rvsvm in vehicleMobileResponse.listVehicle) { if (rvsvm.vehicleId == reservationView.VehicleId) { Rates rates = JsonConvert.DeserializeObject <Rates>(JsonConvert.SerializeObject(rvsvm.RateDetail)); rates.RateId = rvsvm.RateDetail.RateID; List <Rates> rateDewtails = new List <Rates>(); rates.StartDateStr = reservationView.StartDateStr; rates.EndDateStr = reservationView.EndDateStr; rateDewtails.Add(rates); reservationView.RateDetailsList = rateDewtails; reservationView.TotalDays = rates.TotalDays; reservationView.RateTotal = (decimal)rates.RateTotal; break; } } } else { foreach (ReservationVehicleSearchViewModel rvsvm in vehicleMobileResponse.listVehicle) { if (rvsvm.VehicleTypeId == reservationView.VehicleTypeID) { Rates rates = JsonConvert.DeserializeObject <Rates>(JsonConvert.SerializeObject(rvsvm.RateDetail)); rates.RateId = rvsvm.RateDetail.RateID; List <Rates> rateDewtails = new List <Rates>(); rates.StartDateStr = reservationView.StartDateStr; rates.EndDateStr = reservationView.EndDateStr; rateDewtails.Add(rates); reservationView.RateDetailsList = rateDewtails; reservationView.TotalDays = rates.TotalDays; reservationView.RateTotal = (decimal)rates.RateTotal; break; } } } } } } } } if (reservationView.MiscList2 != null) { foreach (MiscChargeSearchReview msv in reservationView.MiscList2) { msv.EndDate = endDate; msv.StartDateString = reservationView.StartDateStr; msv.EndDateString = endDateStr; msv.IsSelected = true; } } if (reservationView.TaxList2 != null) { foreach (LocationTaxModel ltm in reservationView.TaxList2) { ltm.IsSelected = true; } } //ReservationMobileRequest.reservationData = reservationView; //ReservationController reservationController = new ReservationController(); //try //{ // response = reservationController.updateReservationMobile(ReservationMobileRequest, _token); //} //catch (Exception ex) //{ // throw ex; //} //if (response != null) //{ // if (response.message.ErrorCode == "200") // { // MessagingCenter.Send(this, "reservationUpdated"); // await PopupNavigation.Instance.PopAllAsync(); // } // else // { // await PopupNavigation.Instance.PushAsync(new Error_popup(response.message.ErrorMessage)); // } //} ReservationMobileRequest.reservationData = reservationView; ReservationController reservationController = new ReservationController(); bool isbusy = false; if (!isbusy) { try { isbusy = true; await PopupNavigation.Instance.PushAsync(new LoadingPopup("checking bookable...")); await Task.Run(() => { //update reservation in database try { response = reservationController.updateReservationMobile(ReservationMobileRequest, _token); } catch (Exception ex) { PopupNavigation.Instance.PushAsync(new ErrorWithClosePagePopup(ex.Message)); } }); } finally { isbusy = false; if (response != null) { if (response.message.ErrorCode == "200") { MessagingCenter.Send(this, "reservationUpdated"); if (PopupNavigation.Instance.PopupStack.Count == 1) { await PopupNavigation.Instance.PopAllAsync(); } if (PopupNavigation.Instance.PopupStack.Count > 1) { if (PopupNavigation.Instance.PopupStack[PopupNavigation.Instance.PopupStack.Count - 1].GetType() != typeof(ErrorWithClosePagePopup)) { await PopupNavigation.Instance.PopAsync(); } } } else { await PopupNavigation.Instance.PushAsync(new Error_popup(response.message.ErrorMessage)); } } else { await PopupNavigation.Instance.PushAsync(new Error_popup("Update failed")); } } } }
private async void updateAgreement() { ExtendAgreementRequest request = new ExtendAgreementRequest(); ExtendAgreementResponse response = null; request.agreementId = agreementDetail.AgreementID; request.extendDate = agreementDetail.CheckinDate.AddDays(int.Parse(NumberOfDays.SelectedItem.ToString())).ToString("MM/dd/yyyy hh:mm tt").Replace("PM", "pm").Replace("AM", "am"); //AgreementReview agreementReview = new AgreementReview(); //agreementReview = agreementDetail; //agreementReview.OldChcekInDate = agreementReview.CheckinDate; //agreementReview.CheckinDate = extendedDate.Date + extendedTime.Time; //agreementReview.CheckinDateString = (extendedDate.Date + extendedTime.Time).ToString(); //agreementReview.CheckoutDateString = agreementReview.CheckoutDate.ToString(); //agreementReview.AgreementReferral = new Referral(); //agreementReview.UpdatedDate = DateTime.Now; //agreementReview.ChangedDate = DateTime.Now; //agreementReview.AgreementStatus = MaxVonGrafKftMobileModel.Constants.AgreementStatusConst.Open; //agreementReview.AgreementInsurance = new AgreementInsurence(); //agreementReview.Customer = new Customer(); AgreementController controller = new AgreementController(); bool isAgBusy = false; if (!isAgBusy) { try { isAgBusy = true; await PopupNavigation.Instance.PushAsync(new LoadingPopup("")); await Task.Run(() => { response = controller.extendAgreement(request, _token); }); } catch (Exception ex) { await PopupNavigation.Instance.PushAsync(new Error_popup(ex.Message)); } finally { isAgBusy = false; await PopupNavigation.Instance.PopAsync(); if (response != null) { if (response.message != null) { if (response.message.ErrorCode == "200") { if (response.agreementReview.BalanceDue > 0) { await Navigation.PushModalAsync(new ProcessPaymentPage((decimal)response.agreementReview.BalanceDue, response.agreementReview.AgreementID, locationIdForPayment, response.agreementReview, request)); } else { await PopupNavigation.Instance.PushAsync(new Error_popup("Sorry, Something went wrong , Please try again. ")); } } else { await PopupNavigation.Instance.PushAsync(new Error_popup("Sorry, Update failed, Please try again. ")); } } else { await PopupNavigation.Instance.PushAsync(new Error_popup("Sorry, Update failed, Please try again. ")); } } else { await PopupNavigation.Instance.PushAsync(new Error_popup("Sorry, Update failed, Please try again. ")); } } } //if (response.message.ErrorCode == "200") //{ // //MessagingCenter.Send(this, "agreementUpdated"); // PopupNavigation.Instance.PopAllAsync(); //} }