예제 #1
0
        private async Task <List <InspectionDataCarriageDto> > GetInspectionCounters(int inspectionId)
        {
            var sqlR = new InspectionDataRepository(_logger);

            var countersFromSql = await sqlR.GetByInspectionId(inspectionId);

            var result = countersFromSql
                         .Where(x => x.Type == InspectionDataType.KwHours)
                         .Select(x =>
                                 new InspectionDataCarriageDto
            {
                CarriageName = "Вагон " + x.Carriage.Serial,
                Value        = x.Value
            }).ToList();

            return(result);
        }
예제 #2
0
        private async Task GetInspectionCouters(InspectionDataRepository inspdatarep, Inspection fromSqlsInspection, JournalInspection journalInspection)
        {
            var countersFromSql = await inspdatarep.GetByInspectionId(fromSqlsInspection.Id);

            if (countersFromSql.Any())
            {
                journalInspection.Tabs.Description.KmPerShift = String.Join(", ",
                                                                            countersFromSql.Where(o => o.Type == InspectionDataType.KmPerShift)
                                                                            .Select(o => o.Value));
                journalInspection.Tabs.Description.KmTotal = String.Join(", ",
                                                                         countersFromSql.Where(o => o.Type == InspectionDataType.KmTotal)
                                                                         .Select(o => o.Value));
                journalInspection.Tabs.Description.KwHours = String.Join(", ",
                                                                         countersFromSql.Where(o => o.Type == InspectionDataType.KwHours)
                                                                         .Select(o => _GetCarriageNumCanBeNull(o.Carriage) + ":" + o.Value));
                var brakeShoes = String.Join(", ",
                                             countersFromSql.Where(o => o.Type == InspectionDataType.BrakeShoes)
                                             .Select(o => o.Text));
                journalInspection.Tabs.BrakeShoesSerial = brakeShoes;
            }
        }
예제 #3
0
        private async Task <List <InspectionDataDto> > GetInspectionOtherData(int inspectionId)
        {
            var sqlR = new InspectionDataRepository(_logger);

            var countersFromSql = await sqlR.GetByInspectionId(inspectionId);

            var result = countersFromSql
                         .Where(q => q.Type == InspectionDataType.KmPerShift)
                         .Select(x =>
                                 new InspectionDataDto
            {
                Type  = x.Type.GetDescription(),
                Value = x.Value.ToString()
            }).ToList();

            result.AddRange(
                countersFromSql
                .Where(q => q.Type == InspectionDataType.KmTotal)
                .Select(x =>
                        new InspectionDataDto
            {
                Type  = x.Type.GetDescription(),
                Value = x.Value.ToString()
            }).ToList()
                );
            result.AddRange(
                countersFromSql
                .Where(q => q.Type == InspectionDataType.BrakeShoes)
                .Select(x =>
                        new InspectionDataDto
            {
                Type  = x.Type.GetDescription(),
                Value = string.Join(", ", countersFromSql
                                    .Where(o => o.Type == InspectionDataType.BrakeShoes)
                                    .Select(o => o.Text))
            }).ToList()
                );

            return(result);
        }