private IEnumerable <SafetyProfile> CreateSafetyProfiles()
        {
            _safetyProfile = _fixture.Create <SafetyProfile>();

            _safetyProfile.IsTrailerProfile = true;
            _safetyProfile.IntLink          = _trailer.SafetyCheckProfileIntLink;

            List <SafetyProfile> profiles = new List <SafetyProfile>()
            {
                _safetyProfile
            };

            return(profiles);
        }
Beispiel #2
0
        protected async Task <SafetyCheckData> GenerateSafetyCheckDataAsync(SafetyProfile safetyProfile, Guid driverID, Guid vehicleOrTrailerID, string vehicleOrTrailerRegistration, bool isTrailer)
        {
            var faults = safetyProfile.Children
                         .OrderBy(scft => scft.Order)
                         .Select(scft => new Models.SafetyCheckFault
            {
                SafetyCheckDataID       = safetyProfile.ID,
                Title                   = scft.Title,
                FaultTypeID             = scft.ID,
                IsDiscretionaryQuestion = scft.IsDiscretionaryQuestion,
            })
                         .ToList();

            var driver = await _repositories.DriverRepository.GetByIDAsync(driverID);

            // Set up the safety check data to be set in the startup service.
            // This is the result of the safety check which will be sent to bluesphere
            // and persisted locally in case the safety check needs to be shown by the driver.
            var safetyCheckData = new SafetyCheckData
            {
                ProfileIntLink      = safetyProfile.IntLink,
                DriverID            = driverID,
                DriverTitle         = driver.Title,
                VehicleID           = vehicleOrTrailerID,
                VehicleRegistration = vehicleOrTrailerRegistration,
                Faults    = faults,
                IsTrailer = isTrailer
            };

            // Add the safety check item view models
            foreach (var fault in faults)
            {
                this.SafetyCheckItemViewModels.Add(new SafetyCheckItemViewModel(this, _navigationService)
                {
                    ID = fault.ID,
                    SafetyCheckFault        = fault,
                    IsVehicle               = !isTrailer,
                    Title                   = (isTrailer ? "TRL: " : "VEH: ") + fault.Title,
                    IsDiscretionaryQuestion = fault.IsDiscretionaryQuestion,
                    CheckStatus             = fault.Status,
                });
            }

            RaisePropertyChanged(() => this.SafetyCheckItemViewModels);

            return(safetyCheckData);
        }
        private IEnumerable <SafetyProfile> CreateSafetyProfiles()
        {
            _trailerSafetyProfile = _fixture.Create <SafetyProfile>();
            _trailerSafetyProfile.IsTrailerProfile = true;
            _trailerSafetyProfile.IntLink          = _trailer.SafetyCheckProfileIntLink;

            _vehicleSafetyProfile = _fixture.Create <SafetyProfile>();
            _vehicleSafetyProfile.IsTrailerProfile = false;
            _vehicleSafetyProfile.IntLink          = _vehicle.SafetyCheckProfileIntLink;

            var profiles = new List <SafetyProfile>()
            {
                _trailerSafetyProfile, _vehicleSafetyProfile
            };

            return(profiles);
        }