예제 #1
0
        public override bool Execute(Stregsystem CS)
        {
            TransactionsList transactionList = new TransactionsList(CS);
            UsersList        usersList       = new UsersList();

            User.Balance = User.Balance + Amount * 100;
            Date         = DateTime.Now;

            if (transactionList.AddCashTransaction(this))
            {
                if (usersList.UpdateUser(User))
                {
                    return(true);
                }
                return(false);
            }
            return(false);
        }
예제 #2
0
        //Algorithm for Execute, just that it filled to much - seems unreadable
        private bool SaveTransaction(BuyTransaction transaction, Stregsystem CS)
        {
            TransactionsList transactionList = new TransactionsList(CS);
            UsersList        usersList       = new UsersList();

            User.Balance = User.Balance - Product.Price;
            Price        = Product.Price;
            Date         = DateTime.Now;

            if (transactionList.AddBuyTransaction(transaction))
            {
                if (usersList.UpdateUser(User))
                {
                    return(true);
                }
                return(false);
            }
            return(false);
        }