/// <summary> /// Admin Function /// </summary> public void AdminMenu() { choiceCheckAdmin: Console.WriteLine("********Admin Menu********"); Console.WriteLine("1----Create New Account\n2----Delete Existing Account\n3----Update Account Information\n4----Search for Account\n5----View Reports\n6---Exit"); Console.WriteLine("\nPlease choose any option from 1-6"); int Adminchoice; try { Adminchoice = System.Convert.ToInt32(Console.ReadLine()); } catch (Exception) { Console.WriteLine("Please enter valid choice.\n"); goto choiceCheckAdmin; } if (Adminchoice == 1) { cash.createNewUser(); char c; enterAgain: Console.WriteLine("Do you want to do any other operation (y/n)"); try { c = System.Convert.ToChar(Console.ReadLine()); } catch (Exception) { Console.WriteLine("\nPlease select right option (y/n)? \n"); goto enterAgain; } if (c.Equals('y') || c.Equals('Y')) { goto choiceCheckAdmin; } else if (c.Equals('n') || c.Equals('N')) { Console.Clear(); Console.WriteLine("/////////////////////////////////////////\n Welcome to ATM Managment System \n/////////////////////////////////////////\n"); AdminUserView v = new AdminUserView(); v.ChooseAdminUser(); } else { Console.WriteLine("Please enter right choice (y/n)? "); goto enterAgain; } } if (Adminchoice == 2) { int AccNo = 0; accountNoCheck: Console.Write("Enter the account number you wished to delete!"); try { AccNo = System.Convert.ToInt32(Console.ReadLine()); } catch (Exception) { Console.WriteLine("You have entered invalid Account No. Please enter correct account number\n"); goto accountNoCheck; } if (cash.checkAccountNumber(AccNo) == true) { UserMenuItems u = new UserMenuItems(); u.DeleteAccount(AccNo); char c; enterAgain: Console.WriteLine("Do you want to do any other operation (y/n)"); try { c = System.Convert.ToChar(Console.ReadLine()); } catch (Exception) { Console.WriteLine("\nPlease select right option (y/n)? \n"); goto enterAgain; } if (c.Equals('y') || c.Equals('Y')) { goto choiceCheckAdmin; } else if (c.Equals('n') || c.Equals('N')) { Console.Clear(); Console.WriteLine("/////////////////////////////////////////\n Welcome to ATM Managment System \n/////////////////////////////////////////\n"); AdminUserView v = new AdminUserView(); v.ChooseAdminUser(); } else { Console.WriteLine("Please enter right choice (y/n)? "); goto enterAgain; } } else { char c; enterAgainChoice: Console.WriteLine("Account No. does not exists\nDo you want to enter again(y/n) ?"); try { c = System.Convert.ToChar(Console.ReadLine()); } catch (Exception) { Console.WriteLine("\nPlease select right option (y/n)? \n"); goto enterAgainChoice; } if (c.Equals('y') || c.Equals('Y')) { goto accountNoCheck; } else if (c.Equals('n') || c.Equals('N')) { goto choiceCheckAdmin; } else { Console.WriteLine("Please enter right choice (y/n)? "); goto enterAgainChoice; } } } if (Adminchoice == 3) { int AccNo; accountNoCheck: Console.Write("Enter the account number you wished to Update Account Information: "); try { AccNo = System.Convert.ToInt32(Console.ReadLine()); } catch (Exception) { Console.WriteLine("You have entered invalid Account No. Please enter correct account number\n"); goto accountNoCheck; } if (cash.checkAccountNumber(AccNo) == true) { UserMenuItems u = new UserMenuItems(); u.UpdateAccount(AccNo); char c; enterAgain: Console.WriteLine("Do you want to do any other operation (y/n)"); try { c = System.Convert.ToChar(Console.ReadLine()); } catch (Exception) { Console.WriteLine("\nPlease select right option (y/n)? \n"); goto enterAgain; } if (c.Equals('y') || c.Equals('Y')) { goto choiceCheckAdmin; } else if (c.Equals('n') || c.Equals('N')) { Console.Clear(); Console.WriteLine("/////////////////////////////////////////\n Welcome to ATM Managment System \n/////////////////////////////////////////\n"); AdminUserView v = new AdminUserView(); v.ChooseAdminUser(); } else { Console.WriteLine("Please enter right choice (y/n)? "); goto enterAgain; } } ////// else { Console.WriteLine("Acount No.does not exists\n"); choiceCheck: Console.WriteLine("\n Do your want to enter again (y/n) ? \n"); char c; try { c = System.Convert.ToChar(Console.ReadLine()); } catch (Exception) { Console.WriteLine("Please enter right choice (y/n) ?"); goto choiceCheck; } if (c.Equals('y') | c.Equals('Y')) { goto accountNoCheck; } else if (c.Equals('n') | c.Equals('N')) { goto choiceCheckAdmin; } else { Console.WriteLine("Please enter right choice (y/n) ?"); goto choiceCheck; } } /// } if (Adminchoice == 4) { UserObj obj = new UserObj(); Console.WriteLine($"Please enter in the field you wish to update(leave blank otherwise)\n"); againEnterID: Console.Write("Account ID: "); string AccId = Console.ReadLine(); if (AccId.ToString().Length > 0) { try { obj.UserID = System.Convert.ToInt32(AccId); } catch (Exception) { Console.Write("please enter integer value or keep it empty\n"); goto againEnterID; } } Console.Write("\nUser ID: "); string logIn = Console.ReadLine(); if (logIn.Length > 0) { obj.ID = logIn; } Console.Write("\nHolder's Name: "); string name = Console.ReadLine(); if (name.Length > 0) { obj.name = name; } againEnterType: Console.Write("\nType (Savings Current): "); string type = Console.ReadLine(); if (type.Length > 0) { if (type.Equals("current") || type.Equals("saving")) { obj.type = type; } else { Console.Write("\nplease enter right choice (current/saving)\n"); goto againEnterType; } } againEnter: Console.Write("\nBalance: "); string balance = Console.ReadLine(); if (balance.ToString().Length > 0) { try { obj.cash = System.Convert.ToInt32(balance); } catch (Exception) { Console.Write("please enter integer value or keep it empty\n"); goto againEnter; } } againEnterStatus: Console.Write("\nStatus(active/deactive): "); string status = Console.ReadLine(); if (status.Length > 0) { if (status.Equals("active") || status.Equals("deactive")) { obj.status = status; } else { Console.Write("\nplease enter right choice (active/deactive)\n"); goto againEnterStatus; } } cash.searchForAccount(obj, AccId, name, type, balance, status); char c; enterAgain: Console.WriteLine("Do you want to do any other operation (y/n)"); try { c = System.Convert.ToChar(Console.ReadLine()); } catch (Exception) { Console.WriteLine("\nPlease select right option (y/n)? \n"); goto enterAgain; } if (c.Equals('y') || c.Equals('Y')) { goto choiceCheckAdmin; } else if (c.Equals('n') || c.Equals('N')) { Console.Clear(); Console.WriteLine("/////////////////////////////////////////\n Welcome to ATM Managment System \n/////////////////////////////////////////\n"); AdminUserView v = new AdminUserView(); v.ChooseAdminUser(); } else { Console.WriteLine("Please enter right choice (y/n)? "); goto enterAgain; } } if (Adminchoice == 5) { int choose; choiceCheck: Console.WriteLine("1---Accounts By Amount\n2---Accounts By Date"); try { choose = System.Convert.ToInt32(Console.ReadLine()); } catch (Exception) { Console.WriteLine("You have entered invalid Account No. Please enter correct account number\n"); goto choiceCheck; } if (choose == 1) { maxAmountCheck: Console.WriteLine("Enter the maximum amount: "); int maxAmount = 0; try { maxAmount = System.Convert.ToInt32(Console.ReadLine()); } catch (Exception) { Console.WriteLine("You have entered invalid value. Please enter correct amount\n"); goto maxAmountCheck; } minAmountCheck: Console.WriteLine("Enter the minimum amount: "); int minAmount = 0; try { minAmount = System.Convert.ToInt32(Console.ReadLine()); } catch (Exception) { Console.WriteLine("You have entered invalid value. Please enter correct amount\n"); goto minAmountCheck; } UserMenuItems u = new UserMenuItems(); u.AccountsByAmount(maxAmount, minAmount); } if (choose == 2) { startDateCheck: Console.WriteLine("Enter the starting date: "); string startDate; try { startDate = Console.ReadLine(); } catch { Console.WriteLine("You have entered invalid date. Please enter correct date (dd/MM/yy)\n"); goto startDateCheck; } endDateCheck: Console.WriteLine("Enter the ending date: "); string endDate; try { endDate = Console.ReadLine(); } catch { Console.WriteLine("You have entered invalid date. Please enter correct date (dd/MM/yy)\n"); goto endDateCheck; } cash.AccountsByDate(startDate, endDate); } char c; enterAgain: Console.WriteLine("Do you want to do any other operation (y/n)"); try { c = System.Convert.ToChar(Console.ReadLine()); } catch (Exception) { Console.WriteLine("\nPlease select right option (y/n)? \n"); goto enterAgain; } if (c.Equals('y') || c.Equals('Y')) { goto choiceCheckAdmin; } else if (c.Equals('n') || c.Equals('N')) { Console.Clear(); Console.WriteLine("/////////////////////////////////////////\n Welcome to ATM Managment System \n/////////////////////////////////////////\n"); AdminUserView v = new AdminUserView(); v.ChooseAdminUser(); } else { Console.WriteLine("Please enter right choice (y/n)? "); goto enterAgain; } } if (Adminchoice == 6) { Console.Clear(); Console.WriteLine("/////////////////////////////////////////\n Welcome to ATM Managment System \n/////////////////////////////////////////\n"); AdminUserView v = new AdminUserView(); v.ChooseAdminUser(); } else { Console.WriteLine("\nPlease choose right option (1-6)\n"); goto choiceCheckAdmin; } }
public MenuView() { cash = new UserMenuItems(); }