Exemplo n.º 1
0
        /// <summary>
        /// Associate an incoming invoice to the current Job Order
        /// </summary>
        /// <param name="eventStore">The event store</param>
        /// <param name="invoiceId">The Id of the Invoice to be associated to the current Job Order</param>
        /// <exception cref="InvalidOperationException">Thrown if the specified invoiceId refers to an invoice which has already been associated to a Job Order</exception>
        public void AssociateIncomingInvoice(IEventStore eventStore, Guid invoiceId)
        {
            var count = eventStore.Find <IncomingInvoiceAssociatedToJobOrderEvent>(e => e.InvoiceId == invoiceId).Count();

            if (count > 0)
            {
                throw new InvalidOperationException("The specified invoice is already associated to a Job Order.");
            }
            var @event = new IncomingInvoiceAssociatedToJobOrderEvent(invoiceId, this.Id);

            RaiseEvent(@event);
        }
Exemplo n.º 2
0
 public void Apply(IncomingInvoiceAssociatedToJobOrderEvent evt)
 {
 }