예제 #1
0
        public HomePageDetail()
        {
            InitializeComponent();
            customerId = (int)Application.Current.Properties["CustomerId"];
            _token     = Application.Current.Properties["currentToken"].ToString();
            registrationDBModelRequest            = new GetReservationAgreementMobileRequest();
            registrationDBModelRequest.customerId = customerId;
            registrationDBModelResponse           = null;
            registrationDBModel                              = null;
            agreementIdMobileResponse                        = null;
            agreementIdMobileRequest                         = new GetAgreementByAgreementIdMobileRequest();
            getAgreementByCustomerIdMobileRequest            = new getAgreementByCustomerIdMobileRequest();
            getAgreementByCustomerIdMobileRequest.customerId = customerId;
            customerAgreementModels                          = null;
            lastAgreementId     = 0;
            lastAgreementStatus = null;

            reservationByIDMobileRequest = new GetReservationByIDMobileRequest();
            isreservation    = false;
            isAgreement      = false;
            agreementId      = 0;
            vehicleId        = 0;
            isAgreeRefreshed = false;


            // BooknowBtn.BackgroundColor = (Color)App.Current.Properties["MaxVonYellow"];
        }
예제 #2
0
        public GetReservationAgreementMobileResponse getMobileRegistrationDBModel(GetReservationAgreementMobileRequest registrationDBModelRequest, string token)
        {
            GetReservationAgreementMobileResponse response = null;

            try
            {
                response = registerservice.getMobileRegistrationDBModel(registrationDBModelRequest, token);

                //if(response.regDB != null)
                //{
                //    if(response.regDB.Agreements != null)
                //    {
                //        if (response.regDB.Agreements.Count > 0)
                //        {

                //            GetVehicleDetailsMobileListResponse getVehicleDetailsMobile = null;
                //            VehicleService vehicleService = new VehicleService();
                //            getVehicleDetailsMobile = vehicleService.getVehicleTypesMobile(token);
                //            AgreementService agreementService = new AgreementService();
                //            foreach (CustomerAgreementModel cam in response.regDB.Agreements)
                //            {
                //                int agreeId = cam.AgreementId;
                //                int vehId = cam.VehicleId;
                //                int vehicleTypeID = 0;
                //                GetAgreementByAgreementIdMobileResponse agreementByAgreementIdMobileResponse = null;
                //                GetAgreementByAgreementIdMobileRequest agreementIdMobileRequest = new GetAgreementByAgreementIdMobileRequest();
                //                agreementIdMobileRequest.agreementId = agreeId;
                //                agreementByAgreementIdMobileResponse = agreementService.getAgreement(agreementIdMobileRequest, token);
                //                cam.custAgreement = agreementByAgreementIdMobileResponse.custAgreement;
                //                foreach (VehicleTypeMobileResult vtmr in getVehicleDetailsMobile.listVehicle)
                //                {
                //                    if (vtmr.VehicleType == agreementByAgreementIdMobileResponse.custAgreement.AgreementDetail.VehicleType)
                //                    {
                //                        vehicleTypeID = vtmr.VehicleTypeId;
                //                    }
                //                }
                //                if (vehId > 0 && vehicleTypeID > 0)
                //                {
                //                    cam.agreementVehicle = vehicleService.Getvehicle(vehicleTypeID, vehId, token);
                //                }
                //            }
                //        }
                //    }
                //}
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(response);
        }
예제 #3
0
        private GetReservationAgreementMobileResponse getMobileRegistrationDBModel(GetReservationAgreementMobileRequest registrationDBModelRequest, string token)
        {
            GetReservationAgreementMobileResponse response = null;

            try
            {
                RegisterController registerController = new RegisterController();
                response = registerController.getMobileRegistrationDBModel(registrationDBModelRequest, token);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(response);
        }
예제 #4
0
        public GetReservationAgreementMobileResponse getMobileRegistrationDBModel(GetReservationAgreementMobileRequest registrationDBModelRequest, string token)
        {
            GetReservationAgreementMobileResponse resp = null;

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

                    var myContent   = JsonConvert.SerializeObject(registrationDBModelRequest);
                    var buffer      = System.Text.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;
                        resp = JsonConvert.DeserializeObject <GetReservationAgreementMobileResponse>(responseStream);
                    }
                    else
                    {
                        ApiMessage mes = new ApiMessage();
                        resp             = new GetReservationAgreementMobileResponse();
                        mes.ErrorCode    = response.StatusCode.ToString();
                        mes.ErrorMessage = response.ReasonPhrase.ToString();
                        mes.Status       = response.IsSuccessStatusCode.ToString();
                        resp.message     = mes;
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(resp);
        }
예제 #5
0
        public HomePageDetail()
        {
            InitializeComponent();
            customerId = (int)Application.Current.Properties["CustomerId"];
            _token     = Application.Current.Properties["currentToken"].ToString();
            registrationDBModelRequest            = new GetReservationAgreementMobileRequest();
            registrationDBModelRequest.customerId = customerId;
            registrationDBModelResponse           = null;
            registrationDBModel                              = null;
            agreementIdMobileResponse                        = null;
            agreementIdMobileRequest                         = new GetAgreementByAgreementIdMobileRequest();
            getAgreementByCustomerIdMobileRequest            = new getAgreementByCustomerIdMobileRequest();
            getAgreementByCustomerIdMobileRequest.customerId = customerId;
            customerAgreementModels                          = null;
            lastAgreementId     = 0;
            lastAgreementStatus = null;

            reservationByIDMobileRequest = new GetReservationByIDMobileRequest();
            isreservation           = false;
            isAgreement             = false;
            agreementId             = 0;
            vehicleId               = 0;
            isAgreeRefreshed        = false;
            estTime                 = DateTime.Now;
            request                 = new ExtendAgreementRequest();
            response                = null;
            overDueBalanceViewModel = new OverDueBalanceViewModel();

            ICommand refreshCommand = new Command(() =>
            {
                refreshView.IsRefreshing = true;
                this.OnAppearing();
                refreshView.IsRefreshing = false;
            });

            refreshView.Command = refreshCommand;

            // BooknowBtn.BackgroundColor = (Color)App.Current.Properties["MaxVonYellow"];
        }
예제 #6
0
        protected override async void OnAppearing()
        {
            base.OnAppearing();
            unSelectedTab();
            btnMyRentals.BackgroundColor = Color.FromHex("#000000");
            btnMyRentals.TextColor       = Color.White;
            grdRentals.IsVisible         = true;
            lastAgreementStack.IsVisible = false;
            Constants.IsHome             = true;
            if (PopupNavigation.Instance.PopupStack.Count > 0)
            {
                if (PopupNavigation.Instance.PopupStack[PopupNavigation.Instance.PopupStack.Count - 1].GetType() == typeof(ErrorWithClosePagePopup))
                {
                    await PopupNavigation.Instance.PopAllAsync();
                }
            }

            Common.mMasterPage.Master      = new HomePageMaster();
            Common.mMasterPage.IsPresented = false;

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

                    await Task.Run(async() =>
                    {
                        try
                        {
                            //registrationDBModel = getRegistrationDBModel(customerId, _token);
                            registrationDBModelResponse = getMobileRegistrationDBModel(registrationDBModelRequest, _token);



                            customerAgreementModels = getReservations(customerId, _token);
                        }

                        //registrationDBModel.Reservations[0].ReservationId
                        catch (Exception ex)
                        {
                            App.Current.Properties["CustomerId"] = 0;
                            await PopupNavigation.Instance.PushAsync(new ErrorWithClosePagePopup(ex.Message));
                        }
                    });
                }
                finally
                {
                    busy = false;
                    if (PopupNavigation.Instance.PopupStack.Count == 1)
                    {
                        await PopupNavigation.Instance.PopAllAsync();
                    }
                    else if (PopupNavigation.Instance.PopupStack.Count > 1)
                    {
                        if (PopupNavigation.Instance.PopupStack[PopupNavigation.Instance.PopupStack.Count - 1].GetType() != typeof(ErrorWithClosePagePopup))
                        {
                            await PopupNavigation.Instance.PopAllAsync();
                        }
                    }
                }

                if (registrationDBModelResponse != null)
                {
                    if (registrationDBModelResponse.message.ErrorCode == "200")
                    {
                        registrationDBModel = registrationDBModelResponse.regDB;
                    }
                    else
                    {
                        await PopupNavigation.Instance.PushAsync(new ErrorWithClosePagePopup(registrationDBModelResponse.message.ErrorMessage));
                    }
                }
            }
            if (registrationDBModel != null)
            {
                if (registrationDBModel.Reservations.Count > 0)
                {
                    if (registrationDBModel.Reservations[0].Status == "Open" || registrationDBModel.Reservations[0].Status == "New" || registrationDBModel.Reservations[0].Status == "Quote")
                    {
                        ViewReservation(registrationDBModel);
                        BooknowBtn.IsVisible = false;
                        //if(registrationDBModel.Reservations[0].Status == "Canceled")
                        //{
                        //    BooknowBtn.IsVisible = true;
                        //}
                    }
                    else if (registrationDBModel.Reservations[0].Status == "CheckOut" || registrationDBModel.Reservations[0].Status == "Canceled")
                    {
                        isreservation = false;
                        isAgreement   = true;
                        if (registrationDBModel.Agreements.Count > 0)
                        {
                            if (registrationDBModel.Agreements[0].Status == "Open")
                            {
                                viewAgreement(registrationDBModel);
                                BooknowBtn.IsVisible = false;
                            }
                            else
                            {
                                isAgreement   = false;
                                isreservation = false;
                                upcomingReservation.IsVisible = false;
                                emptyReservation.IsVisible    = true;
                                BooknowBtn.IsVisible          = true;
                            }
                        }
                    }
                }
                else if (registrationDBModel.Agreements.Count > 0)
                {
                    if (registrationDBModel.Agreements[0].Status == "Open")
                    {
                        viewAgreement(registrationDBModel);
                        BooknowBtn.IsVisible = true;
                    }
                    else
                    {
                        isAgreement   = false;
                        isreservation = false;
                        upcomingReservation.IsVisible = false;
                        emptyReservation.IsVisible    = true;
                        BooknowBtn.IsVisible          = true;
                    }
                }
                else
                {
                    upcomingReservation.IsVisible = false;
                    emptyReservation.IsVisible    = true;
                    BooknowBtn.IsVisible          = true;
                    // upReserveFrame.HeightRequest = 290;
                }


                if (customerAgreementModels != null)
                {
                    if (customerAgreementModels.Count > 0)
                    {
                        lastAgreementId     = registrationDBModel.Agreements[0].AgreementId;
                        lastAgreementStatus = registrationDBModel.Agreements[0].Status;
                        if (customerAgreementModels[customerAgreementModels.Count - 1].Status == "Open")
                        {
                            customerAgreementModels.RemoveAt(customerAgreementModels.Count - 1);
                        }

                        List <CustomerAgreementModel> agreementItemSource = new List <CustomerAgreementModel>();

                        foreach (CustomerAgreementModel camfl in customerAgreementModels)
                        {
                            if (camfl.Status != null)
                            {
                                if (camfl.Status == "Close" || camfl.Status == "Pending_Payment")
                                {
                                    camfl.custAgreement.AgreementTotal.totalAmountStr = ((decimal)camfl.custAgreement.AgreementTotal.TotalAmount).ToString("0.00");
                                    agreementItemSource.Add(camfl);
                                }
                            }
                        }
                        agreementItemSource.Reverse();

                        myRentals.ItemsSource    = agreementItemSource;
                        myRentals.HeightRequest  = agreementItemSource.Count * 400;
                        emptyMyrentals.IsVisible = false;
                        myRentals.IsVisible      = true;
                    }
                    else
                    {
                        emptyMyrentals.IsVisible = true;
                        myRentals.IsVisible      = false;
                    }
                }

                else
                {
                    myRentals.IsVisible = false;
                    // emptyMyrentals.IsVisible = true;
                    // myRentFrame.HeightRequest = 290;
                }


                var AllReservationTap = new TapGestureRecognizer();
                AllReservationTap.Tapped += async(s, e) =>
                {
                    Constants.IsHome = false;
                    if (Navigation.NavigationStack[Navigation.NavigationStack.Count - 1].GetType() != typeof(UpcomingReservations))
                    {
                        await Navigation.PushAsync(new UpcomingReservations());
                    }
                };
                //allReservationLabel.GestureRecognizers.Add(AllReservationTap);

                var AllmyrentalsTap = new TapGestureRecognizer();
                AllmyrentalsTap.Tapped += async(s, e) =>
                {
                    Constants.IsHome = false;
                    if (Navigation.NavigationStack[Navigation.NavigationStack.Count - 1].GetType() != typeof(MyRentals))
                    {
                        await Navigation.PushAsync(new MyRentals());
                    }
                };
                //allAgreementLabel.GestureRecognizers.Add(AllmyrentalsTap);
            }
        }
예제 #7
0
        protected override async void OnAppearing()
        {
            base.OnAppearing();

            Constants.IsHomeDetail = true;
            DateTime     timeUtc = DateTime.UtcNow;
            TimeZoneInfo estZone = TimeZoneInfo.FindSystemTimeZoneById("America/New_York");

            estTime  = TimeZoneInfo.ConvertTimeFromUtc(timeUtc, estZone);
            dateDiff = DateTime.Now - estTime;

            unSelectedTab();
            btnMyRentals.BackgroundColor = Color.FromHex("#DD0803");
            btnMyRentals.TextColor       = Color.White;
            grdRentals.IsVisible         = true;
            lastAgreementStack.IsVisible = false;
            Constants.IsHome             = true;
            bool canRun = true;

            if (PopupNavigation.Instance.PopupStack.Count > 0)
            {
                if (PopupNavigation.Instance.PopupStack[PopupNavigation.Instance.PopupStack.Count - 1] is editPrrofilePhotoPage || PopupNavigation.Instance.PopupStack[PopupNavigation.Instance.PopupStack.Count - 1] is AddCustomerPhotoPopup)
                {
                    canRun = false;
                }
                if (PopupNavigation.Instance.PopupStack[PopupNavigation.Instance.PopupStack.Count - 1].GetType() == typeof(ErrorWithClosePagePopup))
                {
                    await PopupNavigation.Instance.PopAllAsync();
                }
            }

            if (canRun)
            {
                Common.mMasterPage.Master      = new HomePageMaster();
                Common.mMasterPage.IsPresented = false;

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

                        await Task.Run(async() =>
                        {
                            try
                            {
                                //registrationDBModel = getRegistrationDBModel(customerId, _token);
                                registrationDBModelResponse = getMobileRegistrationDBModel(registrationDBModelRequest, _token);


                                if (!isAgreeRefreshed)
                                {
                                    customerAgreementModels = getReservations(customerId, _token);
                                }
                                isAgreeRefreshed = true;
                            }

                            //registrationDBModel.Reservations[0].ReservationId
                            catch (Exception ex)
                            {
                                App.Current.Properties["CustomerId"] = 0;
                                await PopupNavigation.Instance.PushAsync(new ErrorWithClosePagePopup(ex.Message));
                            }
                        });
                    }
                    finally
                    {
                        busy = false;
                        if (PopupNavigation.Instance.PopupStack.Count == 1)
                        {
                            await PopupNavigation.Instance.PopAllAsync();
                        }
                        else if (PopupNavigation.Instance.PopupStack.Count > 1)
                        {
                            if (PopupNavigation.Instance.PopupStack[PopupNavigation.Instance.PopupStack.Count - 1].GetType() != typeof(ErrorWithClosePagePopup))
                            {
                                await PopupNavigation.Instance.PopAllAsync();
                            }
                        }
                    }

                    if (registrationDBModelResponse != null)
                    {
                        if (registrationDBModelResponse.message.ErrorCode == "200")
                        {
                            registrationDBModel = registrationDBModelResponse.regDB;
                        }
                        else
                        {
                            await PopupNavigation.Instance.PushAsync(new ErrorWithClosePagePopup(registrationDBModelResponse.message.ErrorMessage));
                        }
                    }
                }
                if (registrationDBModel != null)
                {
                    if (registrationDBModel.Reservations.Count > 0)
                    {
                        if (registrationDBModel.Reservations[0].Status == "Open" || registrationDBModel.Reservations[0].Status == "New" || registrationDBModel.Reservations[0].Status == "Quote" || registrationDBModel.Reservations[0].Status == "Canceled")
                        {
                            isreservation = true;
                            isAgreement   = false;
                            reservationByIDMobileRequest.ReservationID = registrationDBModel.Reservations[0].ReservationId;

                            busy = false;
                            if (!busy)
                            {
                                try
                                {
                                    busy = true;
                                    grdRentals.IsVisible         = false;
                                    lastAgreementStack.IsVisible = false;
                                    LoadingStack.IsVisible       = true;
                                    await Task.Run(() =>
                                    {
                                        try
                                        {
                                            reservationByIDMobileResponse = getReservationByID(reservationByIDMobileRequest, _token);
                                        }
                                        catch (Exception ex)
                                        {
                                            PopupNavigation.Instance.PushAsync(new ErrorWithClosePagePopup(ex.Message));
                                        }
                                    });
                                }
                                finally
                                {
                                    busy = false;
                                    grdRentals.IsVisible         = true;
                                    LoadingStack.IsVisible       = false;
                                    lastAgreementStack.IsVisible = false;
                                    //reservationByIDMobileResponse.reservationData.Reservationview.StartDateStrForView = ((DateTime)reservationByIDMobileResponse.reservationData.Reservationview.StartDate).ToString("dddd, dd MMMM yyyy hh:mm tt");
                                    //reservationByIDMobileResponse.reservationData.Reservationview.EndDateStrForView = ((DateTime)reservationByIDMobileResponse.reservationData.Reservationview.EndDate).ToString("dddd, dd MMMM yyyy hh:mm tt");
                                    reservationByIDMobileResponse.reservationData.Reservationview.PageTitle = Enum.GetName(typeof(ReservationStatuses), reservationByIDMobileResponse.reservationData.Reservationview.Status);
                                    if (reservationByIDMobileResponse.reservationData.Reservationview.Status == (short)ReservationStatuses.Quote)
                                    {
                                        reservationByIDMobileResponse.reservationData.Reservationview.PageTitle     = "Pending";
                                        reservationByIDMobileResponse.reservationData.Reservationview.ExtendVisible = true;
                                    }
                                    if (reservationByIDMobileResponse.reservationData.Reservationview.Status == (short)ReservationStatuses.Open)
                                    {
                                        reservationByIDMobileResponse.reservationData.Reservationview.PageTitle     = "Pending Pickup";
                                        reservationByIDMobileResponse.reservationData.Reservationview.ExtendVisible = true;
                                    }
                                    if (reservationByIDMobileResponse.reservationData.Reservationview.Status == (short)ReservationStatuses.Canceled)
                                    {
                                        reservationByIDMobileResponse.reservationData.Reservationview.ExtendVisible = false;
                                    }

                                    if (reservationByIDMobileResponse.vehicleTypeModel == null)
                                    {
                                        reservationByIDMobileResponse = FixAsResponsibleToReservationByVehicle(reservationByIDMobileResponse);
                                    }



                                    reservationByIDMobileResponse.isTimerVisible = false;
                                    List <GetReservationByIDMobileResponse> upreserItemSource = new List <GetReservationByIDMobileResponse>();
                                    upreserItemSource.Add(reservationByIDMobileResponse);
                                    upcomingReservation.ItemsSource   = upreserItemSource;
                                    upcomingReservation.HeightRequest = upcomingReservation.RowHeight;
                                    if (reservationByIDMobileResponse.reservationData.Reservationview.Status == (short)ReservationStatuses.Canceled)
                                    {
                                        BooknowBtn.IsVisible = true;
                                        isbookingBtnVisible  = true;
                                    }
                                    else
                                    {
                                        BooknowBtn.IsVisible = false;
                                        isbookingBtnVisible  = false;
                                    }
                                }
                            }
                            //if(registrationDBModel.Reservations[0].Status == "Canceled")
                            //{
                            //    BooknowBtn.IsVisible = true;
                            //}
                        }
                        else if (registrationDBModel.Reservations[0].Status == "CheckOut")
                        {
                            isreservation = false;
                            isAgreement   = true;
                            if (registrationDBModel.Agreements.Count > 0)
                            {
                                if (registrationDBModel.Agreements[0].Status == "Open")
                                {
                                    isAgreement        = true;
                                    agreementTimerList = new ObservableCollection <Event>()
                                    {
                                        new Event {
                                            Date = registrationDBModel.Agreements[0].CheckinDate
                                        }
                                    };


                                    Setup();
                                    agreementIdMobileRequest.agreementId = registrationDBModel.Agreements[0].AgreementId;
                                    agreementId = registrationDBModel.Agreements[0].AgreementId;
                                    int vehicleID = registrationDBModel.Agreements[0].VehicleId;
                                    vehicleId           = vehicleID;
                                    request.agreementId = agreementId;

                                    busy = false;
                                    if (!busy)
                                    {
                                        try
                                        {
                                            busy = true;
                                            grdRentals.IsVisible         = false;
                                            lastAgreementStack.IsVisible = false;
                                            LoadingStack.IsVisible       = true;
                                            await Task.Run(() =>
                                            {
                                                try
                                                {
                                                    agreementIdMobileResponse = getAgreement(agreementIdMobileRequest, _token, vehicleID);
                                                }
                                                catch (Exception ex)
                                                {
                                                    PopupNavigation.Instance.PushAsync(new ErrorWithClosePagePopup(ex.Message));
                                                }
                                            });
                                        }
                                        finally
                                        {
                                            busy = false;
                                            grdRentals.IsVisible         = false;
                                            LoadingStack.IsVisible       = false;
                                            lastAgreementStack.IsVisible = true;
                                            AgreementNumberLabel.Text    = agreementIdMobileResponse.custAgreement.AgreementDetail.AgreementNumber;
                                            AgreementReviewDetailSet agreement = agreementIdMobileResponse.custAgreement;
                                            string agrStatus = Enum.GetName(typeof(AgreementStatusConst), agreementIdMobileResponse.custAgreement.AgreementDetail.Status);
                                            statusLabel.Text = Enum.GetName(typeof(AgreementStatusConst), agreementIdMobileResponse.custAgreement.AgreementDetail.Status);
                                            if (agrStatus == "Open")
                                            {
                                                statusLabel.Text = "Active";
                                            }
                                            vehicleNameLabel.Text     = agreement.AgreementDetail.Year + " " + agreement.AgreementDetail.VehicleMakeName + " " + agreement.AgreementDetail.ModelName;
                                            VehicleTypeLabel.Text     = agreement.AgreementDetail.VehicleType;
                                            seatsCount.Text           = agreementIdMobileResponse.agreementVehicle.Seats;
                                            bagsCount.Text            = agreementIdMobileResponse.agreementVehicle.Baggages.ToString();
                                            TransType.Text            = agreementIdMobileResponse.agreementVehicle.Transmission;
                                            totalAmountLabel.Text     = "Days: " + agreement.AgreementDetail.TotalDays.ToString();
                                            pickUpLocationLabel.Text  = "Pivet Atlanta 2244 Metropolitan Pkwy SW, Atlanta, GA 30315";
                                            pickUpDateLabel.Text      = agreement.AgreementDetail.CheckoutDate.ToString("dddd, dd MMMM yyyy hh:mm tt");
                                            dropOffLocationLabel.Text = "Pivet Atlanta 2244 Metropolitan Pkwy SW, Atlanta, GA 30315";
                                            dropOffDateLabel.Text     = agreement.AgreementDetail.CheckinDate.ToString("dddd, dd MMMM yyyy hh:mm tt");
                                            VehicleImage.Source       = ImageSource.FromUri(new Uri(agreementIdMobileResponse.agreementVehicle.ImageUrl));



                                            if (estTime > agreement.AgreementDetail.CheckinDate)
                                            {
                                                setUpOverDueBalance();
                                            }
                                        }
                                    }
                                }
                                else
                                {
                                    isAgreement   = false;
                                    isreservation = false;
                                    upcomingReservation.IsVisible = false;
                                    emptyReservation.IsVisible    = true;
                                    BooknowBtn.IsVisible          = true;
                                }
                            }
                        }
                    }
                    else
                    {
                        upcomingReservation.IsVisible = false;
                        emptyReservation.IsVisible    = true;
                        BooknowBtn.IsVisible          = true;
                        // upReserveFrame.HeightRequest = 290;
                    }


                    if (customerAgreementModels != null)
                    {
                        if (customerAgreementModels.Count > 0)
                        {
                            lastAgreementId     = registrationDBModel.Agreements[0].AgreementId;
                            lastAgreementStatus = registrationDBModel.Agreements[0].Status;
                            if (customerAgreementModels[customerAgreementModels.Count - 1].Status == "Open")
                            {
                                customerAgreementModels.RemoveAt(customerAgreementModels.Count - 1);
                            }

                            List <CustomerAgreementModel> agreementItemSource = new List <CustomerAgreementModel>();

                            foreach (CustomerAgreementModel camfl in customerAgreementModels)
                            {
                                if (camfl.Status != null)
                                {
                                    if (camfl.Status == "Close" || camfl.Status == "Pending_Payment")
                                    {
                                        camfl.custAgreement.AgreementTotal.totalAmountStr = ((decimal)camfl.custAgreement.AgreementTotal.TotalAmount).ToString("0.00");
                                        if (camfl.Status == "Pending_Payment")
                                        {
                                            camfl.Status = "Pending Payment";
                                        }

                                        agreementItemSource.Add(camfl);
                                    }
                                }
                            }
                            agreementItemSource.Reverse();

                            myRentals.ItemsSource    = agreementItemSource;
                            myRentals.HeightRequest  = agreementItemSource.Count * 400;
                            emptyMyrentals.IsVisible = false;
                            myRentals.IsVisible      = true;
                        }
                        else
                        {
                            emptyMyrentals.IsVisible = true;
                            myRentals.IsVisible      = false;
                        }
                    }

                    else
                    {
                        myRentals.IsVisible = false;
                        // emptyMyrentals.IsVisible = true;
                        // myRentFrame.HeightRequest = 290;
                    }


                    var AllReservationTap = new TapGestureRecognizer();
                    AllReservationTap.Tapped += async(s, e) =>
                    {
                        Constants.IsHome = false;
                        if (Navigation.NavigationStack[Navigation.NavigationStack.Count - 1].GetType() != typeof(UpcomingReservations))
                        {
                            await Navigation.PushAsync(new UpcomingReservations());
                        }
                    };
                    //allReservationLabel.GestureRecognizers.Add(AllReservationTap);

                    var AllmyrentalsTap = new TapGestureRecognizer();
                    AllmyrentalsTap.Tapped += async(s, e) =>
                    {
                        Constants.IsHome = false;
                        if (Navigation.NavigationStack[Navigation.NavigationStack.Count - 1].GetType() != typeof(MyRentals))
                        {
                            await Navigation.PushAsync(new MyRentals());
                        }
                    };
                    //allAgreementLabel.GestureRecognizers.Add(AllmyrentalsTap);
                }
            }
        }