public void Execute(CreateDispatchNoteCommand command)
        {
            _log.InfoFormat("Execute {1} - Command Id {0} ", command.CommandId, command.GetType().ToString());

            try
            {
                if (DocumentExists(command.DocumentId))
                    return;

                tblDocument doc = NewDocument(command, DocumentType.DispatchNote, command.DispatchNoteRecipientCostCentreId);
                doc.OrderOrderTypeId = command.DispatchNoteType;
                doc.InvoiceOrderId = command.OrderId;

                _cokeDataContext.tblDocument.AddObject(doc);
                _cokeDataContext.SaveChanges();
            }
            catch (Exception ex)
            {
                _log.ErrorFormat("Error Execute {1} - Command Id {0} ", command.CommandId, command.GetType().ToString());
                _log.Error("CreateDispatchNoteCommandHandler exception",ex);
                throw;
            }
        }
        //DN
        List<CommandRouteItem> GetCreateDispatchNoteCommandRoutes(CreateDispatchNoteCommand createDispatchNoteCommand)
        {
            List<CommandRouteItem> commandRouteItems = new List<CommandRouteItem>();
            string serializedCommand = JsonConvert.SerializeObject(createDispatchNoteCommand);

            List<Guid> destinationIds = GetDestinationApplicationIdsForCostCentres(createDispatchNoteCommand.DocumentIssuerCostCentreId, createDispatchNoteCommand.DocumentIssuerCostCentreId);

            Guid[] _destinationIds = RemoveSourceCCAppId(destinationIds.ToArray(), createDispatchNoteCommand);

            foreach (Guid appId in _destinationIds)
                commandRouteItems.Add(CreateRouteItem(createDispatchNoteCommand, "CreateDispatchNote", appId, serializedCommand));

            return commandRouteItems;
        }
 public void Handle(CreateDispatchNoteCommand command)
 {
     currentDispatchNoteType = command.DispatchNoteType;
 }