public void Execute(ConfirmDispatchNoteCommand command)
 {
     _log.InfoFormat("Execute {1} - Command Id {0} ", command.CommandId, command.GetType().ToString());
     try
     {
         if (!DocumentExists(command.DocumentId))
         {
             _log.InfoFormat("Failed to  Execute {1} - Command Id {0} ", command.CommandId, command.GetType().ToString());
             return;
         }
         ConfirmDocument(command.DocumentId);
         //DispatchNote dispatchNote = _documentRepository.GetById(command.DocumentId) as DispatchNote;
         //if (dispatchNote.DispatchType == DispatchNoteType.Delivery)
         //{
         //    foreach (var lineItem in dispatchNote.LineItems)
         //    {
         //        //on the server debit issuer cc
         //        _inventoryWorkflow.InventoryAdjust(dispatchNote.DocumentIssuerCostCentre.Id, lineItem.Product.Id,
         //                                           -lineItem.Qty, DocumentType.DispatchNote, dispatchNote.Id,
         //                                           dispatchNote.DocumentDateIssued,InventoryAdjustmentNoteType.Available);
         //        //credit recipient cc
         //        _inventoryWorkflow.InventoryAdjust(dispatchNote.DocumentRecipientCostCentre.Id,
         //                                           lineItem.Product.Id,
         //                                           lineItem.Qty, DocumentType.DispatchNote, dispatchNote.Id,
         //                                           dispatchNote.DocumentDateIssued, InventoryAdjustmentNoteType.Available);
         //    }
         //}
     }
     catch (Exception ex)
     {
         _log.ErrorFormat("Error Execute {1} - Command Id {0} ", command.CommandId, command.GetType());
         _log.Error("ConfirmDispatchNoteCommandHandler exception", ex);
         throw ;
     }
 }
Beispiel #2
0
 public void Execute(ConfirmDispatchNoteCommand command)
 {
     _log.InfoFormat("Execute {1} - Command Id {0} ", command.CommandId, command.GetType().ToString());
     try
     {
         if (!DocumentExists(command.DocumentId))
         {
             _log.InfoFormat("Failed to  Execute {1} - Command Id {0} ", command.CommandId, command.GetType().ToString());
             return;
         }
         ConfirmDocument(command.DocumentId);
         //DispatchNote dispatchNote = _documentRepository.GetById(command.DocumentId) as DispatchNote;
         //if (dispatchNote.DispatchType == DispatchNoteType.Delivery)
         //{
         //    foreach (var lineItem in dispatchNote.LineItems)
         //    {
         //        //on the server debit issuer cc
         //        _inventoryWorkflow.InventoryAdjust(dispatchNote.DocumentIssuerCostCentre.Id, lineItem.Product.Id,
         //                                           -lineItem.Qty, DocumentType.DispatchNote, dispatchNote.Id,
         //                                           dispatchNote.DocumentDateIssued,InventoryAdjustmentNoteType.Available);
         //        //credit recipient cc
         //        _inventoryWorkflow.InventoryAdjust(dispatchNote.DocumentRecipientCostCentre.Id,
         //                                           lineItem.Product.Id,
         //                                           lineItem.Qty, DocumentType.DispatchNote, dispatchNote.Id,
         //                                           dispatchNote.DocumentDateIssued, InventoryAdjustmentNoteType.Available);
         //    }
         //}
     }
     catch (Exception ex)
     {
         _log.ErrorFormat("Error Execute {1} - Command Id {0} ", command.CommandId, command.GetType());
         _log.Error("ConfirmDispatchNoteCommandHandler exception", ex);
         throw;
     }
 }
        List<CommandRouteItem> GetConfirmDispatchNoteCommandRoutes(ConfirmDispatchNoteCommand confirmDispatchNoteCommand)
        {
            List<CommandRouteItem> commandRouteItems = new List<CommandRouteItem>();
            string serializedCommand = JsonConvert.SerializeObject(confirmDispatchNoteCommand);
            List<Guid> ids = GetDestinationIdsFromDispatchNoteId(confirmDispatchNoteCommand.DocumentId);

            Guid[] _destinationIds = RemoveSourceCCAppId(ids.ToArray(), confirmDispatchNoteCommand);

            foreach (Guid id in _destinationIds)
                commandRouteItems.Add(CreateRouteItem(confirmDispatchNoteCommand, "ConfirmDispatchNote", id, serializedCommand));

            return commandRouteItems;

        }