public void RegisterCashboxOperation( CashboxOperation operation ) { if ( operation == null ) throw new ArgumentNullException( "operation" ); BusinessRulesManager.Assert( "RegisterCashboxOperation", operation ); Cashbox cashbox = operation.Cashbox.GetVanillaEntity(); cashbox.Balance += operation.Amount; StorageContext.Current.Insert( operation ); StorageContext.Current.Update( cashbox ); }
public void AcceptCustomerPayment( EntityRef<Customer> customer, decimal amount ) { CustomerAccountLine accountLine = new CustomerAccountLine { Amount = amount, Customer = customer, Date = DateTime.Now, Description = "Customer Payment", Employee = this.Session.Employee }; this.AddCustomerAccountLine( accountLine ); CashboxOperation cashboxOperation = new CashboxOperation { Amount = amount, Cashbox = this.Session.Cashbox, Date = DateTime.Now, Description = string.Format( "Customer Payment: {0} ({1} {2})", customer.Entity.CustomerId, customer.Entity.FirstName, customer.Entity.LastName ), Employee = this.Session.Employee }; this.cashboxProcesses.RegisterCashboxOperation( cashboxOperation ); }