public static WaybillContentStructuralValidationResult MapToModel(
            this WaybillValidationResultDto waybillDto)
        {
            var headerResult = new WaybillHeaderValidationResult(
                hasConsigneeError: waybillDto.HasConsigneeError,
                hasDocumentDateError: waybillDto.HasDocumentDateError,
                hasDocumentNumberError: waybillDto.HasDocumentNumberError);

            var totalsResult = new WaybillTotalsValidationResult(
                hasEmptySumWithoutVat: waybillDto.HasEmptySumWithoutVat,
                hasEmptySumWithVat: waybillDto.HasEmptySumWithVat,
                hasEmptyTotalVatSum: waybillDto.HasEmptyTotalVatSum,
                hasInvalidTotalVatSum: waybillDto.HasInvalidTotalVatSum,
                hasInvalidSumWithVat: waybillDto.HasInvalidSumWithVat,
                hasInvalidSumWithoutVat: waybillDto.HasInvalidSumWithoutVat);

            var items = waybillDto.ItemValidationResults
                        .Select(MapToModel)
                        .ToArray();

            return(new WaybillContentStructuralValidationResult(
                       headerResult: headerResult,
                       itemResults: items,
                       totalsResult: totalsResult));
        }
Пример #2
0
 public WaybillContentStructuralValidationResult(
     WaybillHeaderValidationResult headerResult,
     IReadOnlyList <WaybillItemValidationResult> itemResults,
     WaybillTotalsValidationResult totalsResult)
 {
     HeaderResult = headerResult
                    ?? throw new ArgumentNullException(nameof(headerResult));
     ItemResults = itemResults
                   ?? throw new ArgumentNullException(nameof(itemResults));
     TotalsResult = totalsResult
                    ?? throw new ArgumentNullException(nameof(totalsResult));
 }