public ProcessPaymentPage(decimal balanceDue, int agreementId, int locationIdForPayment, AgreementReview agreementReview, ExtendAgreementRequest request) { InitializeComponent(); this.balanceDue = balanceDue; amountLAbel.Text = "$ " + balanceDue.ToString("0.00"); creditCardRequest = new GetAllCustomerMobileCreditCardRequest(); creditCards = null; customerId = (int)App.Current.Properties["CustomerId"]; token = App.Current.Properties["currentToken"].ToString(); billingInformation = new BillingInformation(); PaymentResponse = null; this.agreementId = agreementId; this.locationIdForPayment = locationIdForPayment; this.agreementReview = agreementReview; submitPaymentAndExtendAgreementRequest = new SubmitPaymentAndExtendAgreementRequest(); if (agreementReview != null) { isExtendAgreement = true; } else if (agreementReview == null) { isExtendAgreement = false; } promotionMobileRequest = new GetPromotionMobileRequest(); promotionMobileResponse = null; appliedPromoId = 0; extendAgreemetRequest = request; extendAgreementResponse = null; }
public ExtendAgreementResponse extendAgreement(ExtendAgreementRequest request, string token) { ExtendAgreementResponse result = null; try { using (var client = new HttpClient()) { client.BaseAddress = new Uri(ConstantData.ApiURL.ToString() + "Agreement/ExtendAgreementDetails"); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token); var myContent = JsonConvert.SerializeObject(request); 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 <ExtendAgreementResponse>(responseStream); } } } catch (Exception ex) { throw ex; } return(result); }
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(); }
private void applyAgreementPromotion(GetPromotionMobileResponse promotionMobileResponse) { extendAgreemetRequest.addPromotion = new PromotionItem() { PromotionID = promotionMobileResponse.PromResult.PromotionID, PromotionDiscount = (decimal)promotionMobileResponse.PromResult.DiscountValue, PromotionCode = promotionMobileResponse.promotion.PromotionCode }; extendAgreemetRequest.deletePromotion = null; promoTitileLabel.Text = promotionMobileResponse.promotion.PromotionCode; promoDetailLabel.Text = "$" + promotionMobileResponse.promotion.DiscountValue.ToString("0.00"); appliedPromoId = promotionMobileResponse.PromResult.PromotionID; hideAddPromotionGrid(); AgreementController controller = new AgreementController(); try { extendAgreementResponse = controller.extendAgreement(extendAgreemetRequest, token); } finally { if (extendAgreementResponse != null) { if (extendAgreementResponse.message != null) { if (extendAgreementResponse.message.ErrorCode == "200") { balanceDue = (decimal)extendAgreementResponse.agreementReview.BalanceDue; if (balanceDue <= 0) { balanceDue = 0; } agreementReview = extendAgreementResponse.agreementReview; amountLAbel.Text = "$ " + balanceDue.ToString("0.00"); foreach (PromotionItem p in extendAgreementResponse.agreementReview.PromotionList) { if (p.PromotionID == appliedPromoId) { promoDetailLabel.Text = "$" + p.PromotionDiscount.ToString("0.00"); } } int ordNo = 1; foreach (PromotionItem p1 in agreementReview.PromotionList) { p1.PromotionListId = ordNo; ordNo += 1; } } } } } }
public ExtendAgreementResponse extendAgreement(ExtendAgreementRequest request, string token) { ExtendAgreementResponse response = null; try { response = agreementService.extendAgreement(request, token); } catch (Exception ex) { throw ex; } return(response); }
private GetReservationAgreementMobileResponse getMobileRegistrationDBModel(GetReservationAgreementMobileRequest registrationDBModelRequest, string token) { GetReservationAgreementMobileResponse response = null; try { RegisterController registerController = new RegisterController(); response = registerController.getMobileRegistrationDBModel(registrationDBModelRequest, token); } catch (Exception ex) { throw ex; } return(response); }
private GetAgreementByAgreementIdMobileResponse getAgreement(GetAgreementByAgreementIdMobileRequest agreementByAgreementIdMobileRequest, string token, int vehicleId) { AgreementController agreementController = new AgreementController(); GetAgreementByAgreementIdMobileResponse response = null; try { response = agreementController.getAgreement(agreementByAgreementIdMobileRequest, token, vehicleId); //getVehicleDetailsMobile = vehicleController.getVehicleTypesMobile(token); //foreach(VehicleTypeMobileResult vtmr in getVehicleDetailsMobile.listVehicle) //{ // if(vtmr.ve) //} } catch (Exception ex) { throw ex; } return(response); }
public HomePageDetail() { InitializeComponent(); customerId = (int)Application.Current.Properties["CustomerId"]; _token = Application.Current.Properties["currentToken"].ToString(); registrationDBModelRequest = new GetReservationAgreementMobileRequest(); registrationDBModelRequest.customerId = customerId; registrationDBModelResponse = null; registrationDBModel = null; agreementIdMobileResponse = null; agreementIdMobileRequest = new GetAgreementByAgreementIdMobileRequest(); getAgreementByCustomerIdMobileRequest = new getAgreementByCustomerIdMobileRequest(); getAgreementByCustomerIdMobileRequest.customerId = customerId; customerAgreementModels = null; lastAgreementId = 0; lastAgreementStatus = null; reservationByIDMobileRequest = new GetReservationByIDMobileRequest(); isreservation = false; isAgreement = false; agreementId = 0; vehicleId = 0; isAgreeRefreshed = false; estTime = DateTime.Now; request = new ExtendAgreementRequest(); response = null; overDueBalanceViewModel = new OverDueBalanceViewModel(); ICommand refreshCommand = new Command(() => { refreshView.IsRefreshing = true; this.OnAppearing(); refreshView.IsRefreshing = false; }); refreshView.Command = refreshCommand; // BooknowBtn.BackgroundColor = (Color)App.Current.Properties["MaxVonYellow"]; }
private void refreshBalance() { DateTime timeUtc = DateTime.UtcNow; TimeZoneInfo estZone = TimeZoneInfo.FindSystemTimeZoneById("America/New_York"); estTime = TimeZoneInfo.ConvertTimeFromUtc(timeUtc, estZone); request.extendDate = estTime.ToString("MM/dd/yyyy hh:mm tt").Replace("PM", "pm").Replace("AM", "am"); AgreementController controller = new AgreementController(); response = controller.extendAgreement(request, _token); if (response != null) { if (response.agreementReview != null) { if (response.agreementReview.BalanceDue != null) { averDueStack.IsVisible = true; overdueBalanceAmount.Text = ((decimal)response.agreementReview.BalanceDue).ToString("0.00"); } } } }
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(); //} }
async void promoDeleteBtn_Clicked(System.Object sender, System.EventArgs e) { if (appliedPromoId > 0 && !isExtendAgreement) { reservationView.PromotionList = reservationView.PromotionList.FindAll(et => et.PromotionID != appliedPromoId); summaryMobileRequest.reservation = reservationView; try { try { summaryMobileResponsecs = getSummaryDetails(summaryMobileRequest, token); } catch (Exception ex) { throw ex; } } finally { //amountWantToPay decimal amountWant = 0; if (summaryMobileResponsecs.rate.ReservationSummary.EstimatedTotal == null) { amountWant = (decimal)summaryMobileResponsecs.rate.EstimatedTotal - reservationView.AdvancedPayment; } else { amountWant = Convert.ToDecimal(summaryMobileResponsecs.rate.ReservationSummary.EstimatedTotal) - reservationView.AdvancedPayment; } amountWantToPay = amountWant; amountLAbel.Text = "$ " + amountWantToPay.ToString("0.00"); reservationView.BasePrice = Convert.ToDecimal(summaryMobileResponsecs.rate.ReservationSummary.FinalBaseRate); reservationView.PreSubTotal = Convert.ToDecimal(summaryMobileResponsecs.rate.ReservationSummary.PreSubTotal); reservationView.TotalDiscountOnBaseRate = Convert.ToDecimal(summaryMobileResponsecs.rate.ReservationSummary.PromoDiscountOnBaseRate); reservationView.TotalDiscount = Convert.ToDecimal(summaryMobileResponsecs.rate.ReservationSummary.PromoDiscountOnBaseRate); reservationView.TotalDiscountOnSubTotal = Convert.ToDecimal(summaryMobileResponsecs.rate.ReservationSummary.PromoDiscountOnSubtotal); } } else if (appliedPromoId > 0 && isExtendAgreement) { extendAgreemetRequest.deletePromotion = new PromotionItem() { PromotionID = appliedPromoId }; extendAgreemetRequest.addPromotion = null; AgreementController controller = new AgreementController(); try { extendAgreementResponse = controller.extendAgreement(extendAgreemetRequest, token); } finally { if (extendAgreementResponse != null) { if (extendAgreementResponse.message != null) { if (extendAgreementResponse.message.ErrorCode == "200") { balanceDue = (decimal)extendAgreementResponse.agreementReview.BalanceDue; agreementReview = extendAgreementResponse.agreementReview; amountLAbel.Text = "$ " + balanceDue.ToString("0.00"); } } } } } viewAddPromotionGrid(); }