Пример #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;
                }
            }
        }
        //user actions --MONEY TRANSACTIONs
        public void usermenu(string accountno, string password)
        {
            heading();

            Console.WriteLine("\n\n\n\t\t\t\t\t\t  Login Successful!!!");
            Console.WriteLine("\t\t\t\t\t\t------------------------");

            bool flag = true;

            while (flag)
            {
                Console.Clear();
                heading();
                Console.ForegroundColor = ConsoleColor.DarkBlue;
                Console.WriteLine("\n\n\n\t\t\t\t\t\t\tCUSTOMER");
                Console.WriteLine("\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. View Balance \n\t\t\t\t\t\t  6. Update Password \n\t\t\t\t\t\t  7. LOG OUT");
                Console.ForegroundColor = ConsoleColor.Black;
                Console.WriteLine("\n\t\t\t\t\t\t Enter Your Choice :");
                Console.SetCursorPosition(Console.CursorLeft + 60, Console.CursorTop);
                int choice = int.Parse(Console.ReadLine());
                try
                {
                    switch (choice)
                    {
                    case 1:
                        Console.ForegroundColor = ConsoleColor.DarkBlue;
                        Console.WriteLine("\t\t\tEnter Amount You Want to Deposit :");
                        Console.SetCursorPosition(Console.CursorLeft + 24, Console.CursorTop);

                        Console.ForegroundColor = ConsoleColor.Black;
                        double damount = double.Parse(Console.ReadLine());
                        string bal     = bmt.b_deposit(damount, accountno);
                        Console.WriteLine(bal);

                        Console.WriteLine("\nPress any key to go back");
                        Console.ReadKey();
                        break;

                    case 2:
                        Console.ForegroundColor = ConsoleColor.DarkBlue;
                        Console.WriteLine("\t\t\tEnter Amount You Want to Withdraw :");
                        Console.SetCursorPosition(Console.CursorLeft + 24, Console.CursorTop);

                        Console.ForegroundColor = ConsoleColor.Black;
                        double wamount = double.Parse(Console.ReadLine());
                        string bal2    = bmt.b_withdraw(wamount, accountno);
                        Console.WriteLine(bal2);

                        Console.WriteLine("\nPress any key to go back");
                        Console.ReadKey();
                        break;

                    case 3:
                        Console.ForegroundColor = ConsoleColor.DarkBlue;
                        Console.WriteLine("\t\t\tEnter Account number to which you want to transfer money");
                        Console.SetCursorPosition(Console.CursorLeft + 60, Console.CursorTop);

                        string toaccount = (Console.ReadLine());
                        Console.WriteLine("\t 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);

                        Console.WriteLine("\nPress any key to go back");
                        Console.ReadKey();
                        break;

                    case 4:
                        double interest = bi.b_ViewInterest(accountno);
                        Console.WriteLine("\n\t\t\tInterest Amount " + interest);
                        if (interest > 0)
                        {
                            Console.ForegroundColor = ConsoleColor.DarkBlue;
                            Console.WriteLine("\n\t What do you want to do with the interest amount\n");
                            Console.WriteLine("\t  1. Withdraw \n\t  2. Add to Account Balance \n\t  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("\t Interest Amount Withdrawn \n\t  Interest Balance: 0.00 \n\t Available Balance : " + bal4);

                                Console.WriteLine("\nPress any key to go back");
                                Console.ReadKey();
                                break;

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

                            case 3:
                                break;

                            default:
                                break;
                            }
                        }
                        else
                        {
                            Console.WriteLine("\nPress any key to go back");
                            Console.ReadKey();
                        }
                        break;

                    case 5:
                        double balance = bmt.b_availablebalance(accountno);
                        Console.ForegroundColor = ConsoleColor.DarkGreen;
                        Console.WriteLine("\n\t\t\tAvailable Balance :" + balance);
                        Console.ForegroundColor = ConsoleColor.Black;

                        Console.WriteLine("\nPress any key to go back");
                        Console.ReadKey();
                        break;

                    case 6:
passlabel:
                        Console.ForegroundColor = ConsoleColor.DarkBlue;
                        Console.WriteLine("\n\t\t\tEnter New Password");
                        Console.SetCursorPosition(Console.CursorLeft + 24, Console.CursorTop);
                        Console.ForegroundColor = ConsoleColor.Black;
                        string newpassword = (Console.ReadLine());

                        try
                        {
                            if (newpassword.Length < 6)
                            {
                                throw new DataEntryException("password length should be greater than 5");
                            }
                        }
                        catch (DataEntryException e)
                        {
                            Console.ForegroundColor = ConsoleColor.DarkRed;
                            Console.WriteLine(e.Message);
                            Console.Beep();
                            goto passlabel;
                        }
                        catch (Exception e)
                        {
                            Console.WriteLine(e.Message);
                            Console.Beep();
                            goto passlabel;
                        }
                        bmt.b_updatePassword(newpassword, accountno);
                        Console.WriteLine("\n\t Password Updated \n\t New Password : "******"\nPress any key to go back");
                        Console.ReadKey();
                        break;

                    case 7:
                        flag = false;
                        break;

                    default:
                        break;
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.Message);
                }

                // Console.WriteLine("\nPress any key to go back");
                // Console.ReadKey();
            }
        }