Ejemplo n.º 1
0
 public VehicleRates(ReservationView reservationView, VehicleViewByTypeForMobile selectedVehicle)
 {
     InitializeComponent();
     this.reservationView = reservationView;
     //misChargeFilter = new MisChargeFilter();
     misChargeRequest = new GetMischargeSearchDetailsMobileRequest();
     //taxFilter = new TaxFilter();
     taxRequest             = new GetTaxMobileListRequest();
     promotionMobileRequest = new GetPromotionMobileRequest();
     //misChargeFilter.LocationId =(int) reservationView.StartLocationId;
     //misChargeFilter.VehicleTypeId =(int) reservationView.VehicleTypeID;
     misChargeRequest.LocationId    = (int)reservationView.StartLocationId;
     misChargeRequest.VehicleTypeId = (int)reservationView.VehicleTypeID;
     //taxFilter.LocationId = (int)reservationView.StartLocationId;
     taxRequest.LocationId   = (int)reservationView.StartLocationId;
     promotionMobileResponse = null;
     misChargeResults        = null;
     misChargeResponse       = null;
     taxResults            = null;
     taxResponse           = null;
     reservationController = new ReservationController();
     token = App.Current.Properties["currentToken"].ToString();
     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();
 }
Ejemplo n.º 2
0
        private void btnBookNow_Clicked(object sender, EventArgs e)
        {
            //List<VehicleTypeResult> results = new List<VehicleTypeResult>();
            //VehicleTypeResult selectedVehicle = vehicleDetailList.SelectedItem as VehicleTypeResult;
            //int vehiId = selectedVehicle.VehicleTypeId;
            //foreach(VehicleTypeResult v in vehicleResults)
            //{
            //    if (v.VehicleTypeId == vehiId)
            //    {
            //        v.selected = true;
            //    }
            //    else
            //    {
            //        v.selected = false;
            //    }
            //    results.Add(v);
            //}
            //vehicleDetailList.ItemsSource = results;
            var obj = (Button)sender;
            VehicleViewByTypeForMobile selectedVehicle = obj.BindingContext as VehicleViewByTypeForMobile;

            reservationView.VehicleTypeID = selectedVehicle.VehicleTypeId;
            reservationView.VehicleType   = selectedVehicle.VehicleType;
            Rates rates = JsonConvert.DeserializeObject <Rates>(JsonConvert.SerializeObject(selectedVehicle.RateDetail));

            rates.RateId = selectedVehicle.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;
            Navigation.PushAsync(new BookNow(reservationView, selectedVehicle, selectedVehicle.locationIdList));
        }
        private void VehicleDetailList_ItemSelected(object sender, SelectedItemChangedEventArgs e)
        {
            //List<VehicleTypeResult> results = new List<VehicleTypeResult>();
            //VehicleTypeResult selectedVehicle = vehicleDetailList.SelectedItem as VehicleTypeResult;
            //int vehiId = selectedVehicle.VehicleTypeId;
            //foreach(VehicleTypeResult v in vehicleResults)
            //{
            //    if (v.VehicleTypeId == vehiId)
            //    {
            //        v.selected = true;
            //    }
            //    else
            //    {
            //        v.selected = false;
            //    }
            //    results.Add(v);
            //}
            //vehicleDetailList.ItemsSource = results;
            VehicleViewByTypeForMobile selectedVehicle = vehicleDetailList.SelectedItem as VehicleViewByTypeForMobile;

            reservationView.VehicleTypeID = selectedVehicle.VehicleTypeId;
            reservationView.VehicleType   = selectedVehicle.VehicleType;
            Rates rates = JsonConvert.DeserializeObject <Rates>(JsonConvert.SerializeObject(selectedVehicle.RateDetail));

            rates.RateId = selectedVehicle.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;
            Navigation.PushAsync(new EditVehicleRates(reservationView, reservationData));
        }
        //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;
        }
        public AddNewDriver(ReservationView reservationView, CustomerSerach filter)
        {
            InitializeComponent();


            //want to edit
            selectedVehicle = null;



            customer             = new CustomerReview();
            this.filter          = filter;
            customerID           = 0;
            this.reservationView = reservationView;
            _token = App.Current.Properties["currentToken"].ToString();

            DateOfBithEntry.MaximumDate = DateTime.Now.AddYears(-18);
            countryResponse             = getAllCountry(_token);
            List <string> countryList = new List <string>();

            if (countryResponse.countryList.Count > 0)
            {
                foreach (Country k in countryResponse.countryList)
                {
                    countryList.Add(k.CountryName);
                }
                ;
            }
            countryPicker.ItemsSource = countryList;

            countryPicker.SelectedItem = "USA";
            List <string> stateList = new List <string>();
            int?          counid    = null;

            foreach (Country c in countryResponse.countryList)
            {
                if (c.CountryName == countryPicker.SelectedItem.ToString())
                {
                    counid = c.CountryId;
                }
            }
            ;

            if (counid != null)
            {
                GetAllStateForMobileRequest stateRequest = new GetAllStateForMobileRequest();
                stateRequest.CountryID = counid.Value;
                stateResponse          = getStates(stateRequest, _token);
                if (stateResponse.stateList.Count > 0)
                {
                    foreach (State s in stateResponse.stateList)
                    {
                        stateList.Add(s.StateName);
                    }
                    ;
                }
                statePicker.ItemsSource = stateList;
            }
        }
        public PriceDetailPopup(VehicleViewByTypeForMobile selectedVehicle)
        {
            InitializeComponent();
            this.selectedVehicle        = selectedVehicle;
            dailyRateDetailLabel.Text   = "( " + selectedVehicle.RateDetail.DailyQty + " x $ " + ((decimal)selectedVehicle.RateDetail.DailyRate).ToString("0.00") + " )";
            weeklyRateDetailLabel.Text  = "( " + selectedVehicle.RateDetail.WeeklyQty + " x $ " + ((decimal)selectedVehicle.RateDetail.WeeklyRate).ToString("0.00") + " )";
            monthlyRateDetailLabel.Text = "( " + selectedVehicle.RateDetail.MonthlyQty + " x $ " + ((decimal)selectedVehicle.RateDetail.MonthlyRate).ToString("0.00") + " )";
            weekEndRateDetailLabel.Text = "( " + selectedVehicle.RateDetail.WeekendDailyQty + " x $ " + ((decimal)selectedVehicle.RateDetail.WeekendDayRate).ToString("0.00") + " )";

            DailyRateTotal.Text   = "$ " + ((decimal)selectedVehicle.RateDetail.DailyQty * (decimal)selectedVehicle.RateDetail.DailyRate).ToString("0.00");
            weeklyRateTotal.Text  = "$ " + ((decimal)selectedVehicle.RateDetail.WeeklyQty * (decimal)selectedVehicle.RateDetail.WeeklyRate).ToString("0.00");
            monthlyRateTotal.Text = "$ " + ((decimal)selectedVehicle.RateDetail.MonthlyQty * (decimal)selectedVehicle.RateDetail.MonthlyRate).ToString("0.00");
            weekEndRateTotal.Text = "$ " + ((decimal)selectedVehicle.RateDetail.WeekendDailyQty * (decimal)selectedVehicle.RateDetail.WeekendDayRate).ToString("0.00");

            totalRateLabel.Text = "$ " + ((decimal)selectedVehicle.RateDetail.RateTotal).ToString("0.00");
        }
Ejemplo n.º 7
0
        public PriceDetailPopup(VehicleViewByTypeForMobile selectedVehicle)
        {
            InitializeComponent();
            this.selectedVehicle        = selectedVehicle;
            dailyRateDetailLabel.Text   = "( " + selectedVehicle.RateDetail.DailyQty + " x $ " + ((decimal)selectedVehicle.RateDetail.DailyRate).ToString("0.00") + " )";
            weeklyRateDetailLabel.Text  = "( " + selectedVehicle.RateDetail.WeeklyQty + " x $ " + ((decimal)selectedVehicle.RateDetail.WeeklyRate).ToString("0.00") + " )";
            monthlyRateDetailLabel.Text = "( " + selectedVehicle.RateDetail.MonthlyQty + " x $ " + ((decimal)selectedVehicle.RateDetail.MonthlyRate).ToString("0.00") + " )";
            weekEndRateDetailLabel.Text = "( " + selectedVehicle.RateDetail.WeekendDailyQty + " x $ " + ((decimal)selectedVehicle.RateDetail.WeekendDayRate).ToString("0.00") + " )";

            DailyRateTotal.Text   = "$ " + ((decimal)selectedVehicle.RateDetail.DailyQty * (decimal)selectedVehicle.RateDetail.DailyRate).ToString("0.00");
            weeklyRateTotal.Text  = "$ " + ((decimal)calculateMantatryCharges(selectedVehicle.mantatoryMiscChargeDetails, selectedVehicle.RateDetail.TotalDays)).ToString("0.00");
            monthlyRateTotal.Text = "$ " + ((decimal)selectedVehicle.RateDetail.TaxSum).ToString("0.00");
            weekEndRateTotal.Text = "$ " + ((decimal)selectedVehicle.RateDetail.WeekendDailyQty * (decimal)selectedVehicle.RateDetail.WeekendDayRate).ToString("0.00");

            totalRateLabel.Text = "$ " + ((decimal)selectedVehicle.DailyRate).ToString("0.00");
        }
        public AddAditionalDriver(ReservationView reservationView)
        {
            InitializeComponent();

            //want to edit
            selectedVehicle = null;


            this.reservationView = reservationView;
            if (reservationView.CustomerDriverList == null)
            {
                reservationView.CustomerDriverList = new List <Driver>();
            }
            searchAllCustomerRequest  = new SearchAllCustomerRequest();
            searchAllCustomerResponse = null;
            token = App.Current.Properties["currentToken"].ToString();
        }
 public BookNow(ReservationView reservationView, VehicleViewByTypeForMobile selectedVehicle, List <int> locationIdList)
 {
     InitializeComponent();
     vehicleMobileRequest  = new GetReservationConfigurationMobileRequest();
     vehicleMobileResponse = null;
     search = new ReservationConfigurationVehicleSearch();
     //locationModels = null;
     locationResponse            = null;
     getStoreHoursMobileResponse = null;
     getStoreHoursMobileRequest  = new GetStoreHoursMobileRequest();
     reservationView             = new ReservationView();
     customerId           = 0;
     isBookable           = true;
     this.reservationView = reservationView;
     this.selectedVehicle = selectedVehicle;
     this.locationIdList  = locationIdList;
 }
Ejemplo n.º 10
0
        private void vehicleDetailList_ItemSelected(object sender, SelectedItemChangedEventArgs e)
        {
            VehicleViewByTypeForMobile selectedVehicle = vehicleDetailList.SelectedItem as VehicleViewByTypeForMobile;

            reservationView.VehicleTypeID = selectedVehicle.VehicleTypeId;
            reservationView.VehicleType   = selectedVehicle.VehicleType;
            Rates rates = JsonConvert.DeserializeObject <Rates>(JsonConvert.SerializeObject(selectedVehicle.RateDetail));

            rates.RateId = selectedVehicle.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;
            Navigation.PushAsync(new BookNow(reservationView, selectedVehicle, selectedVehicle.locationIdList));
        }
Ejemplo n.º 11
0
        public VechicleInformationPage(ReservationView reservationView, VehicleViewByTypeForMobile selectedVehicle)
        {
            InitializeComponent();
            this.reservationView = reservationView;
            this.selectedVehicle = selectedVehicle;
            if (selectedVehicle.VehicleTypeImageUrl != null)
            {
                vehileTypeImage.Source = ImageSource.FromUri(new Uri(selectedVehicle.VehicleTypeImageUrl));
            }
            vehicleSampleLabel.Text = selectedVehicle.sample;
            vehicleTypeLabel.Text   = selectedVehicle.VehicleType;
            loactionLabel.Text      = reservationView.StartLocationName + " - " + reservationView.EndLocationName;
            timeLineLabel.Text      = ((DateTime)reservationView.StartDate).ToString("ddd,MM/dd,hh:mm") + " - " + ((DateTime)reservationView.EndDate).ToString("ddd,MM/dd,hh:mm");
            seatCountLabel.Text     = selectedVehicle.Seats.ToString() + " Seats";
            bagCountLabel.Text      = selectedVehicle.NoOfLuggage.ToString() + " Bags";
            gearLabel.Text          = selectedVehicle.Transmission.ToString();
            if (selectedVehicle.doors != null)
            {
                doorCountLabel.Text = selectedVehicle.doors.ToString() + " Doors";
            }
            if (selectedVehicle.HtmlContent != null)
            {
                var htmlSource = new HtmlWebViewSource();
                htmlSource.Html = @"<html><body>" + selectedVehicle.HtmlContent + " </body></html>";

                webView.Source          = htmlSource;
                VehicleDiscription.Text = selectedVehicle.HtmlContent.Replace("<p>", "").Replace("</p>", "").Replace("&nbsp;&nbsp;", "");
            }
            totalAmtLabel.Text = "$ " + selectedVehicle.RateDetail.RateTotal.ToString("0.00");
            //if (selectedVehicle.HtmlContent != null)
            //{
            //    desWebView = new WebView();

            //    var htmlSource = new HtmlWebViewSource();
            //    htmlSource.Html = @"<html><body>
            //                          <h1>Xamarin.Forms</h1>
            //                          <p>Welcome to WebView.</p>
            //                          </body></html>";
            //    desWebView.Source = htmlSource;
            //}
        }
        //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 VechicleInformationPage(ReservationView reservationView, VehicleViewByTypeForMobile selectedVehicle)
        //{
        //    InitializeComponent();
        //    this.reservationView = reservationView;
        //    this.selectedVehicle = selectedVehicle;
        //    if (selectedVehicle.VehicleImageUrl != null)
        //    {
        //        vehileTypeImage.Source = ImageSource.FromUri(new Uri(VehicleDiscription.VehicleImageUrl));
        //    }
        //    vehicleSampleLabel.Text = selectedVehicle.vehicleName;
        //    vehicleTypeLabel.Text = selectedVehicle.VehicleType;
        //    //loactionLabel.Text = reservationView.StartLocationName + " - " + reservationView.EndLocationName;
        //    //timeLineLabel.Text = ((DateTime)reservationView.StartDate).ToString("ddd,MM/dd,hh:mm") + " - " + ((DateTime)reservationView.EndDate).ToString("ddd,MM/dd,hh:mm");
        //    seatCountLabel.Text = selectedVehicle.Seats.ToString() + " Seats";
        //    bagCountLabel.Text = selectedVehicle.NoOfLuggage.ToString() + " Bags";
        //    gearLabel.Text = selectedVehicle.Transmission.ToString();
        //    if (selectedVehicle.doors != null)
        //    {
        //        doorCountLabel.Text = selectedVehicle.doors.ToString() + " Doors";
        //    }
        //    if (selectedVehicle.HtmlContent != null)
        //    {
        //        VehicleDiscription.Text = selectedVehicle.HtmlContent.Replace("<p>", "").Replace("</p>", "").Replace("&nbsp;&nbsp;", "");
        //    }
        //    totalAmtLabel.Text = "$ " + selectedVehicle.DailyRate.ToString();
        //    //if (selectedVehicle.HtmlContent != null)
        //    //{
        //    //    desWebView = new WebView();

        //    //    var htmlSource = new HtmlWebViewSource();
        //    //    htmlSource.Html = @"<html><body>
        //    //                          <h1>Xamarin.Forms</h1>
        //    //                          <p>Welcome to WebView.</p>
        //    //                          </body></html>";
        //    //    desWebView.Source = htmlSource;
        //    //}
        //}

        public VechicleInformationPage(ReservationView reservationView, VehicleViewByTypeForMobile selectedVehicle, List <int> locationIdList)
        {
            InitializeComponent();
            this.reservationView = reservationView;
            this.selectedVehicle = selectedVehicle;
            if (selectedVehicle.VehicleImageUrl != null)
            {
                vehileTypeImage.Source = ImageSource.FromUri(new Uri(selectedVehicle.VehicleImageUrl));
            }
            vehicleSampleLabel.Text = selectedVehicle.vehicleName;
            vehicleTypeLabel.Text   = selectedVehicle.VehicleType;
            //loactionLabel.Text = reservationView.StartLocationName + " - " + reservationView.EndLocationName;
            //timeLineLabel.Text = ((DateTime)reservationView.StartDate).ToString("ddd,MM/dd,hh:mm") + " - " + ((DateTime)reservationView.EndDate).ToString("ddd,MM/dd,hh:mm");
            seatCountLabel.Text = selectedVehicle.Seats.ToString() + " Seats";
            bagCountLabel.Text  = selectedVehicle.NoOfLuggage.ToString() + " Bags";
            gearLabel.Text      = selectedVehicle.Transmission.ToString();
            if (selectedVehicle.doors != null)
            {
                doorCountLabel.Text = selectedVehicle.doors.ToString() + " Doors";
            }
            if (selectedVehicle.HtmlContent != null)
            {
                VehicleDiscription.Text = selectedVehicle.HtmlContent.Replace("<p>", "").Replace("</p>", "").Replace("&nbsp;&nbsp;", "");
            }
            else
            {
                VehicleDiscription.Text = "No description";
            }
            totalAmtLabel.Text  = "$ " + selectedVehicle.DailyRateWithInsurance.ToString();
            this.locationIdList = locationIdList;


            jpp = 0;
            jmp = 0;
            ins = 0;
        }
Ejemplo n.º 14
0
        protected override async void OnAppearing()
        {
            base.OnAppearing();
            var assembly = typeof(BookNow);

            token                 = App.Current.Properties["currentToken"].ToString();
            customerId            = (int)App.Current.Properties["CustomerId"];
            forlistViewItemSource = new List <VehicleViewByTypeForMobile>();

            MessagingCenter.Subscribe <FilterPopup>(this, "FilterUpdated", sender =>
            {
                if (forlistViewItemSource != null)
                {
                    if (forlistViewItemSource.Count > 0)
                    {
                        forlistViewItemSourceWithFiter = new List <VehicleViewByTypeForMobile>();
                        forlistViewItemSourceWithFiter = forlistViewItemSource;
                        if (VehicleFilter.Price > 0)
                        {
                            forlistViewItemSourceWithFiter = filterbyPrice();
                        }
                        if (VehicleFilter.MinPrice > 0)
                        {
                            forlistViewItemSourceWithFiter = filterbyPriceMin();
                        }
                        if (VehicleFilter.VehicleType != null && forlistViewItemSourceWithFiter.Count > 0)
                        {
                            forlistViewItemSourceWithFiter = filterByVehType();
                        }

                        if (VehicleFilter.seatsCount > 0 && forlistViewItemSourceWithFiter.Count > 0)
                        {
                            forlistViewItemSourceWithFiter = filterbySeatCount();
                        }
                        if (VehicleFilter.buggageCount > 0 && forlistViewItemSourceWithFiter.Count > 0)
                        {
                            forlistViewItemSourceWithFiter = filterbyBAgCount();
                        }
                        if (VehicleFilter.DoorsCount > 0 && forlistViewItemSourceWithFiter.Count > 0)
                        {
                            forlistViewItemSourceWithFiter = filterbyDoorCount();
                        }
                        if (VehicleFilter.SortingOrder > -1 && forlistViewItemSourceWithFiter.Count > 0)
                        {
                            forlistViewItemSourceWithFiter = filterbySortingOrder();
                        }
                        if (forlistViewItemSourceWithFiter.Count > 0)
                        {
                            vehicleDetailList.ItemsSource   = null;
                            vehicleDetailList.ItemsSource   = forlistViewItemSourceWithFiter;
                            vehicleDetailList.HeightRequest = forlistViewItemSourceWithFiter.Count * 295;
                            noVehicleLabel.IsVisible        = false;
                            vehicleDetailList.IsVisible     = true;
                            VehicleFilter = null;
                            VehicleFilter = new VehicleFilterSearch();
                        }
                        else
                        {
                            vehicleDetailList.IsVisible = false;
                            //noVehicleLabel.IsVisible = true;
                            // buttonGrid.IsVisible = true;
                            noVehicleLabel.IsVisible = true;
                            VehicleFilter            = null;
                            VehicleFilter            = new VehicleFilterSearch();
                        }
                    }
                }
            });



            if (PopupNavigation.Instance.PopupStack.Count > 0)
            {
                if (PopupNavigation.Instance.PopupStack[PopupNavigation.Instance.PopupStack.Count - 1].GetType() == typeof(ErrorWithClosePagePopup))
                {
                    await PopupNavigation.Instance.PopAllAsync();
                }
            }


            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;
                    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 (vehicleMobileResponse != null)
                {
                    if (vehicleMobileResponse.message.ErrorCode == "200")
                    {
                        if (vehicleMobileResponse.listVehicle.Count > 0)
                        {
                            List <int> vehicleTypeIds = new List <int>();

                            foreach (ReservationVehicleSearchViewModel rvsv in vehicleMobileResponse.listVehicle)
                            {
                                if ((!vehicleTypeIds.Contains(rvsv.VehicleTypeId)))
                                {
                                    vehicleTypeIds.Add(rvsv.VehicleTypeId);
                                    VehicleViewByTypeForMobile typeForMobile = new VehicleViewByTypeForMobile();
                                    typeForMobile.VehicleTypeId                 = rvsv.VehicleTypeId;
                                    typeForMobile.VehicleType                   = rvsv.VehicleType;
                                    typeForMobile.Transmission                  = rvsv.Transmission;
                                    typeForMobile.Seats                         = rvsv.Seats;
                                    typeForMobile.NoOfLuggage                   = rvsv.Baggages;
                                    typeForMobile.DailyRate                     = decimal.Round((decimal)rvsv.RateDetail.DailyRate, 2);
                                    typeForMobile.VehicleTypeImageUrl           = rvsv.VehicleTypeImage;
                                    typeForMobile.RateDetail                    = rvsv.RateDetail;
                                    typeForMobile.MileagePerDay                 = rvsv.MileagePerDay;
                                    typeForMobile.doors                         = rvsv.Doors;
                                    typeForMobile.IsVehicleAvailableDescription = rvsv.IsVehicleAvailableDescription;
                                    typeForMobile.HtmlContent                   = rvsv.HtmlContent;
                                    typeForMobile.SharableLink                  = rvsv.SharableLink;

                                    typeForMobile.sample         = rvsv.Sample;
                                    typeForMobile.locationIdList = new List <int>();
                                    typeForMobile.locationIdList.Add(rvsv.LocationId);

                                    forlistViewItemSource.Add(typeForMobile);

                                    vehicletypeList.Add(rvsv.VehicleType);
                                }
                                else
                                {
                                    foreach (VehicleViewByTypeForMobile listIntype in forlistViewItemSource)
                                    {
                                        if (rvsv.VehicleTypeId == listIntype.VehicleTypeId)
                                        {
                                            if (rvsv.Transmission != listIntype.Transmission)
                                            {
                                                listIntype.Transmission = "Auto, Manual";
                                            }
                                        }

                                        if (!listIntype.locationIdList.Contains(rvsv.LocationId))
                                        {
                                            listIntype.locationIdList.Add(rvsv.LocationId);
                                        }
                                    }
                                }
                            }
                            if (forlistViewItemSource.Count > 0)
                            {
                                vehicleDetailList.ItemsSource   = forlistViewItemSource;
                                vehicleDetailList.HeightRequest = forlistViewItemSource.Count * 290;
                                vehicleDetailList.IsVisible     = true;
                            }
                            else
                            {
                                vehicleDetailList.IsVisible = false;
                                //noVehicleLabel.IsVisible = true;
                                // buttonGrid.IsVisible = true;
                                noVehicleLabel.IsVisible = true;
                            }
                        }
                    }
                    else
                    {
                        await PopupNavigation.Instance.PushAsync(new ErrorWithClosePagePopup(vehicleMobileResponse.message.ErrorMessage));
                    }
                }
            }
        }
Ejemplo n.º 15
0
        protected override async void OnAppearing()
        {
            base.OnAppearing();
            var assembly = typeof(BookNow);

            token                 = App.Current.Properties["currentToken"].ToString();
            customerId            = (int)App.Current.Properties["CustomerId"];
            forlistViewItemSource = new List <VehicleViewByTypeForMobile>();


            if (customerId == 0)
            {
                loginIcon.IconImageSource = ImageSource.FromResource("MaxVonGrafKftMobile.Assets.LogInTool.png", assembly);
            }
            else
            {
                loginIcon.IconImageSource = ImageSource.FromResource("MaxVonGrafKftMobile.Assets.logOutTool.png", assembly);
            }

            if (PopupNavigation.Instance.PopupStack.Count > 0)
            {
                if (PopupNavigation.Instance.PopupStack[PopupNavigation.Instance.PopupStack.Count - 1].GetType() == typeof(ErrorWithClosePagePopup))
                {
                    await PopupNavigation.Instance.PopAllAsync();
                }
            }


            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;
                    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 (vehicleMobileResponse != null)
                {
                    if (vehicleMobileResponse.message.ErrorCode == "200")
                    {
                        if (vehicleMobileResponse.listVehicle.Count > 0)
                        {
                            List <int> vehicleTypeIds = new List <int>();

                            foreach (ReservationVehicleSearchViewModel rvsv in vehicleMobileResponse.listVehicle)
                            {
                                if (!vehicleTypeIds.Contains(rvsv.VehicleTypeId))
                                {
                                    vehicleTypeIds.Add(rvsv.VehicleTypeId);
                                    VehicleViewByTypeForMobile typeForMobile = new VehicleViewByTypeForMobile();
                                    typeForMobile.VehicleTypeId   = rvsv.VehicleTypeId;
                                    typeForMobile.VehicleType     = rvsv.VehicleType;
                                    typeForMobile.Transmission    = rvsv.Transmission;
                                    typeForMobile.Seats           = rvsv.Seats;
                                    typeForMobile.NoOfLuggage     = rvsv.NoOfLuggage;
                                    typeForMobile.DailyRate       = rvsv.RateDetail.DailyRate;
                                    typeForMobile.VehicleImageUrl = rvsv.VehicleImageUrl;
                                    typeForMobile.RateDetail      = rvsv.RateDetail;
                                    typeForMobile.sample          = rvsv.Sample;
                                    forlistViewItemSource.Add(typeForMobile);
                                }
                            }

                            vehicleDetailList.ItemsSource   = forlistViewItemSource;
                            vehicleDetailList.HeightRequest = forlistViewItemSource.Count * 290;
                            vehicleDetailList.IsVisible     = true;
                        }
                        else
                        {
                            vehicleDetailList.IsVisible = false;
                            //noVehicleLabel.IsVisible = true;
                            buttonGrid.IsVisible     = true;
                            noVehicleLabel.IsVisible = true;
                        }
                    }
                    else
                    {
                        await PopupNavigation.Instance.PushAsync(new ErrorWithClosePagePopup(vehicleMobileResponse.message.ErrorMessage));
                    }
                }
            }
        }
Ejemplo n.º 16
0
        protected override async void OnAppearing()
        {
            customerId = (int)App.Current.Properties["CustomerId"];
            base.OnAppearing();
            var assembly = typeof(BookNow);

            token = App.Current.Properties["currentToken"].ToString();
            customerId = (int)App.Current.Properties["CustomerId"];
            forlistViewItemSource = new List<VehicleViewByTypeForMobile>();

            MessagingCenter.Subscribe<FilterPopup>(this, "FilterUpdated", sender =>
            {
                refreshVehicleList();
                
            });




            if (PopupNavigation.Instance.PopupStack.Count > 0)
            {
                if (PopupNavigation.Instance.PopupStack[PopupNavigation.Instance.PopupStack.Count - 1].GetType() == typeof(ErrorWithClosePagePopup))
                {
                    await PopupNavigation.Instance.PopAllAsync();
                }
            }


            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;
                    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 (vehicleMobileResponse != null)
                {
                    if (vehicleMobileResponse.message.ErrorCode == "200")
                    {
                        if (vehicleMobileResponse.listVehicle.Count > 0)
                        {
                            vehicleFilterMenus.vehicleTypes = new List<string>();
                            vehicleFilterMenus.vehicleMakes = new List<string>();
                            vehicleFilterMenus.vehicleModels = new List<string>();
                            vehicleFilterMenus.VehicleYear = new List<int>();
                            vehicleFilterMenus.NumberOfseats = new List<int>();
                            vehicleFilterMenus.Colors = new List<string>();

                            List<int> vehicleTypeIds = new List<int>();

                            foreach (ReservationVehicleSearchViewModel rvsv in vehicleMobileResponse.listVehicle)
                            {
                                if (rvsv.VehicleStatusId == (int)VehicleStatus.Available)
                                {
                                    vehicleTypeIds.Add(rvsv.VehicleTypeId);
                                    VehicleViewByTypeForMobile typeForMobile = new VehicleViewByTypeForMobile();
                                    typeForMobile.VehicleTypeId = rvsv.VehicleTypeId;
                                    typeForMobile.VehicleType = rvsv.VehicleType;
                                    typeForMobile.vehicleMakeName = rvsv.VehicleMakeName;
                                    typeForMobile.vehicleModelName = rvsv.ModelName;
                                    typeForMobile.vehicleYear = (int)rvsv.Year;
                                    typeForMobile.Transmission = rvsv.Transmission;
                                    typeForMobile.Seats = rvsv.Seats;
                                    typeForMobile.NoOfLuggage = rvsv.Baggages;
                                    typeForMobile.DailyRate = decimal.Round(((decimal)rvsv.RateDetail.DailyRate + calculateMantatryCharges(rvsv.mantatoryMiscChargeDetails, 1)), 2);
                                    typeForMobile.DailyRateWithInsurance = decimal.Round(((decimal)rvsv.RateDetail.DailyRate + calculateMantatryChargesWithInsurance(rvsv.mantatoryMiscChargeDetails, 1)), 2); 
                                    typeForMobile.VehicleTypeImageUrl = rvsv.VehicleTypeImage;
                                    typeForMobile.RateDetail = rvsv.RateDetail;
                                    typeForMobile.MileagePerDay = rvsv.MileagePerDay;
                                    typeForMobile.doors = rvsv.Doors;
                                    typeForMobile.IsVehicleAvailableDescription = rvsv.IsVehicleAvailableDescription;
                                    typeForMobile.HtmlContent = rvsv.HtmlContent;
                                    typeForMobile.SharableLink = rvsv.SharableLink;
                                    typeForMobile.VehicleImageUrl = rvsv.VehicleImageUrl;
                                    typeForMobile.mantatoryMiscChargeDetails = rvsv.mantatoryMiscChargeDetails;
                                    typeForMobile.mantatoryMiscChargeNonTaxableTotalForOneDay = rvsv.mantatoryMiscChargeNonTaxableTotalForOneDay;
                                    typeForMobile.mantatoryMiscChargeTotalForOneDay = rvsv.mantatoryMiscChargeTotalForOneDay;
                                    typeForMobile.color = rvsv.Color;
                                    

                                    typeForMobile.sample = rvsv.Sample;
                                    typeForMobile.locationIdList = new List<int>();
                                    if (!typeForMobile.locationIdList.Contains(rvsv.LocationId))
                                    {
                                        typeForMobile.locationIdList.Add(rvsv.LocationId);
                                    }
                                    typeForMobile.vehicleId = rvsv.vehicleId;
                                    typeForMobile.vehicleName = rvsv.Year + " " + rvsv.VehicleMakeName + " " + rvsv.ModelName;

                                    forlistViewItemSource.Add(typeForMobile);
                                    if (!vehicleFilterMenus.vehicleTypes.Contains(rvsv.VehicleType))
                                    {
                                        vehicleFilterMenus.vehicleTypes.Add(rvsv.VehicleType);
                                    }
                                    if (!vehicleFilterMenus.vehicleMakes.Contains(rvsv.VehicleMakeName))
                                    {
                                        vehicleFilterMenus.vehicleMakes.Add(rvsv.VehicleMakeName);
                                    }
                                    if (!vehicleFilterMenus.vehicleModels.Contains(rvsv.ModelName))
                                    {
                                        vehicleFilterMenus.vehicleModels.Add(rvsv.ModelName);
                                    }
                                    if (!vehicleFilterMenus.VehicleYear.Contains((int)rvsv.Year))
                                    {
                                        vehicleFilterMenus.VehicleYear.Add((int)rvsv.Year);
                                    }
                                    if (!vehicleFilterMenus.NumberOfseats.Contains(rvsv.Seats))
                                    {
                                        vehicleFilterMenus.NumberOfseats.Add(rvsv.Seats);
                                    }
                                    if (!vehicleFilterMenus.Colors.Contains(rvsv.Color.ToLower().Trim()))
                                    {
                                        vehicleFilterMenus.Colors.Add(rvsv.Color.ToLower().Trim());
                                    }
                                }
                                //else
                                //{

                                //    foreach (VehicleViewByTypeForMobile listIntype in forlistViewItemSource)
                                //    {
                                //        if (rvsv.VehicleTypeId == listIntype.VehicleTypeId)
                                //        {
                                //            if (rvsv.Transmission != listIntype.Transmission)
                                //            {
                                //                listIntype.Transmission = "Auto, Manual";
                                //            }
                                //        }

                                //        if (!listIntype.locationIdList.Contains(rvsv.LocationId))
                                //        {
                                //            listIntype.locationIdList.Add(rvsv.LocationId);
                                //        }
                                //    }

                                //}

                            }
                            if (forlistViewItemSource.Count > 0)
                            {
                                vehicleDetailList.ItemsSource = forlistViewItemSource;
                                vehicleDetailList.HeightRequest = (forlistViewItemSource.Count * 320);
                                vehicleDetailList.IsVisible = true;

                            }
                            else
                            {
                                vehicleDetailList.IsVisible = false;
                                //noVehicleLabel.IsVisible = true;
                                // buttonGrid.IsVisible = true;
                                noVehicleLabel.IsVisible = true;
                                filterbuttonGrid.IsVisible = false;

                            }

                        }

                    }
                    else
                    {
                        await PopupNavigation.Instance.PushAsync(new ErrorWithClosePagePopup(vehicleMobileResponse.message.ErrorMessage));
                    }
                }
            }
        }