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 int updateAgreement(AgreementReview agreementReview, string token) { int result = 0; try { using (var client = new HttpClient()) { client.BaseAddress = new Uri(ConstantData.ApiURL.ToString() + "Agreement/EditAgreement"); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token); var myContent = JsonConvert.SerializeObject(agreementReview); 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 <int>(responseStream); } } } catch (Exception ex) { throw ex; } return(result); }
public ExtendPopup(AgreementReview agreementDetail) { InitializeComponent(); this.agreementDetail = agreementDetail; extendedDate.MinimumDate = agreementDetail.CheckinDate.AddHours(24); extendedDate.Date = agreementDetail.CheckinDate.AddHours(24); extendedDate.Format = "dddd, MMMM d, yyyy"; extendedTime.Time = new TimeSpan(agreementDetail.CheckinDate.AddHours(24).Hour, agreementDetail.CheckinDate.AddHours(24).Minute, agreementDetail.CheckinDate.AddHours(24).Second); extendedTime.Format = "hh mm tt"; _token = App.Current.Properties["currentToken"].ToString(); type = ReferenceType.Agreement; }
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 int updateAgreement(AgreementReview agreementReview, string _token) { int agreementId = 0; try { agreementId = agreementService.updateAgreement(agreementReview, _token); } catch (Exception ex) { throw ex; } return(agreementId); }
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(); }