Esempio n. 1
0
        private void DisplayFound(int accnumber)
        {
            DisplayDetail displayDetail = new DisplayDetail();

            //store all the detail into array
            string[] accoutDetail = File.ReadAllLines($"{accnumber}.txt");
            Console.WriteLine("\t ------------------------------------------------------------- ");
            Console.WriteLine("\t|                        Account Details                      |");
            Console.WriteLine("\t =============================================================");
            Console.WriteLine("");
            //display user detail
            displayDetail.UserDetails(accoutDetail);
            Console.WriteLine("\t ------------------------------------------------------------- ");

            //check if user wants to delete
            string deleteInput = "";

            while (deleteInput != "y" && deleteInput != "n")
            {
                Console.Write("\t\t Delete (y/n)? ");
                deleteInput = Console.ReadLine();
            }
            if (deleteInput == "n")
            {
                this.error = false;
            }
            else if (deleteInput == "y")
            {
                //delete the account file and account number in the accDB
                DeleteAction(accnumber);
            }
        }
Esempio n. 2
0
        //used to display the account detail
        private void displayFound(int accnumber)
        {
            DisplayDetail displayDetail = new DisplayDetail();

            //store user detail to array
            string[] accoutDetail = File.ReadAllLines($"{accnumber}.txt");
            Console.WriteLine("\t ------------------------------------------------------------- ");
            Console.WriteLine("\t|                        Account Details                      |");
            Console.WriteLine("\t =============================================================");
            Console.WriteLine("");
            displayDetail.UserDetails(accoutDetail);
            Console.WriteLine("\t ------------------------------------------------------------- ");
        }
Esempio n. 3
0
        //display statement
        private void DisplayFound(int accnumber)
        {
            DisplayDetail displayDetail = new DisplayDetail();

            //store all the detail into array
            string[] accoutDetail = File.ReadAllLines($"{accnumber}.txt");
            Console.WriteLine("\t ------------------------------------------------------------- ");
            Console.WriteLine("\t|                        Account Details                      |");
            Console.WriteLine("\t =============================================================");
            Console.WriteLine("\t\t\b\b\bAccount Statement");
            Console.WriteLine("");

            //display detail
            displayDetail.UserDetails(accoutDetail);

            //display recent transaction below
            //based on number of transcations, switch display appropriate
            //accountDetail with no transaction is 7, start from length 8, display transaction detail
            switch (accoutDetail.Length)
            {
            case 7:
                Console.WriteLine($"\t\t\b\b\bRecent Transcation: N/A");
                break;

            case 8:
                Console.WriteLine($"\t\t\b\b\bRecent Transcation: {accoutDetail[7]}");
                break;

            case 9:
                Console.WriteLine($"\t\t\b\b\bRecent Transcation: {accoutDetail[7]}");
                Console.WriteLine($"\t\t\b\b\bRecent Transcation: {accoutDetail[8]}");
                break;

            case 10:
                Console.WriteLine($"\t\t\b\b\bRecent Transcation: {accoutDetail[7]}");
                Console.WriteLine($"\t\t\b\b\bRecent Transcation: {accoutDetail[8]}");
                Console.WriteLine($"\t\t\b\b\bRecent Transcation: {accoutDetail[9]}");
                break;

            case 11:
                Console.WriteLine($"\t\t\b\b\bRecent Transcation: {accoutDetail[7]}");
                Console.WriteLine($"\t\t\b\b\bRecent Transcation: {accoutDetail[8]}");
                Console.WriteLine($"\t\t\b\b\bRecent Transcation: {accoutDetail[9]}");
                Console.WriteLine($"\t\t\b\b\bRecent Transcation: {accoutDetail[10]}");
                break;

            default:
                Console.WriteLine($"\t\t\b\b\bRecent Transcation: {accoutDetail[accoutDetail.Length - 5]}");
                Console.WriteLine($"\t\t\b\b\bRecent Transcation: {accoutDetail[accoutDetail.Length - 4]}");
                Console.WriteLine($"\t\t\b\b\bRecent Transcation: {accoutDetail[accoutDetail.Length - 3]}");
                Console.WriteLine($"\t\t\b\b\bRecent Transcation: {accoutDetail[accoutDetail.Length - 2]}");
                Console.WriteLine($"\t\t\b\b\bRecent Transcation: {accoutDetail[accoutDetail.Length - 1]}");
                break;
            }
            Console.WriteLine("\t ------------------------------------------------------------- ");
            Console.WriteLine("");

            //get user input and dertermine whether to send email or not
            string emailState = "";

            while (emailState != "y" && emailState != "n")
            {
                Console.Write("\t\t Email statement (y/n)? ");
                emailState = Console.ReadLine();
            }
            if (emailState == "n")
            {
                this.error = false;
            }
            else if (emailState == "y")
            {
                //send the email
                EmailBody   emailBody   = new EmailBody(accoutDetail[2], accoutDetail[3], accoutDetail[4], accoutDetail[6], Convert.ToInt32(accoutDetail[0]), Convert.ToInt32(accoutDetail[5]));
                EmailSender emailSender = new EmailSender();
                emailSender.sendEmail(this.emailSenderAddress, accoutDetail[6], emailBody, Convert.ToDouble(accoutDetail[1]), false);
                Console.WriteLine("\t\t Email sent Successfully!...");
                Console.WriteLine("\t\t Press any key to go to the menu..");
                Console.ReadKey();
            }
        }