Пример #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 GetAgreementByAgreementIdMobileResponse getAgreement(GetAgreementByAgreementIdMobileRequest agreementByAgreementIdMobileRequest, string token, int vehicleId)
        {
            GetAgreementByAgreementIdMobileResponse response = null;
            GetVehicleDetailsMobileListResponse     getVehicleDetailsMobile = null;
            VehicleService vehicleService = new VehicleService();
            int            vehicleTypeID  = 0;
            int            vehicleID      = vehicleId;

            try
            {
                response = agreementService.getAgreement(agreementByAgreementIdMobileRequest, token);
                getVehicleDetailsMobile = vehicleService.getVehicleTypesMobile(token);

                foreach (VehicleTypeMobileResult vtmr in getVehicleDetailsMobile.listVehicle)
                {
                    if (vtmr.VehicleType == response.custAgreement.AgreementDetail.VehicleType)
                    {
                        vehicleTypeID = vtmr.VehicleTypeId;
                    }
                }
                if (vehicleId > 0 && vehicleTypeID > 0)
                {
                    response.agreementVehicle = vehicleService.Getvehicle(vehicleTypeID, vehicleId, token);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(response);
        }
Пример #3
0
        public GetAgreementByAgreementIdMobileResponse getAgreement(GetAgreementByAgreementIdMobileRequest agreementByAgreementIdMobileRequest, string token)
        {
            GetAgreementByAgreementIdMobileResponse result = null;

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

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

            catch (Exception ex)
            {
                throw ex;
            }
            return(result);
        }
Пример #4
0
        public List <CustomerAgreementModel> getAgreements(int customerId, string token)
        {
            List <CustomerAgreementModel> agreementModels = null;

            try
            {
                agreementModels = registerservice.getAgreements(customerId, token);


                if (agreementModels != null)
                {
                    if (agreementModels.Count > 0)
                    {
                        GetVehicleDetailsMobileListResponse getVehicleDetailsMobile = null;
                        VehicleService vehicleService = new VehicleService();
                        getVehicleDetailsMobile = vehicleService.getVehicleTypesMobile(token);
                        AgreementService agreementService = new AgreementService();
                        foreach (CustomerAgreementModel cam in agreementModels)
                        {
                            if (cam.Status != null)
                            {
                                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(agreementModels);
        }
Пример #5
0
        private GetAgreementByAgreementIdMobileResponse getAgreement(GetAgreementByAgreementIdMobileRequest agreementByAgreementIdMobileRequest, string token)
        {
            AgreementController agreementController          = new AgreementController();
            GetAgreementByAgreementIdMobileResponse response = null;

            try
            {
                response = agreementController.getAgreement(agreementByAgreementIdMobileRequest, token, 0);
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(response);
        }
Пример #6
0
 public ViewMyRental(int agreementId)
 {
     InitializeComponent();
     this.agreementId = agreementId;
     token            = App.Current.Properties["currentToken"].ToString();
     AgreementByAgreementIdMobileRequest             = new GetAgreementByAgreementIdMobileRequest();
     AgreementByAgreementIdMobileRequest.agreementId = agreementId;
     AgreementByAgreementIdMobileResponse            = null;
     signMobileResponse                      = null;
     signMobileRequest                       = new AddAgreementSignMobileRequest();
     imageURLMobileRequest                   = new ReloadSignatureImageURLMobileRequest();
     imageURLMobileRequest.agreementId       = agreementId;
     imageURLMobileRequest.IsCheckIn         = false;
     imageURLMobileRequest.isDamageView      = false;
     imageURLMobileResponse                  = null;
     imageURLMobileRequest.SignatureImageUrl = "";
 }
Пример #7
0
        private GetAgreementByAgreementIdMobileResponse getAgreement(GetAgreementByAgreementIdMobileRequest agreementByAgreementIdMobileRequest, string token, int vehicleId)
        {
            AgreementController agreementController          = new AgreementController();
            GetAgreementByAgreementIdMobileResponse response = null;

            try
            {
                response = agreementController.getAgreement(agreementByAgreementIdMobileRequest, token, vehicleId);
                //getVehicleDetailsMobile = vehicleController.getVehicleTypesMobile(token);
                //foreach(VehicleTypeMobileResult vtmr in getVehicleDetailsMobile.listVehicle)
                //{
                //    if(vtmr.ve)
                //}
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(response);
        }
Пример #8
0
 public AgreementScreen(int agreementId, int vehicleId)
 {
     InitializeComponent();
     On <Xamarin.Forms.PlatformConfiguration.iOS>().SetUseSafeArea(true);
     this.agreementId = agreementId;
     token            = App.Current.Properties["currentToken"].ToString();
     AgreementByAgreementIdMobileRequest             = new GetAgreementByAgreementIdMobileRequest();
     AgreementByAgreementIdMobileRequest.agreementId = agreementId;
     AgreementByAgreementIdMobileResponse            = null;
     signMobileResponse                      = null;
     signMobileRequest                       = new AddAgreementSignMobileRequest();
     imageURLMobileRequest                   = new ReloadSignatureImageURLMobileRequest();
     imageURLMobileRequest.agreementId       = agreementId;
     imageURLMobileRequest.IsCheckIn         = false;
     imageURLMobileRequest.isDamageView      = false;
     imageURLMobileResponse                  = null;
     imageURLMobileRequest.SignatureImageUrl = "";
     this.vehicleId          = vehicleId;
     vehicleController       = new VehicleController();
     getVehicleDetailsMobile = null;
 }
Пример #9
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"];
        }