Example #1
0
        public Customer_BO Withdraw(int accountNo, int amount)
        {
            bool found = false;

            //load data from file and put in records list
            record = bDAL.load();
            Customer_BO cbo = new Customer_BO();

            //check in record list if account number matches and balance is sufficient
            foreach (Customer_BO bo in record)
            {
                if (accountNo == bo.AccountNumber && amount <= bo.Balance)
                {
                    found       = true;
                    bo.Balance -= amount;
                    //save record list in file
                    bDAL.save(record);
                    cbo = bo;
                }
            }
            if (!found)
            {
                cbo.AccountNumber = -1;
            }


            //return business object
            return(cbo);
        }
Example #2
0
        /*Method transder money from one account and add to other account*/
        public bool Transfer(Customer_BO depositor, Customer_BO customer, int amount)
        {
            bool               result       = false;
            Transaction_BO     transaction  = new Transaction_BO();
            Customer_DAL       customer_DAL = new Customer_DAL();
            List <Customer_BO> list         = customer_DAL.getAccountList();

            foreach (Customer_BO cus in list)
            {
                if (cus.Account_No == customer.Account_No)
                {
                    customer.Balance  = customer.Balance + amount;
                    cus.Balance       = customer.Balance + amount;
                    depositor.Balance = depositor.Balance - amount;
                    Customer_BO obj = list.FirstOrDefault(obj1 => obj1.Account_No == depositor.Account_No);
                    if (obj != null)
                    {
                        obj.Balance = depositor.Balance - amount;
                    }
                    break;
                }
            }
            bool isSaved = customer_DAL.saveAccounList(list);

            if (isSaved == true)
            {
                result = true;
            }
            string   transType = "Cash Transfer";
            DateTime dateTime  = DateTime.UtcNow.Date;

            transaction = createTransactionObj(amount, transType, depositor.userName, depositor.holderName, dateTime);
            customer_DAL.saveTransaction(transaction);
            return(result);
        }
Example #3
0
        /*Helper method to add balance in account*/
        private bool addCash(Customer_BO customer, int amount, string transType)
        {
            bool               result       = false;
            Transaction_BO     transaction  = new Transaction_BO();
            Customer_DAL       customer_DAL = new Customer_DAL();
            List <Customer_BO> list         = customer_DAL.getAccountList();

            foreach (Customer_BO cus in list)
            {
                if (cus.Account_No == customer.Account_No)
                {
                    customer.Balance = customer.Balance + amount;
                    cus.Balance      = cus.Balance + amount;
                    break;
                }
            }
            DateTime dateTime = DateTime.UtcNow;

            dateTime    = dateTime.Date;
            transaction = createTransactionObj(amount, transType, customer.userName, customer.holderName, dateTime);
            customer_DAL.saveTransaction(transaction);
            bool isSaved = customer_DAL.saveAccounList(list);

            if (isSaved == true)
            {
                result = true;
            }
            return(result);
        }
Example #4
0
 /*Method give account no last account created*/
 public int getHighestAccountNo(string fileName)
 {
     try
     {
         int    accountNo = 0; Customer_BO customer = null;
         string filePath = Path.Combine(Environment.CurrentDirectory, fileName);
         if (File.Exists(filePath))
         {
             StreamReader sr        = new StreamReader(filePath);
             string       jsoninput = sr.ReadLine();
             while (jsoninput != null)
             {
                 customer = JsonSerializer.Deserialize <Customer_BO>(jsoninput);
                 if (customer.Account_No > accountNo)
                 {
                     accountNo = customer.Account_No;
                 }
                 jsoninput = sr.ReadLine();
             }
             sr.Close();
         }
         return(accountNo + 1);
     }
     catch (Exception)
     {
         return(-1);
     }
 }
        /// <summary>
        /// search For Account
        /// </summary>
        private void searchForAccount()
        {
            Console.WriteLine("Searching for an Account...");
            int    accNo   = inputAccountNo("Account ID: ", false);
            int    UserNo  = inputAccountNo("User ID: ", false);
            string name    = inputName("Holders Name: ", false);
            string type    = inputType("Type (saving, current): ", false);
            int    balance = inputBalance("Balance: ", false);
            string status  = inputStatus("Status(active, disabled): ", false);

            bo = new Customer_BO
            {
                Acc_Id        = accNo,
                User_Id       = UserNo,
                Name          = name,
                Type          = type,
                Balance       = balance,
                Login         = "",
                Pin           = "",
                Status        = status,
                LastWDTime    = DateTime.Now,
                TodayWDAmount = 0
            };
            List <Customer_BO> list = bll.searchForAccount(bo);

            displayCustomerInformation(list);
        }
        /// <summary>
        /// create New Account
        /// </summary>
        private void createNewAccount()
        {
            Console.WriteLine("Creating an Account...");
            string login   = inputLogin("Login: "******"Pin Code: ", true);
            string name    = inputName("Holders Name: ", true);
            string type    = inputType("Type (Saving, Current): ", true);
            int    balance = inputBalance("Starting Balance: ", true);
            string status  = inputStatus("Status(active, disabled): ", true);

            bo = new Customer_BO
            {
                Login   = login,
                Pin     = pin,
                Name    = name,
                Type    = type,
                Balance = balance,
                Status  = status
            };
            (bool flag, int accNo) = bll.createNewAccount(bo);
            if (flag)
            {
                Console.Clear();
                Console.WriteLine("Account Successfully Created – the account number assigned is: " + accNo);
            }
            else
            {
                Console.Clear();
                Console.WriteLine("Login already Exist. Try Again With Different Login");
            }
        }
Example #7
0
        public void Deposit(int accountNo)
        {
            int amount = default;

            Console.Write("Enter the cash amount to deposit : ");
            try
            {
                //get amount input from user
                amount = System.Convert.ToInt32(Console.ReadLine());
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            //if amount is a negative value or zero the display error message
            if (amount < 1)
            {
                Console.WriteLine("Enter a valid amount");
            }
            else
            {
                //create customer business object bo
                Customer_BO bo = new Customer_BO();
                //call deposit function and return the value to bo
                bo = cBLL.deposit(accountNo, amount);


                Console.WriteLine("Cash deposited sucessfully");
                //ask if user wants to print reciept
                Console.Write("do you wish to print a receipt (Y/N) ? : ");
                string confirm = Console.ReadLine();
                if (confirm == "Y")
                {
                    Console.WriteLine("\n");

                    //Display account number
                    Console.Write($"Account # {bo.AccountNumber}");
                    string date = bo.datetime.ToString("dd/MM/yyyy");
                    Console.WriteLine("\n");
                    Console.Write(date);
                    Console.WriteLine("\n");
                    Console.WriteLine($"Depostited : {amount }");
                    Console.Write($"Balance : {bo.Balance}\n");
                    //Display Deposited amount:amount
                    //Display balance
                }
                else if (confirm == "N")
                {
                    Console.WriteLine("Receipt will not be printed!");
                }
                else
                {
                    Console.WriteLine("No valid option chosen");
                }
            }
            //return to main menu
            MainMenu(accountNo);
        }
Example #8
0
        /*Method display plance of customer*/
        public void displayBalance(Customer_BO customer)
        {
            DateTime dateTime = DateTime.UtcNow.Date;
            string   date     = dateTime.ToString("dd/MM/yyyy");

            WriteLine($"Account #{customer.Account_No}");
            WriteLine("Date " + date);
            WriteLine($"Balance: {customer.Balance}");
        }
        /// <summary>
        /// create New Account
        /// </summary>
        /// <param name="c">Customer_BO</param>
        public void createNewAccount(Customer_BO c)
        {
            string text = $"{c.Acc_Id},{c.User_Id},{encryptLogin(c.Login)},{encryptPin(c.Pin)},{c.Name},{c.Type}," +
                          $"{c.Balance},{c.Status},{(c.LastWDTime).ToShortDateString()},{c.TodayWDAmount}";
            StreamWriter Writer = new StreamWriter(new FileStream(filePathCustomer, FileMode.Append, FileAccess.Write));

            Writer.WriteLine(text);
            Writer.Close();
        }
Example #10
0
        public void Update(string accountNum)
        {
            //create bool variable to check if accountNumber entered is in record
            bool exists = false;
            //put only "AccountNumber string in list to search only with Account number"
            List <string> arguments = new List <string>();

            arguments.Add("AccountNumber");
            List <Customer_BO> accountFound = adminBLL.SearchAccount(accountNum, "", "", "", "", "", arguments);

            //if nothing in list then make exists bool false
            if (accountFound.Count == 0)
            {
                exists = false;
            }
            else
            {
                exists = true;
            }
            //if some record is found display its data
            if (exists)
            {
                Customer_BO bo = accountFound.First();

                Console.WriteLine($"Account # {bo.AccountNumber}");
                Console.WriteLine($"Type : {bo.AccountType}");
                Console.WriteLine($"Holder : {bo.Name}");
                Console.WriteLine($"Balance : {bo.Balance}");
                Console.WriteLine($"Status : {bo.AccountStatus}");

                Console.WriteLine("Please enter in the fields you wish to update (leave blank otherwise) : ");

                //get input to update from user
                Console.Write("Login : "******"Pin code : ");
                string pinInput = Console.ReadLine();

                Console.Write("Holder's name : ");
                string nameInput = Console.ReadLine();
                Console.Write("Status : ");
                string statusInput = Console.ReadLine();

                //update in business logic layer
                adminBLL.Update(loginInput, pinInput, nameInput, statusInput, bo.AccountNumber);
                //if successful
                Console.WriteLine("Your account has been successfully updated");
            }
            else
            {
                Console.WriteLine("No record found");
            }
            //save data to file
            adminBLL.save();
            //return to admin main menu
            Admin_menu();
        }
Example #11
0
        /*method actullay withdraw money from user account*/
        public (bool, bool, bool) cashWithdraw(Customer_BO customer, int money)
        {
            bool                  result = false; bool daily_transaction = false; bool low_balance = false;
            int                   previousTransaction = 0; string transType = "Cash WithDrawal";
            Transaction_BO        transaction  = new Transaction_BO();
            DateTime              dateTime     = DateTime.UtcNow.Date;
            Customer_DAL          customer_DAL = new Customer_DAL();
            List <Customer_BO>    list         = customer_DAL.getAccountList();
            List <Transaction_BO> t_list       = customer_DAL.getTransactionList();

            foreach (Transaction_BO tr in t_list)
            {
                if (customer.userName == tr.user_id && tr.date == dateTime && tr.type == "Cash WithDrawal")
                {
                    previousTransaction = tr.amount;
                }
            }
            foreach (Customer_BO cus in list)
            {
                if (customer.Account_No == cus.Account_No)
                {
                    int temp     = money;
                    int previous = temp + previousTransaction;
                    if (customer.Balance > money && money < Customer_BO.maxWithdraw && previous < Customer_BO
                        .maxWithdraw)
                    {
                        customer.Balance = customer.Balance - money;
                        cus.Balance      = cus.Balance - money;
                        result           = true;
                        transaction      = createTransactionObj(money, transType, customer.userName, customer.holderName, dateTime);
                        customer_DAL.saveTransaction(transaction);
                        break;
                    }
                    if (customer.Balance > money && previous > Customer_BO.maxWithdraw)
                    {
                        daily_transaction = true;
                    }
                    if (customer.Balance < money)
                    {
                        low_balance = true;
                    }
                    else
                    {
                        result = false;
                        break;
                    }
                }
            }
            bool isSaved = customer_DAL.saveAccounList(list);

            if (isSaved != true)
            {
                result = false;
            }
            return(result, daily_transaction, low_balance);
        }
Example #12
0
        /*Helper method show Recepit*/
        private void showRecepit(Customer_BO customer, string transType, int amount)
        {
            DateTime dateTime = DateTime.UtcNow.Date;
            string   date     = dateTime.ToString("dd/MM/yyyy");

            WriteLine($"Account #{customer.Account_No}");
            WriteLine("Date " + date);
            WriteLine($"Amount {transType}: {amount}");
            WriteLine($"Balance: {customer.Balance}");
        }
Example #13
0
        /*Method to deposite cash into account
         */
        public bool deposite(Customer_BO customer, int amount)
        {
            bool   result    = false;
            string transType = "Cash Deposite";
            bool   b         = addCash(customer, amount, transType);

            if (b == true)
            {
                result = true;
            }
            return(result);
        }
        /*Search method show search menu and show input matching account*/
        public void search()
        {
            Console.Clear();
            WriteLine("Search Menu:\n");
            Customer_BO customer = getInput();

            Write("Account Number:  ");
            string input = ReadLine();

            if (input == "")
            {
                customer.Account_No = -100;/*since acoountNO is not -ve we store -ve value to show administrator does not update accountNO*/
            }
            else
            {
                customer.Account_No = System.Convert.ToInt32(input);
            }
            Administrator_BLL  administrator_BLL = new Administrator_BLL();
            List <Customer_BO> list = administrator_BLL.search_BLL(customer);

            if (list != null)
            {
                WriteLine("==== SEARCH RESULTS ======");
                Write(
                    format: "{0,-13} {1,-13} {2,-13}",
                    arg0: "Account ID",
                    arg1: "User ID",
                    arg2: "Holder Name");
                WriteLine(
                    format: "{0,-13} {1,-13} {2,-13}",
                    arg0: "Type",
                    arg1: "Balance",
                    arg2: "Status"
                    );
                foreach (Customer_BO cus in list)
                {
                    Write(
                        format: "{0,-13} {1,-13} {2,-13}",
                        arg0: cus.Account_No,
                        arg1: cus.userName,
                        arg2: cus.holderName);
                    WriteLine("{0,-13} {1,-13} {2,-13}",
                              arg0: cus.Type,
                              arg1: cus.Balance,
                              arg2: cus.Status);
                }
                WriteLine("Press any key to continue");
            }
            else
            {
                WriteLine("Not a single Account exists with these attributes.");
            }
        }
Example #15
0
        public Customer_BO display(int accountNo)
        {
            Customer_BO boToReturn = new Customer_BO();

            //check if account number is found in record then put that business object in variable and return
            foreach (Customer_BO bo in record)
            {
                if (bo.AccountNumber == accountNo)
                {
                    boToReturn = bo;
                }
            }
            return(boToReturn);
        }
        /*Method get customer object from Presentation layer and
         * call saveAccount method of DAL for save account in file.*/
        public int createAccount(Customer_BO customer)
        {
            Administrator_DAL administrator = new Administrator_DAL();
            bool result = administrator.saveAccount(customer);

            if (result == true)
            {
                return(customer.Account_No);
            }
            else
            {
                return(-1);//account number is never negative so it is a check to validate whether acoount is created or not
            }
        }
Example #17
0
        /*Save account of the new customer in file*/
        public bool saveAccount(Customer_BO customer)
        {
            bool result = false;

            customer.Account_No = getHighestAccountNo("Accounts.txt");
            if (customer.Account_No > 0)
            {
                result = save(customer, "Accounts.txt");
                return(result);
            }
            else
            {
                return(result);
            }
        }
Example #18
0
        /*Method return customer object by using account number*/
        public Customer_BO giveAccount(int accountNO)
        {
            Administrator_DAL  administrator = new Administrator_DAL();
            List <Customer_BO> list          = administrator.getAccountList();
            Customer_BO        customer      = null;

            foreach (Customer_BO cus in list)
            {
                if (cus.Account_No == accountNO)
                {
                    customer = cus;
                }
            }
            return(customer);
        }
Example #19
0
        /// <summary>
        /// deposite cash
        /// </summary>
        private void depositeCash()
        {
            int amount = inputAmount("Enter the cash amount to deposit:");

            bo = bll.depositeCash(bo, amount);
            string yn = inputYesNo("Cash Deposited Successfully. Do you wish to print a receipt (Y/N)? ");

            if (yn == "n")
            {
                return;
            }
            else
            {
                displayDepositedRecipt(amount);
            }
        }
Example #20
0
        /// <summary>
        /// It creates a new Account
        /// </summary>
        /// <param name="c">Customer_BO</param>
        /// <returns>True on Success, False on Failure</returns>
        public (bool, int) createNewAccount(Customer_BO c)
        {
            bool loginExist = checkIfLoginExist(c.Login);

            if (loginExist)
            {
                return(false, -1);
            }
            int accNo = getMaxAccNo() + 1;

            c.Acc_Id        = accNo;
            c.User_Id       = accNo * 100;
            c.TodayWDAmount = 0;
            c.LastWDTime    = DateTime.Now;
            dal.createNewAccount(c);
            return(true, accNo);
        }
        /*method update account of a specific customer*/
        public bool update_BLL(Customer_BO customerPrevious, Customer_BO customerNew)
        {
            bool result = false;
            Administrator_DAL  administrator = new Administrator_DAL();
            List <Customer_BO> list          = administrator.getAccountList();

            foreach (Customer_BO cus in list)
            {
                if (cus.Account_No == customerPrevious.Account_No)
                {
                    if (customerNew.Account_No > 0)
                    {
                        cus.Account_No = customerNew.Account_No;
                    }
                    if (customerNew.userName != "")
                    {
                        cus.userName = customerNew.userName;
                    }
                    if (customerNew.Password != "")
                    {
                        cus.Password = customerNew.Password;
                    }
                    if (customerNew.holderName != "")
                    {
                        cus.holderName = customerNew.holderName;
                    }
                    if (customerNew.Type != "")
                    {
                        cus.Type = customerNew.Type;
                    }
                    if (customerNew.Balance >= 0)
                    {
                        cus.Balance = customerNew.Balance;
                    }
                    if (customerNew.Status != "")
                    {
                        cus.Status = customerNew.Status;
                    }
                    result = true;
                    break;
                }
            }
            administrator.writeFile(list);
            return(result);
        }
Example #22
0
        public Customer_BO deposit(int accountNo, int amount)
        {
            Customer_BO boToReturn = new Customer_BO();

            //check if account number is found in record then subtract balance and amount if sufficient balance is present
            foreach (Customer_BO bo in record)
            {
                if (bo.AccountNumber == accountNo)
                {
                    bo.Balance += amount;
                    boToReturn  = bo;
                }
            }
            //save record list to file
            bDAL.save(record);
            //return business object
            return(boToReturn);
        }
Example #23
0
        /*helper method to show transcation is completed or not*/
        private void showTransactionResult(bool result, Customer_BO customer, int money)
        {
            bool l_break = false;

            if (result == true)
            {
                WriteLine("Cash Successfully Withdrawn!");
                while (true)
                {
                    try
                    {
                        WriteLine("Do you wish to print a receipt(Y/ N)?  ");
                        char answer = System.Convert.ToChar(ReadLine());
                        if (answer == 'y' || answer == 'Y')
                        {
                            Console.Clear();
                            showRecepit(customer, "Cash WithDrawal", money);
                            l_break = true;
                        }
                        else if (answer == 'n' || answer == 'N')
                        {
                            WriteLine("");
                            l_break = true;
                        }
                        else
                        {
                            WriteLine("Invalid input Please select Y|N. ");
                        }
                        if (l_break == true)
                        {
                            break;
                        }
                    }
                    catch (Exception)
                    {
                        WriteLine("Invalid input Please select Y|N. ");
                    }
                }
            }
            else
            {
                WriteLine("You Balance low for this transaction.");
            }
        }
Example #24
0
 /*Method for noraml cash withdraw*/
 public void normalCash(Customer_BO customer)
 {
     while (true)
     {
         Console.Clear();
         try
         {
             WriteLine("Enter the withdrawal amount: ");
             int money = System.Convert.ToInt32(ReadLine());
             if (money < 0)
             {
                 throw new Exception();
             }
             Customer_BLL customer_BLL = new Customer_BLL();
             (bool, bool, bool)data = customer_BLL.cashWithdraw(customer, money);
             bool result      = data.Item1;
             bool daily_tr    = data.Item2;
             bool low_balance = data.Item3;
             if (result == true)
             {
                 showTransactionResult(result, customer, money);//function show result of transcation
             }
             if (daily_tr == true)
             {
                 WriteLine("Daily transaction limit is 20000. you can't go beyond this limit.");
             }
             if (money > 20000)
             {
                 WriteLine("Transaction amount should be less than 20000.");
             }
             if (low_balance == true)
             {
                 WriteLine("Your account balance is low for this transaction");
             }
             break;
         }
         catch (Exception)
         {
             WriteLine("Input is not correct Select corect amount. Press any key to continue.");
             ReadKey();
             WriteLine("");
         }
     }
 }
        /// <summary>
        /// update Account Information
        /// </summary>
        private void updateAccountInformation()
        {
            Console.WriteLine("Updating an Account Information...");
            int accNo = inputAccountNo("Enter the Account Number: ", true);

            bo = bll.isAccountExist(accNo);
            if (bo == null)
            {
                Console.Clear();
                Console.WriteLine("SORRY: Account does not exist");
                return;
            }
            displayCustomerInformation();

            Console.WriteLine("Please enter in the fields you wish to update (leave blank otherwise): ");

            string login = inputLogin("Login: "******"")
            {
                bo.Login = login;
            }
            String pin = inputPin("Pin Code: ", false);

            if (pin != "")
            {
                bo.Pin = pin;
            }
            string name = inputName("Holders Name: ", false);

            if (name != "")
            {
                bo.Name = name;
            }
            string status = inputStatus("Status: ", false);

            if (status != "")
            {
                bo.Status = status;
            }
            bll.updateAccountInformation(bo);
            Console.Clear();
            Console.WriteLine("Account # " + accNo + ": Information Upddated Succesfully.");
        }
Example #26
0
        /*method read and deserialize objects from file and write in a list*/
        public List <Customer_BO> readFile(string fileName)
        {
            Customer_BO customer = null; List <Customer_BO> list = new List <Customer_BO>();

            try
            {
                string filePath = Path.Combine(Environment.CurrentDirectory, fileName);
                if (File.Exists(filePath))
                {
                    StreamReader sr        = new StreamReader(filePath);
                    string       jsoninput = sr.ReadLine();
                    while (jsoninput != null)
                    {
                        customer = JsonSerializer.Deserialize <Customer_BO>(jsoninput);
                        string u_id   = String.Empty;
                        string pin    = String.Empty;
                        char[] array1 = new char[customer.userName.Length];
                        char[] array2 = new char[customer.Password.Length];
                        array1 = customer.userName.ToCharArray();
                        array2 = customer.Password.ToCharArray();
                        for (int i = 0; i < customer.userName.Length; i++)
                        {
                            u_id += Decryption(array1[i]);
                        }
                        for (int i = 0; i < customer.Password.Length; i++)
                        {
                            pin += Decryption(array2[i]);
                        }
                        customer.userName = u_id;
                        customer.Password = pin;
                        list.Add(customer);
                        jsoninput = sr.ReadLine();
                    }
                    sr.Close();
                }
                return(list);
            }
            catch (Exception)
            {
                list = null;
                return(list);
            }
        }
Example #27
0
        public void Display(int accountNo)
        {
            //create customer business object
            Customer_BO bo = new Customer_BO();

            //call display function in business logic layer and return value to business object bo
            bo = cBLL.display(accountNo);
            //display the details
            Console.Write($"Account # {bo.AccountNumber}");
            string date = bo.datetime.ToString("dd/MM/yyyy");

            Console.WriteLine("\n");
            Console.Write(date);
            Console.WriteLine("\n");

            Console.Write($"Balance : {bo.Balance}\n");
            //return to main menu
            MainMenu(accountNo);
        }
Example #28
0
        public bool Transfer(int accountNo, int receiverAccountNo, int amount)
        {
            bool        transfered = false;
            Customer_BO sender     = new Customer_BO();
            Customer_BO receiver   = new Customer_BO();

            //check if sender is not equal to receiver

            foreach (Customer_BO bo in record)
            {
                if (bo.AccountNumber == accountNo)
                {
                    sender = bo;
                }
                if (bo.AccountNumber == receiverAccountNo)
                {
                    receiver = bo;
                }
            }
            if (receiver != sender)
            {
                //then check if balance is sufficient to transfer
                if (sender.Balance >= amount)
                {
                    sender.Balance   -= amount;
                    receiver.Balance += amount;
                    transfered        = true;
                }
                else
                {
                    transfered = false;
                }
            }
            else
            {
                transfered = false;
            }
            //save data to file
            bDAL.save(record);
            //return bool if amount is transfered or not
            return(transfered);
        }
Example #29
0
        /// <summary>
        /// cash transfer
        /// </summary>
        private void cashTransfer()
        {
            int         amount = inputAmountMultipleOf500("Enter amount in multiples of 500: ");
            int         accNo  = inputAccountNo("Enter the account number to which you want to transfer: ");
            Customer_BO cus    = bll.isAccountExist(accNo);

            if (cus == null)
            {
                Console.Clear();
                Console.WriteLine("Account no. you entered does not exist OR currently Disabled");
                return;
            }
            int accNo2 = inputAccountNo("You wish to deposit Rs " + amount + " in account held by " + cus.Name + "; If this information is correct please re-enter the account number: ");

            if (accNo != accNo2)
            {
                Console.Clear();
                Console.WriteLine("Account no.s does not match");
                Console.WriteLine("Cash Transfer Aborted");
                return;
            }
            if (bo.Balance < amount)
            {
                Console.Clear();
                Console.WriteLine("Not enough oney in account to satisfy Transfer");
                Console.WriteLine("Cash Transfer Aborted");
                return;
            }
            bo.Balance  = bo.Balance - amount;
            cus.Balance = cus.Balance + amount;
            bo          = bll.cashTransfer(bo, cus, amount);
            string yn = inputYesNo("Do you wish to print a receipt (Y/N)? ");

            if (yn == "n")
            {
                return;
            }
            else
            {
                displayCashTransferRecipt(amount);
            }
        }
Example #30
0
        public int createNewAccount(string login, int pin, string name, string type, int balance, string status)
        {
            Customer_BO bo = new Customer_BO {
                Login = login, Pin = pin, Name = name, AccountType = type, Balance = balance, AccountStatus = status
            };
            int temp = record.Count;

            if (record.Count == 0)
            {
                temp = 1;
            }
            else
            {
                temp = record.Last().AccountNumber + 1;
            }
            bo.AccountNumber = temp;
            record.Add(bo);
            //Console.WriteLine(bo.Name + bo.Login + bo.Balance + bo.AccountNumber);
            return(temp);
        }