コード例 #1
0
        public GetCalculateSummaryMobileResponsecs getSummaryDetails(GetCalculateSummaryMobileRequest summaryMobileRequest, string token)
        {
            GetCalculateSummaryMobileResponsecs result = null;

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

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

            catch (Exception ex)
            {
                throw ex;
            }
            return(result);
        }
コード例 #2
0
        //public SummaryOfChargesPage()
        //{

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

        //    //}
        //    //else
        //    //{
        //    //    loginIcon.IconImageSource = ImageSource.FromResource("BespokeMobile.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.VehicleTypeImageUrl != null)
            {
                vehilcleTypeImage.Source = ImageSource.FromUri(new Uri(selectedVehicle.VehicleTypeImageUrl));
            }
            vehicleSampleLabel.Text = selectedVehicle.sample;
            vehilcleTypeLabel.Text  = selectedVehicle.VehicleType;
            priceLabel.Text         = "$ " + selectedVehicle.RateDetail.RateTotal.ToString();
            emailInvoiceRequest     = new EmailInvoiceRequest();
            emailResponse           = null;
        }
コード例 #3
0
        public GetCalculateSummaryMobileResponsecs getSummaryDetails(GetCalculateSummaryMobileRequest summaryMobileRequest, string token)
        {
            GetCalculateSummaryMobileResponsecs mobileResponse = null;

            try
            {
                mobileResponse = reservationservice.getSummaryDetails(summaryMobileRequest, token);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(mobileResponse);
        }
コード例 #4
0
        private GetCalculateSummaryMobileResponsecs getSummaryDetails(GetCalculateSummaryMobileRequest summaryMobileRequest, string token)
        {
            GetCalculateSummaryMobileResponsecs summaryResponse = null;
            ReservationController controller = new ReservationController();

            try
            {
                summaryResponse = controller.getSummaryDetails(summaryMobileRequest, token);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(summaryResponse);
        }
コード例 #5
0
        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;
        }
コード例 #6
0
        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;
        }
コード例 #7
0
        //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";
        }
コード例 #8
0
 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;
 }
コード例 #9
0
        //private async void LoginIcon_Clicked(object sender, EventArgs e)
        //{
        //    var assembly = typeof(SummaryOfChargesPage);
        //    if ((int)App.Current.Properties["CustomerId"] == 0)
        //    {

        //        loginIcon.IconImageSource = ImageSource.FromResource("NativeCamperVans.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("NativeCamperVans.Assets.LogInTool.png", assembly);
        //            await Navigation.PushAsync(new BookNow());
        //        }
        //    }
        //}

        protected override async void OnAppearing()
        {
            base.OnAppearing();
            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.PushAsync(new HomePageDetail());
                }
            }
            if (reservationData.Reservationview.CustomerDriverList != null)
            {
                reservationView.CustomerDriverList = reservationData.Reservationview.CustomerDriverList;
                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 = reservationView.CustomerDriverList;
                    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);
                        }
                        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 (summaryMobileResponsecs != null)
                    {
                        if (summaryMobileResponsecs.message.ErrorCode == "200")
                        {
                            VehicletypeEntry.Text = reservationView.VehicleType;
                            noOfDaysEntry.Text    = reservationView.TotalDays.ToString();

                            if (summaryMobileResponsecs.rate.ReservationSummary.BaseRate == null)
                            {
                                totalRentalFeeEntry.Text = summaryMobileResponsecs.rate.EstimatedTotal.ToString();
                            }
                            else if (summaryMobileResponsecs.rate.ReservationSummary.BaseRate != null)
                            {
                                totalRentalFeeEntry.Text = summaryMobileResponsecs.rate.ReservationSummary.BaseRate;
                            }

                            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;
                                }
                            }
                        }
                        else
                        {
                            await PopupNavigation.Instance.PushAsync(new ErrorWithClosePagePopup(termsandConditionByTypeResponse.message.ErrorMessage));
                        }
                    }
                }
            }
        }
コード例 #10
0
        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);
                            //vehicleResults = getVehicleTypes(token);
                            //vehicleResponse= getVehicleTypesMobile(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));
            //    }
            //}

            summaryMobileRequest.reservation = reservationView;
            bool isbusy = false;

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

                    await Task.Run(() =>
                    {
                        try
                        {
                            summaryMobileResponsecs = getSummaryDetails(summaryMobileRequest, _token);
                        }
                        catch (Exception ex)
                        {
                            PopupNavigation.Instance.PushAsync(new ErrorWithClosePagePopup(ex.Message));
                        }
                    });
                }
                finally
                {
                    isbusy = 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.PopAsync();
                        }
                    }
                    decimal amountWantToPay = 0;
                    if (summaryMobileResponsecs.rate.ReservationSummary.EstimatedTotal == null)
                    {
                        amountWantToPay = (decimal)summaryMobileResponsecs.rate.EstimatedTotal - paidAmmount;
                    }
                    else
                    {
                        amountWantToPay = Convert.ToDecimal(summaryMobileResponsecs.rate.ReservationSummary.EstimatedTotal) - paidAmmount;
                    }

                    if (amountWantToPay > 0)
                    {
                        await Navigation.PushModalAsync(new ProcessPaymentPage(amountWantToPay, reservationView));
                    }
                    else
                    {
                        await PopupNavigation.Instance.PushAsync(new Error_popup("Some thing went wrong while updating your booking."));
                    }
                }
            }
        }
コード例 #11
0
        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();
        }
コード例 #12
0
        private void applyReservationPromotion(GetPromotionMobileResponse promotionMobileResponse)
        {
            promoTitileLabel.Text = promotionMobileResponse.promotion.PromotionCode;
            promoDetailLabel.Text = "$" + promotionMobileResponse.promotion.DiscountValue.ToString("0.00");
            appliedPromoId        = promotionMobileResponse.PromResult.PromotionID;
            hideAddPromotionGrid();

            reservationView.PromotionCode = promoCodeEntry.Text;
            reservationView.PromotionList.Add(new PromotionItem()
            {
                PromotionID = promotionMobileResponse.PromResult.PromotionID, PromotionDiscount = (decimal)promotionMobileResponse.PromResult.DiscountValue
            });

            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;
                }

                if (amountWant > 0)
                {
                    amountWantToPay = amountWant;
                }
                else
                {
                    amountWantToPay = 0;
                }


                amountLAbel.Text = "$ " + amountWantToPay.ToString("0.00");


                int ordNo = 1;
                foreach (PromotionItem p1 in reservationView.PromotionList)
                {
                    p1.PromotionListId = ordNo;
                    ordNo += 1;
                }


                foreach (PromotionItem p in summaryMobileResponsecs.rate.ReservationSummary.PromotionList)
                {
                    if (p.PromotionID == appliedPromoId)
                    {
                        promoDetailLabel.Text = "$" + p.PromotionDiscount.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);
            }
        }
コード例 #13
0
        //private async void LoginIcon_Clicked(object sender, EventArgs e)
        //{
        //    var assembly = typeof(SummaryOfChargesPage);
        //    if ((int)App.Current.Properties["CustomerId"] == 0)
        //    {

        //        loginIcon.IconImageSource = ImageSource.FromResource("BespokeMobile.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("BespokeMobile.Assets.LogInTool.png", assembly);
        //            await Navigation.PushAsync(new BookNow());
        //        }
        //    }
        //}

        protected override async void OnAppearing()
        {
            base.OnAppearing();
            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.PushAsync(new HomePageDetail());
                }
            }

            //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);
                            }
                            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 (summaryMobileResponsecs != null)
                        {
                            if (summaryMobileResponsecs.message.ErrorCode == "200")
                            {
                                noOfDaysEntry.Text = reservationView.TotalDays.ToString();

                                totalRentalFeeEntry.Text = "$" + summaryMobileResponsecs.rate.RateTotal.ToString("0.00");

                                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));
                            }
                        }
                    }
                }
            }
        }