public static User LoginUserMenu(LinkedList <TheTu> ListTheTu) { back: long id; int pin; Console.Clear(); Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("*********************************"); Console.Write("*"); Console.ForegroundColor = ConsoleColor.Green; Console.Write("\tDANG NHAP USER\t"); Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("\t*"); Console.WriteLine("*********************************"); // user Console.ForegroundColor = ConsoleColor.Green; Console.Write("ID:\t"); Console.ResetColor(); long.TryParse(Console.ReadLine(), out id); // pass Console.ForegroundColor = ConsoleColor.Green; Console.Write("Pin:\t"); Console.ResetColor(); int.TryParse(BoTro.HidePass(), out pin); Console.WriteLine(); bool status = false; // checkpass for (LinkedListNode <TheTu> p = ListTheTu.First; p != null; p = p.Next) { if (id == p.Value.Id) { if (p.Value.Locked) { BoTro.Waiting(false, "", "Tai khoan nay da bi khoa!"); break; } else if (p.Value.Wrong < 2) { if (pin == p.Value.Pin) { status = true; BoTro.Waiting(true, "Dang nhap thanh cong!", ""); } else { p.Value.Wrong++; BoTro.Waiting(false, "", "Tai khoan hoac mat khau khong chinh xac!"); } } else { p.Value.Locked = true; TheTu.SaveFile(ListTheTu); BoTro.Waiting(false, "", "Tai khoan bi khoa do nhap sai qua 3 lan!"); Thread.Sleep(1000); } break; } } if (status) { return(User.GetFile(id)); } else { goto back; } }
static void Main(string[] args) { LinkedList <Admin> ListAdmin = Admin.GetFile(); LinkedList <TheTu> ListTheTu = TheTu.GetFile(); mainMenu: switch (Menu.MainMenu()) { case 1: loginAdminMenu: bool adminLogin = Menu.LoginAdminMenu(ListAdmin); adminMenu: if (adminLogin) { switch (Menu.AdminMenu()) { case 1: Admin.RenderAccount(ListTheTu, ""); BoTro.PressKeyToExit(); goto adminMenu; case 2: Admin.CreateAccount(ListTheTu); BoTro.PressKeyToExit(); goto adminMenu; case 3: Admin.XoaTaiKhoan(ListTheTu); BoTro.PressKeyToExit(); goto adminMenu; case 4: Admin.UnLockAccount(ListTheTu); BoTro.PressKeyToExit(); goto adminMenu; default: BoTro.Waiting(true, "Dang Xuat Thanh Cong!", ""); goto mainMenu; } } else { goto loginAdminMenu; } case 2: User userLogin = Menu.LoginUserMenu(ListTheTu); userMenu: switch (Menu.UserMenu()) { case 1: User.ShowInfo(userLogin); BoTro.PressKeyToExit(); goto userMenu; case 2: User.RutTien(userLogin); BoTro.PressKeyToExit(); goto userMenu; case 3: User.ChuyenTien(userLogin); BoTro.PressKeyToExit(); goto userMenu; case 4: User.GiaoDien(userLogin); BoTro.PressKeyToExit(); goto userMenu; case 5: User.DoiMaPin(ListTheTu, userLogin); BoTro.PressKeyToExit(); goto userMenu; default: BoTro.Waiting(true, "Dang Xuat Thanh Cong!", ""); goto mainMenu; } case 3: BoTro.PressKeyToExit(); goto mainMenu; default: break; } }