예제 #1
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);
        }
예제 #2
0
        public GetVehicleDetailsMobileListResponse getVehicleTypesMobile(string token)
        {
            GetVehicleDetailsMobileListResponse result = null;

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

                    HttpContent httpContent = new StringContent(JsonConvert.SerializeObject(null), Encoding.UTF8);
                    httpContent.Headers.ContentType = new MediaTypeHeaderValue("application/json");



                    var response = client.PostAsync(client.BaseAddress, httpContent).Result;
                    if (response.IsSuccessStatusCode)
                    {
                        var responseStream = response.Content.ReadAsStringAsync().Result;
                        result = JsonConvert.DeserializeObject <GetVehicleDetailsMobileListResponse>(responseStream);
                    }
                }
            }

            catch (Exception ex)
            {
                throw ex;
            }
            return(result);
        }
예제 #3
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);
        }
        public GetVehicleDetailsMobileListResponse getVehicleTypesMobile(string token)
        {
            GetVehicleDetailsMobileListResponse vehicleTypeResults = null;

            try
            {
                vehicleTypeResults = vehicleService.getVehicleTypesMobile(token);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(vehicleTypeResults);
        }
예제 #5
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;
 }