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 GetAllCustomerMobileCreditCardResponse GetAllMobileCustomerCreditCard(GetAllCustomerMobileCreditCardRequest cards, string token)
        {
            GetAllCustomerMobileCreditCardResponse result = null;

            try
            {
                using (var client = new HttpClient())
                {
                    client.BaseAddress = new Uri(ConstantData.ApiURL.ToString() + "CustomerMobile/GetAllMobileCustomerCreditCard");
                    client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                    client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);

                    var myContent   = JsonConvert.SerializeObject(cards);
                    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 <GetAllCustomerMobileCreditCardResponse>(responseStream);
                    }
                }
            }

            catch (Exception ex)
            {
                throw ex;
            }
            return(result);
        }
        private GetAllCustomerMobileCreditCardResponse getAllcrediCardDetails(GetAllCustomerMobileCreditCardRequest creditCardRequest, string token)
        {
            CustomerController controller = new CustomerController();
            GetAllCustomerMobileCreditCardResponse cards = controller.GetAllMobileCustomerCreditCard(creditCardRequest, token);

            return(cards);
        }
Beispiel #4
0
 public PaymentMethodPage()
 {
     InitializeComponent();
     creditCardRequest = new GetAllCustomerMobileCreditCardRequest();
     creditCards       = null;
     customerId        = (int)App.Current.Properties["CustomerId"];
     token             = App.Current.Properties["currentToken"].ToString();
     On <Xamarin.Forms.PlatformConfiguration.iOS>().SetUseSafeArea(true);
     creditCardRequest.CustomerID = customerId;
 }
        public GetAllCustomerMobileCreditCardResponse GetAllMobileCustomerCreditCard(GetAllCustomerMobileCreditCardRequest cards, string token)
        {
            GetAllCustomerMobileCreditCardResponse response = new GetAllCustomerMobileCreditCardResponse();

            try
            {
                response = customerService.GetAllMobileCustomerCreditCard(cards, token);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(response);
        }
Beispiel #6
0
        protected override async void OnAppearing()
        {
            base.OnAppearing();
            if (PopupNavigation.Instance.PopupStack.Count > 0)
            {
                await PopupNavigation.Instance.PopAllAsync();
            }

            bool busy = false;

            if (!busy)
            {
                try
                {
                    busy = true;
                    await PopupNavigation.Instance.PushAsync(new LoadingPopup("."));

                    await Task.Run(async() =>
                    {
                        try
                        {
                            //agreementResponse = getAgreementMobile(getAgreementByCustomerIdMobileRequest, token);
                            //customerAgreementModels = agreementResponse.listAgreements;
                            creditCards = getAllcrediCardDetails(creditCardRequest, token);
                        }
                        catch (Exception ex)
                        {
                            await PopupNavigation.Instance.PushAsync(new ErrorWithClosePagePopup(ex.Message));
                        }
                    });
                }
                finally
                {
                    busy = false;
                    if (PopupNavigation.Instance.PopupStack.Count > 0)
                    {
                        await PopupNavigation.Instance.PopAllAsync();
                    }
                }
            }


            BindDetail(creditCards.listCard);
        }
        //public SummaryOfChargesPage()
        //{

        //    //if ((int)App.Current.Properties["CustomerId"] == 0)
        //    //{
        //    //    loginIcon.IconImageSource = ImageSource.FromResource("MaxVonGrafKftMobile.Assets.LogInTool.png", assembly);

        //    //}
        //    //else
        //    //{
        //    //    loginIcon.IconImageSource = ImageSource.FromResource("MaxVonGrafKftMobile.Assets.logOutTool.png", assembly);
        //    //}
        //}

        public SummaryOfChargesPage(ReservationView reservationView, VehicleViewByTypeForMobile selectedVehicle)
        {
            InitializeComponent();
            var assembly = typeof(SummaryOfChargesPage);

            this.reservationView             = reservationView;
            summaryMobileRequest             = new GetCalculateSummaryMobileRequest();
            summaryMobileResponsecs          = null;
            ReservationMobileResponse        = null;
            ReservationMobileRequest         = new CreateReservationMobileRequest();
            summaryMobileRequest.reservation = reservationView;
            token = App.Current.Properties["currentToken"].ToString();
            termsandConditionByTypeRequest          = new GetTermsandConditionByTypeRequest();
            termsandConditionByTypeRequest.clientId = Constants.ClientId;
            termsandConditionByTypeRequest.typeId   = 3;
            termsandConditionByTypeResponse         = null;
            this.selectedVehicle = selectedVehicle;
            startDateLabel.Text  = ((DateTime)reservationView.StartDate).ToString("ddd MM/dd/yyyy");
            endDateLabel.Text    = ((DateTime)reservationView.EndDate).ToString("ddd MM/dd/yyyy");
            startTimeLabel.Text  = ((DateTime)reservationView.StartDate).ToString("hh:mm tt");
            endTimeLabel.Text    = ((DateTime)reservationView.EndDate).ToString("hh:mm tt");
            if (selectedVehicle.VehicleImageUrl != null)
            {
                vehilcleTypeImage.Source = ImageSource.FromUri(new Uri(selectedVehicle.VehicleImageUrl));
            }
            vehicleSampleLabel.Text = selectedVehicle.vehicleName;
            vehilcleTypeLabel.Text  = selectedVehicle.VehicleType;
            priceLabel.Text         = "Days: " + selectedVehicle.RateDetail.TotalDays.ToString();
            emailInvoiceRequest     = new EmailInvoiceRequest();
            emailResponse           = null;
            creditCardRequest       = new GetAllCustomerMobileCreditCardRequest();
            creditCards             = null;
            customerId = (int)App.Current.Properties["CustomerId"];

            billingInformation = new BillingInformation();
            submitPaymentandCreateReservationRequest = new SubmitPaymentandCreateReservationRequest();
            PaymentResponse = null;

            //imgSelect.Source = "iconCircleSelected.png";
        }
 public ProcessPaymentPage(decimal amountWantToPay, ReservationView reservationView)
 {
     InitializeComponent();
     this.amountWantToPay = amountWantToPay;
     this.reservationView = reservationView;
     amountLAbel.Text     = "$ " + amountWantToPay.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;
     agreementId        = 0;
     submitPaymentAndUpDateReservationRequest = new SubmitPaymentAndUpDateReservationRequest();
     paynowBtn.Text          = "Pay and extend now";
     isExtendAgreement       = false;
     promotionMobileRequest  = new GetPromotionMobileRequest();
     promotionMobileResponse = null;
     summaryMobileRequest    = new GetCalculateSummaryMobileRequest();
     summaryMobileResponsecs = null;
     appliedPromoId          = 0;
 }
        protected override async void OnAppearing()
        {
            base.OnAppearing();

            bool busy = false;

            if (!busy)
            {
                try
                {
                    busy = true;
                    await PopupNavigation.Instance.PushAsync(new LoadingPopup(" "));

                    await Task.Run(() =>
                    {
                        try
                        {
                            if (customerId > 0)
                            {
                                creditCardRequest.CustomerID = customerId;
                                creditCards = getAllcrediCardDetails(creditCardRequest, 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 (customerId > 0)
                    {
                        addPaymentMethodBtn.IsVisible = true;
                        if (creditCards != null)
                        {
                            if (creditCards.listCard != null)
                            {
                                if (creditCards.listCard.Count > 0)
                                {
                                    BindDetail(creditCards.listCard);
                                    lstCardetail.IsVisible = true;
                                }
                                else
                                {
                                    lstCardetail.IsVisible = false;
                                }
                            }
                        }
                    }
                    if (customerId == 0)
                    {
                        lstCardetail.IsVisible        = false;
                        addPaymentMethodBtn.IsVisible = false;
                    }
                }
            }
        }
        //private async void LoginIcon_Clicked(object sender, EventArgs e)
        //{
        //    var assembly = typeof(SummaryOfChargesPage);
        //    if ((int)App.Current.Properties["CustomerId"] == 0)
        //    {

        //        loginIcon.IconImageSource = ImageSource.FromResource("MaxVonGrafKftMobile.Assets.logOutTool.png", assembly);
        //        await Navigation.PushAsync(new LoginPage());

        //    }
        //    else
        //    {
        //        bool logout = await DisplayAlert("Alert", "Are you sure want to logout", "Yes", "No");
        //        if (logout)
        //        {
        //            App.Current.Properties["CustomerId"] = 0;
        //            loginIcon.IconImageSource = ImageSource.FromResource("MaxVonGrafKftMobile.Assets.LogInTool.png", assembly);
        //            await Navigation.PushAsync(new BookNow());
        //        }
        //    }
        //}

        protected override async void OnAppearing()
        {
            base.OnAppearing();
            customerId = (int)App.Current.Properties["CustomerId"];
            if (customerId > 0)
            {
                creditCardRequest.CustomerID = customerId;
            }
            if (PopupNavigation.Instance.PopupStack.Count > 0)
            {
                if (PopupNavigation.Instance.PopupStack[PopupNavigation.Instance.PopupStack.Count - 1].GetType() == typeof(ErrorWithClosePagePopup))
                {
                    await PopupNavigation.Instance.PopAllAsync();
                }
                else if (PopupNavigation.Instance.PopupStack[PopupNavigation.Instance.PopupStack.Count - 1].GetType() == typeof(ReservationSavedPopup))
                {
                    await PopupNavigation.Instance.PopAllAsync();

                    await Navigation.PushModalAsync(new HomePageDetail());
                }
                else
                {
                    await PopupNavigation.Instance.PopAsync();
                }
            }

            //if (Constants.IsRegisteredandNotLogin)
            //{
            //    await Navigation.PushAsync(new LoginPage());
            //}
            else
            {
                if (reservationView.CustomerDriverList != null)
                {
                    if (reservationView.CustomerDriverList.Count > 0)
                    {
                        List <Driver> listForListVew = new List <Driver>();
                        foreach (Driver d in reservationView.CustomerDriverList)
                        {
                            if (d.IsDelete == false)
                            {
                                listForListVew.Add(d);
                            }
                        }
                        reservationView.CustomerDriverList = listForListVew;
                        // NoAdditionalDriverLabel.IsVisible = false;
                        // additionalDriverList.IsVisible = true;
                        // additionalDriverList.ItemsSource = listForListVew;
                        // additionalDriverList.HeightRequest = (listForListVew.Count) * 130;
                    }
                    else
                    {
                        ///NoAdditionalDriverLabel.IsVisible = true;
                        // additionalDriverList.IsVisible = false;
                    }
                }
                else
                {
                    // NoAdditionalDriverLabel.IsVisible = true;
                    // additionalDriverList.IsVisible = false;
                }



                bool busy = false;
                if (!busy)
                {
                    try
                    {
                        busy = true;
                        await PopupNavigation.Instance.PushAsync(new LoadingPopup("Getting summary details..."));

                        await Task.Run(() =>
                        {
                            try
                            {
                                summaryMobileResponsecs         = getSummaryDetails(summaryMobileRequest, token);
                                termsandConditionByTypeResponse = getTermsAndConditions(termsandConditionByTypeRequest, token);
                                if (customerId > 0)
                                {
                                    creditCards = getAllcrediCardDetails(creditCardRequest, 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 (customerId > 0)
                        {
                            addPaymentMethodBtn.IsVisible = true;
                            if (creditCards != null)
                            {
                                if (creditCards.listCard != null)
                                {
                                    if (creditCards.listCard.Count > 0)
                                    {
                                        BindDetail(creditCards.listCard);
                                        lstCardetail.IsVisible = true;
                                    }
                                    else
                                    {
                                        lstCardetail.IsVisible = false;
                                    }
                                }
                            }
                        }
                        if (customerId == 0)
                        {
                            lstCardetail.IsVisible        = false;
                            addPaymentMethodBtn.IsVisible = false;
                        }


                        if (summaryMobileResponsecs != null)
                        {
                            if (summaryMobileResponsecs.message.ErrorCode == "200")
                            {
                                noOfDaysEntry.Text = reservationView.TotalDays.ToString();

                                totalRentalFeeEntry.Text = "$" + summaryMobileResponsecs.rate.ReservationSummary.BaseRate.ToString();

                                if (summaryMobileResponsecs.rate.ReservationSummary.PromoDiscount != null)
                                {
                                    DiscountEntry.Text = "[$" + (Convert.ToDecimal(summaryMobileResponsecs.rate.ReservationSummary.PromoDiscountOnBaseRate) + Convert.ToDecimal(summaryMobileResponsecs.rate.ReservationSummary.PromoDiscountOnSubtotal)).ToString() + "]";
                                }
                                totalMisChargeEntry.Text = "$" + (Convert.ToDecimal(summaryMobileResponsecs.rate.ReservationSummary.TotacMiscNonTaxable) + Convert.ToDecimal(summaryMobileResponsecs.rate.ReservationSummary.TotacMiscTaxable)).ToString();

                                if (summaryMobileResponsecs.rate.ReservationSummary.TotalTax == null)
                                {
                                    totalTaxEntry.Text = "$0.00";
                                }
                                else if (summaryMobileResponsecs.rate.ReservationSummary.TotalTax != null)
                                {
                                    totalTaxEntry.Text = "$" + summaryMobileResponsecs.rate.ReservationSummary.TotalTax;
                                }



                                if (summaryMobileResponsecs.rate.ReservationSummary.EstimatedTotal == null)
                                {
                                    totalAmountEntry.Text = "$" + summaryMobileResponsecs.rate.EstimatedTotal.ToString();
                                }
                                else if (summaryMobileResponsecs.rate.ReservationSummary.EstimatedTotal != null)
                                {
                                    totalAmountEntry.Text = "$" + summaryMobileResponsecs.rate.ReservationSummary.EstimatedTotal;
                                }
                            }
                            else
                            {
                                await PopupNavigation.Instance.PushAsync(new ErrorWithClosePagePopup(summaryMobileResponsecs.message.ErrorMessage));
                            }
                        }

                        if (termsandConditionByTypeResponse != null)
                        {
                            if (termsandConditionByTypeResponse.message.ErrorCode == "200")
                            {
                                if (termsandConditionByTypeResponse.termlist != null)
                                {
                                    if (termsandConditionByTypeResponse.termlist.Count > 0)
                                    {
                                        //terms.Text = termsandConditionByTypeResponse.termlist[0].Term;
                                        //tacDescription.Text = termsandConditionByTypeResponse.termlist[0].Description;

                                        // termList.ItemsSource = termsandConditionByTypeResponse.termlist;

                                        //var myDataTemplate = new DataTemplate(() =>
                                        //{
                                        //    var cell = new ViewCell();
                                        //    var termGrid = new Grid();
                                        //    int r = termsandConditionByTypeResponse.termlist.Count;

                                        //    for (int i = 0; i < r; i++)
                                        //    {
                                        //        termGrid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Star) });
                                        //    }



                                        //    foreach (Terms terms in termsandConditionByTypeResponse.termlist)
                                        //    {
                                        //        var tCGrid = new Grid() { VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.Fill };

                                        //        tCGrid.Children.Add(new Label()  // adding the item as label
                                        //        {
                                        //            Text = terms.Term,
                                        //            TextColor = Color.Black,
                                        //            HorizontalOptions = LayoutOptions.FillAndExpand,
                                        //            HorizontalTextAlignment = TextAlignment.Center,
                                        //            VerticalTextAlignment = TextAlignment.Center,
                                        //            FontSize = 16
                                        //        }, 0, 0);

                                        //        tCGrid.Children.Add(new Label()  // adding the item as label
                                        //        {
                                        //            Text = terms.Description,
                                        //            TextColor = Color.Gray,
                                        //            HorizontalOptions = LayoutOptions.FillAndExpand,
                                        //            HorizontalTextAlignment = TextAlignment.Center,
                                        //            VerticalTextAlignment = TextAlignment.Center,
                                        //            FontSize = 16
                                        //        }, 0, 1);
                                        //        termGrid.Children.Add(tCGrid);
                                        //    }
                                        //    cell.View = termGrid;
                                        //    return cell;
                                        //});
                                        //data = myDataTemplate;
                                    }
                                }
                            }
                            else
                            {
                                await PopupNavigation.Instance.PushAsync(new ErrorWithClosePagePopup(termsandConditionByTypeResponse.message.ErrorMessage));
                            }
                        }
                    }
                }
            }
        }