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;
 }
Exemplo n.º 2
0
        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."));
                        }
                    }
                }
            }
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
        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();
        }
Exemplo n.º 5
0
        public ExtendAgreementResponse extendAgreement(ExtendAgreementRequest request, string token)
        {
            ExtendAgreementResponse response = null;

            try
            {
                response = agreementService.extendAgreement(request, token);
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(response);
        }
Exemplo n.º 6
0
        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"];
        }
Exemplo n.º 7
0
        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();
            //}
        }