Beispiel #1
0
        public async Task syncData()
        {
            Cars = new ObservableCollection <ExternalEntityDto>(await _initialDataService.GetCars());

            Colors = new ObservableCollection <ExternalEntityDto>(await _initialDataService.GetColors());

            Insurers = new ObservableCollection <InsurersItemSource>(await _initialDataService.GetInsurers());

            Alphabets = new ObservableCollection <ExternalEntityDto>(await _initialDataService.GetAlphabets());
        }
Beispiel #2
0
        public async Task syncInitialData()
        {
            await _initialDataService.GetSalesPhotos();

            await _initialDataService.GetBadanePhotos();

            await _initialDataService.GetCars();

            await _initialDataService.GetColors();

            await _initialDataService.GetCurrentUserInfo();

            await _initialDataService.GetInsurers();

            await _initialDataService.GetAlphabets();

            await _initialDataService.GetAccidentReasons();
        }
Beispiel #3
0
        public async Task <List <PolicyItemSource> > ConvertPolicyToItemSource(IEnumerable <InsurancePolicyDto> insurances)
        {
            List <ExternalEntityDto>  cars             = new List <ExternalEntityDto>();
            List <ExternalEntityDto>  colors           = new List <ExternalEntityDto>();
            List <InsurersItemSource> insureres        = new List <InsurersItemSource>();
            List <PolicyItemSource>   policyItemSource = new List <PolicyItemSource>();

            Guid customerId = (await _initialDataService.GetCurrentUserInfo()).Id;

            cars = (await _initialDataService.GetCars()).ToList();

            colors = (await _initialDataService.GetColors()).ToList();

            insureres = (await _initialDataService.GetInsurers()).ToList();

            foreach (InsurancePolicyDto insurance in insurances)
            {
                PolicyItemSource policy = new PolicyItemSource
                {
                    CarId          = insurance.CarId,
                    InsuranceType  = insurance.InsuranceType,
                    ChasisNo       = insurance.ChasisNo,
                    ColorId        = insurance.ColorId,
                    Id             = insurance.Id,
                    InsurerNo      = insurance.InsurerNo,
                    InsurerId      = insurance.InsurerId,
                    PlateNumber    = insurance.PlateNumber,
                    VIN            = insurance.VIN,
                    ExpirationDate = insurance.ExpirationDate,
                    ColorName      = colors.FirstOrDefault(c => c.PrmID == insurance.ColorId)?.Name,
                    CarName        = cars.FirstOrDefault(c => c.PrmID == insurance.CarId)?.Name,
                    Image          = insureres.FirstOrDefault(c => c.ID == insurance.InsurerId)?.Photo,
                    IsExpired      = insurance.ExpirationDate <= DateTimeOffset.Now.AddMonths(1)
                };

                policy.LicensePlateItemSource = _licenseHelper.ConvertToItemSource(policy.PlateNumber);

                policyItemSource.Add(policy);
            }

            return(policyItemSource);
        }