public static List<ExportOrderItem> MapExport(FclExportOrderDto dto) { var items = new List<ExportOrderItem>(); if (dto != null) { items.AddRange(dto.LineItems.Select(orderDto => new ExportOrderItem() { OrderReference = HandleOrderRef(dto.GenericOrderReference,dto.ExternalOrderReference), OrderDate = dto.OrderDate, SalesmanCode = dto.SalesmanCode, OutletCode = dto.OutletCode, ShiptoAddressCode = dto.ShiptoAddressCode, ProductCode = orderDto.ProductCode, ApprovableQuantity = orderDto.ApprovableQuantity })); } return items; }
public static void MarkAsExported(FclExportOrderDto n) { var exportedItem = new ExportImportAudit() { IntegrationModule = IntegrationModule.FCL, AuditStatus = DocumentAuditStatus.Exported, DocumentReference = n.GenericOrderReference, ExternalDocumentRef = n.ExternalOrderReference, DocumentType = DocumentType.Order, DateUploaded = DateTime.Now, DocumentId = Guid.NewGuid() }; ObjectFactory.GetInstance<IExportImportAuditRepository>().Save(exportedItem); }
private FclExportOrderDto MapFCLDTO(tblDocument document,string append) { if(document !=null) { var dto = new FclExportOrderDto() { OrderDate = document.DocumentDateIssued.ToString("dd-MM-yyyy"), ExternalOrderReference = GetOrderReference(document,append), GenericOrderReference = document.DocumentReference, OutletCode =HandleOutlet(document), SalesmanCode =HandleSalesmanCode(document), ShiptoAddressCode =HandleShipTo(document) }; foreach (var lineItem in document.tblLineItems) { if (lineItem.ProductID != null && lineItem.ProductID != Guid.Empty) { var product = _ctx.tblProduct.FirstOrDefault(p => p.id == lineItem.ProductID); if (product != null) { var item = new FclExportOrderLineItem() { ProductCode = product.ProductCode, ApprovableQuantity = (lineItem.Quantity != null) ? lineItem.Quantity.Value : 0, }; dto.LineItems.Add(item); } } } return dto; } return null; }