コード例 #1
0
        public string WithdrawTransaction(Customer customer)
        {
            string accountNo    = customer.AccNo;
            bool   isAccNoExist = CheckAccNo(accountNo);

            if (isAccNoExist)
            {
                Customer aCustomer = gateway.GetExistAccount(customer);
                double   balance   = aCustomer.Balance;

                if (customer.Balance <= balance)
                {
                    var rowAffected = gateway.UpdateWithdraw(customer);

                    if (rowAffected > 0)
                    {
                        return("Withdraw Successfully!");
                    }
                    else
                    {
                        return("Withdraw Failed!");
                    }
                }
                else
                {
                    return("Insufficient Balance");
                }
            }
            else
            {
                return("This Account doesn't exist!");
            }
        }