Exemplo n.º 1
0
 public SingleTransactionEvent(string id, SingleTransactionType transactionType, string storageId, string itemName, int itemCount)
     : base(id, storageId)
 {
     ItemName        = itemName;
     ItemCount       = itemCount;
     TransactionType = transactionType;
 }
        public SingleTransaction(string storageId, SingleTransactionType type, Item item)
        {
            if (string.IsNullOrEmpty(storageId) || item == null)
            {
                throw new ArgumentException();
            }

            Type      = type;
            StorageId = storageId;
            Item      = item;
        }
 public SingleTransactionCommand(
     IStorageStore storageStore,
     IEventStore eventStore,
     ITransactionValidationService transactionValidationService,
     SingleTransactionType type,
     SingleTransactionData data)
 {
     this.storageStore = storageStore;
     this.eventStore   = eventStore;
     this.transactionValidationService = transactionValidationService;
     this.transaction      = CreateTransaction(type, data);
     this.transactionEvent = CreateEvent(type, data);
 }
 private Event CreateEvent(SingleTransactionType type, SingleTransactionData data)
 {
     return(new SingleTransactionEvent(Guid.NewGuid().ToBase64String(), type, data.StorageId, data.ItemName, data.ItemCount.Value));
 }
        private SingleTransaction CreateTransaction(SingleTransactionType type, SingleTransactionData data)
        {
            var item = new Item(data.ItemName, data.ItemCount.Value);

            return(new SingleTransaction(data.StorageId, type, item));
        }
Exemplo n.º 6
0
 public ICommand GetSingleTransactionCommand(SingleTransactionType type, SingleTransactionData data)
 {
     return(new SingleTransactionCommand(storageStore, eventStore, transactionValidationService, type, data));
 }