public void SubmitDelivery(DeliveryCo.Business.Entities.DeliveryInfo pDeliveryInfo) { using(TransactionScope lScope = new TransactionScope()) using(DeliveryDataModelContainer lContainer = new DeliveryDataModelContainer()) { //pDeliveryInfo.DeliveryIdentifier = Guid.NewGuid(); pDeliveryInfo.Status = 0; lContainer.DeliveryInfoes.AddObject(pDeliveryInfo); lContainer.SaveChanges(); ThreadPool.QueueUserWorkItem(new WaitCallback((pObj) => ScheduleDelivery(pDeliveryInfo))); lScope.Complete(); } //return pDeliveryInfo.DeliveryIdentifier; }
private DeliveryStatus GetDeliveryStatusFromDeliveryCoDeliveryStatus(DeliveryCo.Business.Entities.DeliveryStatus pStatus) { if (pStatus == DeliveryCo.Business.Entities.DeliveryStatus.Delivered) { return DeliveryStatus.Delivered; } else if (pStatus == DeliveryCo.Business.Entities.DeliveryStatus.Failed) { return DeliveryStatus.Failed; } else if (pStatus == DeliveryCo.Business.Entities.DeliveryStatus.Submitted) { return DeliveryStatus.Submitted; } else { throw new Exception("Unexpected delivery pStatus received"); } }
public void NotifyDeliveryCompletion(Guid pDeliveryId, DeliveryCo.Business.Entities.DeliveryStatus pStatus) { Provider.NotifyDeliveryCompletion(pDeliveryId, GetDeliveryStatusFromDeliveryCoDeliveryStatus(pStatus)); }
//[OperationBehavior(TransactionScopeRequired = true)] public void SubmitDelivery(DeliveryCo.Business.Entities.DeliveryInfo pDeliveryInfo) { DeliveryProvider.SubmitDelivery(pDeliveryInfo); }