private static void FillContentFromModel( this WaybillDto parentDto, WaybillContent model, WaybillId waybillId) { if (model == null) { parentDto.Content = null; return; } if (parentDto.Content == null) { parentDto.Content = new WaybillContentDto(); } var dto = parentDto.Content; dto.SupplierWaybillId = waybillId.Value; dto.DocumentNumber = model.Header.DocumentNumber; dto.DocumentDate = model.Header.DocumentDate; dto.Consignee = model.Header.Consignee; dto.Items = model.Items .Select((item, i) => item.MapToDto(waybillId: waybillId, sequenceNumber: i + 1)) .ToList(); dto.TotalVat = model.Totals.TotalVatSum; dto.TotalSumWithVat = model.Totals.TotalSumWithVat; dto.TotalSumWithoutVat = model.Totals.TotalSumWithoutVat; }
/// <summary>Ctor for mapping from DB exclusively.</summary> protected Waybill( WaybillId id, OrderId orderId, WaybillContent content) { Id = id; OrderId = orderId; Content = content; }
public PaperWaybill( WaybillId id, CephFileId sourceFileId, OrderId orderId, WaybillContent content, WaybillContentStructuralValidationResult structuralValidationResult, WaybillInteractionState interactionState) : base( id, orderId, content) { SourceFileId = sourceFileId; StructuralValidationResult = structuralValidationResult; InteractionState = interactionState; }
public Task <WaybillContent> Parse(Stream waybillFileStream) { var header = new WaybillHeader( documentDate: new DateTime(2019, 06, 28), documentNumber: "1", consignee: "ООО ВЕКТОР" ); var totals = new WaybillTotals( totalSumWithoutVat: 80508.47m, totalVatSum: 14491.53m, totalSumWithVat: 95000m ); var content = new WaybillContent( header, new[] { CreateItem() }, totals ); return(Task.FromResult(content)); }
public void SetContent(WaybillContent content) { ThrowIfSetMemberWhileNotInState(WaybillProcessingState.Imported); Content = content; }