Ejemplo n.º 1
0
        public void usermenu(string accountno, string password)
        {
            Console.Title = "IBS USER";

            Console.BackgroundColor = ConsoleColor.Gray;
            Console.Clear();


            Console.ForegroundColor = ConsoleColor.White;
            Console.WriteLine("\n\t\t\t------------------------------------------------------------------------");
            Console.ForegroundColor = ConsoleColor.DarkMagenta;
            Console.WriteLine("\t\t\t\t\t\tInternet Banking Solutions ");
            Console.ForegroundColor = ConsoleColor.White;
            Console.WriteLine("\t\t\t------------------------------------------------------------------------");
            Console.ForegroundColor = ConsoleColor.Black;

            DateTime d = DateTime.Now;

            Console.Write("\t\t\t" + d.ToString("d"));
            Console.Write("\t\t\t" + d.ToString("dddd"));
            Console.Write("\t\t\t" + d.ToString("t"));


            Console.WriteLine("\n\n\n\t\t\t\t\t\t  Login Successful!!!");
            Console.WriteLine("\t\t\t\t\t\t------------------------");
            BLMoneyTransaction    bmt = new BLMoneyTransaction();
            BLInterestCalculation bi  = new BLInterestCalculation();

            bool flag = true;

            while (flag)
            {
                Console.ForegroundColor = ConsoleColor.Black;
                Console.WriteLine("\n\n\n\t\t\t\t\t\t  1. Deposit Money \n\t\t\t\t\t\t  2. WithDraw Money \n\t\t\t\t\t\t  3. Transfer Money \n\t\t\t\t\t\t  4. Interest Amount \n\t\t\t\t\t\t  5. Update Password \n\t\t\t\t\t\t  6. Exit");
                //Console.WriteLine(" Enter Your Choice :");
                int choice = int.Parse(Console.ReadLine());

                switch (choice)
                {
                case 1:
                    Console.ForegroundColor = ConsoleColor.DarkBlue;
                    Console.WriteLine(" Enter Amount You Want to Deposit :");
                    Console.ForegroundColor = ConsoleColor.Black;
                    double damount = double.Parse(Console.ReadLine());
                    string bal     = bmt.b_deposit(damount, accountno);
                    Console.WriteLine(bal);
                    break;

                case 2:
                    Console.ForegroundColor = ConsoleColor.DarkBlue;
                    Console.WriteLine(" Enter Amount You Want to Withdraw :");
                    Console.ForegroundColor = ConsoleColor.Black;
                    double wamount = double.Parse(Console.ReadLine());
                    string bal2    = bmt.b_withdraw(wamount, accountno);
                    Console.WriteLine(bal2);
                    break;

                case 3:
                    Console.ForegroundColor = ConsoleColor.DarkBlue;
                    Console.WriteLine(" Enter Account number to which you want to transfer money");
                    string toaccount = (Console.ReadLine());
                    Console.WriteLine(" Enter Amount You Want to Transfer");
                    Console.ForegroundColor = ConsoleColor.Black;
                    double tamount = double.Parse(Console.ReadLine());
                    string bal3    = bmt.b_transfer(tamount, toaccount, accountno);
                    Console.WriteLine(bal3);
                    break;

                case 4:
                    double interest = bi.b_ViewInterest(accountno);
                    Console.WriteLine("\n  Interest Amount " + interest);
                    if (interest > 0)
                    {
                        Console.ForegroundColor = ConsoleColor.DarkBlue;
                        Console.WriteLine("\n What do you want to do with the interest amount\n");
                        Console.WriteLine("  1. Withdraw \n  2. Add to Account Balance \n  3. Exit ");
                        Console.ForegroundColor = ConsoleColor.Black;
                        int iaction = int.Parse(Console.ReadLine());
                        switch (iaction)
                        {
                        case 1:
                            string bal4 = bi.b_WithdrawInterest(interest, accountno);
                            Console.WriteLine(" Interest Amount Withdrawn \n   Interest Balance: 0.00 \n Available Balance : " + bal4);
                            break;

                        case 2:
                            string bal5 = bi.b_AddInterest(interest, accountno);
                            Console.WriteLine(" Interest Amount Added to Account Balance \n Interest Balance: 0.00 \n Available Balance : " + bal5);
                            break;

                        case 3:
                            break;

                        default:
                            break;
                        }
                    }
                    break;

                case 5:
                    Console.ForegroundColor = ConsoleColor.DarkBlue;
                    Console.WriteLine(" Enter New Password");
                    Console.ForegroundColor = ConsoleColor.Black;
                    string newpassword = (Console.ReadLine());
                    bmt.b_updatePassword(newpassword, accountno);
                    Console.WriteLine(" Password Updated \n New Password : " + newpassword);
                    break;

                case 6:
                    flag = false;
                    break;

                default:
                    break;
                }
            }
        }
        public void adminMenu()
        {
            bool flag = true;

            while (flag)
            {
                Console.Clear();
                heading("IBS Admin");
                Console.WriteLine("\n\n\n\t\t\t\t\t\t\tAdmin\n");
                Console.ForegroundColor = ConsoleColor.DarkBlue;
                Console.WriteLine("\n\t\t\t\t\t 1. View all new Registered Users\n\t\t\t\t\t 2. View All transactions\n\t\t\t\t\t 3. Calculate interest\n\t\t\t\t\t 4. Exit");


                Console.ForegroundColor = ConsoleColor.Black;
                Console.WriteLine("\n\t\t\t\t\t\tEnter Choice");
                Console.SetCursorPosition(Console.CursorLeft + 57, Console.CursorTop);

                BLAccountCreation     ba = new BLAccountCreation();
                BLInterestCalculation bi = new BLInterestCalculation();
                BLReports             br = new BLReports();
                int choice = int.Parse(Console.ReadLine());
                switch (choice)
                {
                case 1:
                    heading("IBS Admin");
                    List <User> userlist = ba.b_newRegistrations();
                    if (userlist.Count > 0)
                    {
                        display_newRegistrations(userlist);
                        new_users_action(ba);
                    }
                    break;

                case 2:
                    heading("IBS Admin");
                    List <Transaction> transaclist = br.b_transactionDetails();
                    display_transactiondetails(transaclist);
                    break;

                case 3:
                    heading("IBS Admin");
                    List <Account> accountlist = new List <Account>();
                    try
                    {
                        accountlist = br.b_AccountDetails();
                        display_accountdetails(accountlist);
                        bi.b_CalculateInterest(accountlist);
                        Console.WriteLine("\n Account details after Calculate Interest\n Interest rate is 6% for Fixed Account and 8% for Saving Account\n");
                        accountlist = br.b_AccountDetails();
                        display_accountdetails(accountlist);
                    }
                    catch (InterestException e)
                    {
                        Console.WriteLine(e.Message);
                    }

                    Console.ReadKey();
                    break;

                case 4:
                    heading("IBS Admin");
                    flag = false;
                    break;
                }
            }
        }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            DLAccountCreation     da  = new DLAccountCreation();
            DLMoneyTransaction    dmt = new DLMoneyTransaction();
            DLInterestCalculation di  = new DLInterestCalculation();
            DLReports             dr  = new DLReports();

            BLAccountCreation     ba  = new BLAccountCreation(da);
            BLMoneyTransaction    bmt = new BLMoneyTransaction(dmt);
            BLInterestCalculation bi  = new BLInterestCalculation(di);
            BLReports             br  = new BLReports(dr);

            userPresentation  up = new userPresentation(ba, bmt, bi);
            adminPresentation ap = new adminPresentation(ba, bi, br);


label:
            try
            {
                heading("IBS");
                serivceMenu();
                int choice = int.Parse(Console.ReadLine());

                switch (choice)
                {
                case 1:
                    //Login as admin or user
                    Console.Clear();
                    heading("IBS");

                    Console.ForegroundColor = ConsoleColor.Blue;
                    Console.WriteLine("\n\n\n\t\t\t\t\t\t      LOGIN PORTAL");
                    Console.ForegroundColor = ConsoleColor.Black;
                    Console.WriteLine("\t\t\t\t\t\t      -------------");
                    Console.WriteLine("\n\n\t\t\t\t\t    please enter your UserID Number : ");
                    Console.SetCursorPosition(Console.CursorLeft + 55, Console.CursorTop);
                    string userid = Console.ReadLine();
                    Console.WriteLine("\n\t\t\t\t\t\t     Enter Password : "******"customer")
                        {
                            up.usermenu(userid, password);
                        }
                        else if (role == "admin")
                        {
                            ap.adminMenu(userid);
                        }
                    }
                    else
                    {
                        Console.ForegroundColor = ConsoleColor.DarkRed;
                        Console.SetCursorPosition(Console.CursorLeft + 50, Console.CursorTop);
                        Console.WriteLine("\nIncorrect Username no or password\nLogin Failed");
                        Console.Beep();
                        Console.ForegroundColor = ConsoleColor.Black;
                        Console.WriteLine("\nPress any Key to go back");
                        Console.ReadKey();
                    }

                    break;

                case 2:
                    //Resgitration for both user and admin

                    Console.Clear();
                    heading("IBS Registration");
                    Console.ForegroundColor = ConsoleColor.DarkBlue;
                    Console.WriteLine("\n\n\n\n\t\t\tDo u want register as an admin or a user(Press A for admin and U for user)?\n\n");
                    Console.ForegroundColor = ConsoleColor.Black;
                    Console.SetCursorPosition(Console.CursorLeft + 57, Console.CursorTop);
                    string s = Console.ReadLine();
                    if (s == "A" || s == "a")
                    {
                        Console.Clear();
                        heading("IBS Admin Registration");
                        Console.ForegroundColor = ConsoleColor.Blue;
                        Console.WriteLine("\n\n\t\t\t\t\t\t   Register Your Account");
                        Console.WriteLine("\t\t\t\t\t\t   ---------------------");
                        Console.WriteLine("\n\n\tPlease enter your Personal details: ");
                        ap.adminregistration();
                    }
                    else if (s == "U" || s == "u")
                    {
                        Console.Clear();
                        heading("IBS User Registration");
                        Console.ForegroundColor = ConsoleColor.Blue;
                        Console.WriteLine("\n\n\t\t\t\t\t\t   Register Your Account");
                        Console.WriteLine("\t\t\t\t\t\t   ---------------------");
                        Console.WriteLine("\n\n\tPlease enter your Personal details: ");
                        up.userRegistration();
                    }
                    else
                    {
                        Console.ForegroundColor = ConsoleColor.DarkRed;
                        Console.SetCursorPosition(Console.CursorLeft + 50, Console.CursorTop);
                        Console.WriteLine("\nIncorrect Input ");
                        Console.Beep();
                        Console.ForegroundColor = ConsoleColor.Black;
                        Console.WriteLine("\nPress any Key to go back");
                        Console.ReadKey();
                    }
                    break;

                case 3:
                    //Checking status of newly created account of Customer
                    Console.ForegroundColor = ConsoleColor.DarkBlue;
                    Console.WriteLine("\n\n\t\t\t\t    Enter the temporary User Id no of your application");
                    Console.ForegroundColor = ConsoleColor.Black;
                    Console.SetCursorPosition(Console.CursorLeft + 60, Console.CursorTop);
                    string uid        = Console.ReadLine();
                    string currstatus = ba.b_checkStatus(uid);
                    up.displayStatus(currstatus, uid);
                    Console.WriteLine("\nPress any Key to go back");
                    Console.ReadKey();
                    break;

                default:
                    Console.WriteLine("Invalid Choice");
                    Console.WriteLine("\nPress any Key to go back");
                    Console.ReadKey();
                    break;
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                Console.WriteLine("\nPress any Key to go back");
                Console.ReadKey();
            }

            goto label;
        }
 public userPresentation(BLAccountCreation ba, BLMoneyTransaction bmt, BLInterestCalculation bi)
 {
     this.ba  = ba;
     this.bmt = bmt;
     this.bi  = bi;
 }
Ejemplo n.º 5
0
 public adminPresentation(BLAccountCreation ba, BLInterestCalculation bi, BLReports br)
 {
     this.ba = ba;
     this.bi = bi;
     this.br = br;
 }