public userPresentation(BLAccountCreation ba, BLMoneyTransaction bmt, BLInterestCalculation bi) { this.ba = ba; this.bmt = bmt; this.bi = bi; }
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; } } }
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; }