コード例 #1
0
        public override void Withdraw(double amount, Enums.TransactionType transactionType)
        {
            //check to see if there are available funds
            if (amount <= this.Balance)
            {
                base.Withdraw(amount, transactionType);

                //penalty charge for REGULAR customer
                if (this.Owner.Status == Enums.CustomerStatus.REGULAR)
                {
                    base.Withdraw(WithdrawPenaltyAmount, Enums.TransactionType.PENALTY);

                    //change Customer Status
                    if (this.Balance < PremierAmount)
                    {
                        this.Owner.Status = Enums.CustomerStatus.REGULAR;
                    }
                    else
                    {
                        this.Owner.Status = Enums.CustomerStatus.PREMIER;
                    }
                }
            }
            else
            {
                throw new Exception("Withdrawal cancelled: INSUFFICIENT_FUNDS");
            }
        }
コード例 #2
0
        //public virtual double  Deposit(double amount)
        public virtual void Deposit(double amount, Enums.TransactionType transactionType)
        {
            this.Balance += Math.Round(amount, 2);

            Transaction newTransaction = new Transaction(amount, transactionType);

            this.TransactionHistory.Add(newTransaction);
        }
コード例 #3
0
        public void addTransaction(Enums.TransactionType transactionType, DateTime date, double amount)
        {
            String format = "MM/dd/yy";

            this.activity.Add(transactionType);
            this.date.Add(date.ToString(format));
            this.amount.Add(amount);
        }
コード例 #4
0
ファイル: user.cs プロジェクト: kamalkaur0013/C-
        internal void doTransaction(Enums.TransactionType dEPOSIT)
        {
            switch (dEPOSIT)
            {
            case Enums.TransactionType.DEPOSIT:
                int x1 = selectAccount();
                Console.Write("Enter Amount:");
                int dAmount1 = int.Parse(Console.ReadLine());

                if (x1 == 1)
                {
                    checking.deposit(dAmount1);
                }
                else if (x1 == 2)
                {
                    savings.deposit(dAmount1);
                }
                break;

            case Enums.TransactionType.WITHDRAW:
                int x2 = selectAccount();
                Console.Write("Enter Amount:");
                int dAmount2 = int.Parse(Console.ReadLine());

                if (x2 == 1)
                {
                    checking.withraw(dAmount2);
                }
                else if (x2 == 2)
                {
                    savings.withraw(dAmount2);
                }
                break;

            case Enums.TransactionType.TRANSFER:
                Console.Write("1 - From Checking to Saving, 2 - From Saving to Checking):");
                int x3 = int.Parse(Console.ReadLine());
                Console.Write("Enter Amount:");
                int dAmount3 = int.Parse(Console.ReadLine());
                if (x3 == 1)
                {
                    checking.transferOUT(dAmount3, savings);
                }
                else if (x3 == 2)
                {
                    savings.transferOUT(dAmount3, checking);
                }
                break;

            case Enums.TransactionType.IN:
                Console.Write("Current Balance:");
                Console.WriteLine("     Amount         Balance");
                Console.WriteLine("     ------         --------");
                Console.WriteLine("     " + "checking" + "       " + checking.initialBalance);
                Console.WriteLine("     " + "saving" + "          " + savings.initialBalance);
                break;
            }
        }
コード例 #5
0
        public override void Deposit(double amount, Enums.TransactionType transactionType)
        {
            base.Deposit(amount, transactionType);

            //change Customer Status
            if (this.Balance >= SavingsAccount.PremierAmount)
            {
                this.Owner.Status = Enums.CustomerStatus.PREMIER;
            }
        }
コード例 #6
0
        //public void Withdraw(double amount)
        public virtual void Withdraw(double amount, Enums.TransactionType transactionType)
        {
            //check if there is money in the account
            if (this.Balance >= amount)
            {
                this.Balance -= Math.Round(amount, 2);

                Transaction newTransaction = new Transaction(amount, transactionType);
                this.TransactionHistory.Add(newTransaction);
            }
        }
コード例 #7
0
 public override void Withdraw(double amount, Enums.TransactionType transactionType)
 {
     //check to see if there are available funds
     if (amount <= this.Balance)
     {
         //if (Owner.Status == Enums.CustomerStatus.REGULAR && amount > MaxWithdrawAmount)
         if (Owner.Status == Enums.CustomerStatus.REGULAR && amount > MaxWithdrawAmount)
         {
             throw new Exception("Withdrawal cancelled: Exceeds maximum withdrawal limit of $300 for Customers having REGULAR Status.");
         }
         else
         {
             //either Premier Account OR less than MaxWithdrawAmount
             base.Withdraw(amount, transactionType);
         }
     }
     else
     {
         throw new Exception("Withdrawal cancelled: INSUFFICIENT_FUNDS");
     }
 }
コード例 #8
0
 public override void Deposit(double amount, Enums.TransactionType transactionType)
 {
     base.Deposit(amount, transactionType);
 }
コード例 #9
0
 public Transaction(double x, Enums.TransactionType y)
 {
     Amount          = x;
     Type            = y;
     TransactionDate = DateTime.Now;
 }
コード例 #10
0
 //Constructor
 public Transaction(double amount, Enums.TransactionType transactionType)
 {
     this.Amount          = amount;
     this.Type            = transactionType;
     this.TransactionDate = DateTime.Now;
 }