public static void Initialize(this CommandEnvelope envelope, SourcingDocument document) { envelope. Id = Guid.NewGuid(); envelope.EnvelopeGeneratedTick = DateTime.Now.Ticks; envelope.GeneratedByCostCentreId = document.DocumentIssuerCostCentre.Id; envelope.RecipientCostCentreId = document.DocumentRecipientCostCentre.Id; envelope.DocumentTypeId = (int)document.DocumentType; envelope.GeneratedByCostCentreApplicationId = document.DocumentIssuerCostCentreApplicationId; envelope.ParentDocumentId = document.DocumentParentId; envelope.DocumentId = document.Id; }
public override void Save(SourcingDocument documentEntity) { throw new Exception("Use ICommodityDeliveryWFManager to submit"); }
private AgriDocumentListItem Map(SourcingDocument doc) { AgriDocumentListItem item = new AgriDocumentListItem { DocumentId = doc.Id, DocumentReference = doc.DocumentReference, DocumentDateIssued = doc.DocumentDateIssued, Clerk = doc.DocumentIssuerUser.Username, DocumentType = SplitByCaps(doc.DocumentType.ToString()), DocumentRecipentCC = doc.DocumentRecipientCostCentre.Name, }; if (doc is CommodityReceptionNote) { var receptionNote = doc as CommodityReceptionNote; item.TotalWeight = receptionNote.TotalNetWeight; item.NumberOfContainers = receptionNote.LineItems.Count; CommodityPurchaseNote parent = GetEntityById(typeof (CommodityPurchaseNote), doc.DocumentParentId) as CommodityPurchaseNote; if (parent != null) { item.CommodityOwner = parent.CommodityOwner.FullName; item.CommodityProducer = parent.CommodityProducer.Name; item.DeliveredBy = parent.DeliveredBy; } } else if (doc is CommodityStorageNote) { var storageNote = doc as CommodityStorageNote; item.TotalWeight = storageNote.TotalNetWeight; item.NumberOfContainers = storageNote.LineItems.Count; } return item; }