Beispiel #1
0
        public BladeOverviewDto Overview(Guid turbineId, BladePosition position, FindingsDataTableFilterModelDto findingsDataTableFilter)
        {
            FindingsQuery       query       = _mapper.Map <FindingsQuery>(findingsDataTableFilter);
            Blade               blade       = _bladeService.GetBlade(turbineId, position);
            IQueryable <Defect> defects     = _defectApiService.GetDefectsForNode(NodeType.Blade, blade.Id, query);
            BladeOverviewDto    overviewDto = new BladeOverviewDto
            {
                Id    = blade.Id.ToString(),
                Value = $"{blade.Position} - {blade.SerialNumber}"
            };

            AssignNumberOfDefectsPerSeverity(defects, overviewDto);

            return(overviewDto);
        }
Beispiel #2
0
        public BladeOverviewDto GetSurfaceOverview(Guid bladeId, Surface surface)
        {
            var blade   = _bladeService.GetBlade(bladeId);
            var defects = _defectApiService.GetDefectsForNode(bladeId, NodeType.Blade).Where(x => x.Surface == surface);

            // TODO Let AutoMapper do mapping for you. Create BladeOverviewDtoProfile with mappings
            var overviewDto = new BladeOverviewDto
            {
                Id    = blade.Id.ToString(),
                Value = blade.SerialNumber
            };

            AssignNumberOfDefectsPerSeverity(defects, overviewDto);

            return(overviewDto);
        }
Beispiel #3
0
 private static void AssignNumberOfDefectsPerSeverity(IEnumerable <HermesOnline.Domain.Defect> defects, BladeOverviewDto overviewDto)
 {
     overviewDto.SeverityDefects[Severity.Zero] =
         defects.Count(x => x.Severity == Severity.Zero);
     overviewDto.SeverityDefects[Severity.One] =
         defects.Count(x => x.Severity == Severity.One);
     overviewDto.SeverityDefects[Severity.Two] =
         defects.Count(x => x.Severity == Severity.Two);
     overviewDto.SeverityDefects[Severity.Three] =
         defects.Count(x => x.Severity == Severity.Three);
     overviewDto.SeverityDefects[Severity.Four] =
         defects.Count(x => x.Severity == Severity.Four);
     overviewDto.SeverityDefects[Severity.Five] =
         defects.Count(x => x.Severity == Severity.Five);
 }