示例#1
0
 internal void deposit(Account a, decimal x, int method)
 {
     if (method == 1)
     {
         a.newActivity(new Activity(DateTime.Now, Type.DEPOSIT, x));
     }
 }
示例#2
0
        internal void withdraw(Account a, decimal x)
        {
            var verification = new VerifyMoney(a, x);

            if (verification.Approval)
            {
                a.newActivity(new Activity(DateTime.Now, Type.WITHDRAWAL, x));

                if (verification.Overdrawn)
                {
                    var activity = new Activity(DateTime.Now, Type.FEE, bankResources.getOverdraftFee());
                    activity.Description = "Overdraft Fee";
                    a.newActivity(activity);
                    //a.newRecord(new OverdraftRecord(a));
                }
            }
            else
            {
                /* DECLINE */
                a.newActivity(new Activity(DateTime.Now, Type.DECLINE, x));
            }
        }
示例#3
0
 internal void transferFunds(Account from, Account to, decimal x)
 {
     from.newActivity(new Activity(DateTime.Now, Type.TRANSFER, x));
     to.newActivity(new Activity(DateTime.Now, Type.TRANSFER_RECEIVE, x));
 }
示例#4
0
 internal void creditAccount(Account a, decimal x)
 {
     a.newActivity(new Activity(DateTime.Now, Type.CREDIT, x));
 }
示例#5
0
            internal void start()
            {
                List <string[]> lineCollection = new List <string[]>();

                holderCollection = new List <Holder>();
                string[] filePaths = Directory.GetFiles(directory, "*.txt");

                /* Get file information from directory to array */
                foreach (string file in filePaths)
                {
                    string[] newFile = File.ReadAllLines(file);
                    lineCollection.Add(newFile);
                }

                /* Get all customer information from each file */
                foreach (string[] l in lineCollection)
                {
                    Holder holder = new Holder();
                    holder.setID(long.Parse(l[0]));
                    holder.setPersonDetails(l[1], l[2], l[3], l[4]);
                    holder.setAddress(l[5], l[6], l[7], l[8], l[9]);

                    for (int i = 11; i < l.Length; i++)
                    {
                        var      acct_num            = l[i];
                        string[] accountInfoFromFile = File.ReadAllLines(account_directory + acct_num + "acct_file.txt");

                        /* Get file and open */
                        if (int.Parse(accountInfoFromFile[1]) == 1)
                        {
                            account = new Checking();
                        }
                        if (int.Parse(accountInfoFromFile[1]) == 2)
                        {
                            account = new Savings();
                        }
                        if (int.Parse(accountInfoFromFile[0]) == 0)
                        {
                            account.closeAccount(true);
                        }
                        if (int.Parse(accountInfoFromFile[0]) == 1)
                        {
                            account.closeAccount(false);
                        }

                        account.setAccountNumber(long.Parse(accountInfoFromFile[2]));
                        string[] openDate = accountInfoFromFile[3].Split(',');
                        account.setOpenDate(new DateTime(int.Parse(openDate[0]), int.Parse(openDate[1]), int.Parse(openDate[2])));

                        for (int z = 6; z < accountInfoFromFile.Length; z++)
                        {
                            string[] activityLine = accountInfoFromFile[z].Split(',');
                            var      activity     = new Activity(new DateTime(int.Parse(activityLine[0]), int.Parse(activityLine[1]), int.Parse(activityLine[2])), (Type)Enum.Parse(typeof(Type), activityLine[3].ToUpper()), decimal.Parse(activityLine[4]));
                            activity.adjustActivity(Boolean.Parse(activityLine[5]));
                            account.newActivity(activity);
                        }
                        account.addNewAccountHolder(holder);
                        holder.addNewAccount(account);
                    }
                    holderCollection.Add(holder);
                }
            }