public static void ListGames() { HeaderMenu.Show(); Console.WriteLine("You are at: > Games > List all games"); Console.WriteLine(""); Console.WriteLine($"╔{new string('═', 109)}╗"); Console.WriteLine($"║ GAMES LIST{new string(' ', 98)}║"); Console.WriteLine($"╠═{new string('═', 3)}═╦═{new string('═', 20)}═╦═{new string('═', 40)}═╦═{new string('═', 10)}═╦═{new string('═', 10)}═╦═{new string('═', 9)}═╣"); Console.WriteLine($"║ {"ID",-3} ║ {"Category",-20} ║ {"Title",-40} ║ {"Console",-10} ║ {"Stock qty.",-10} ║ {"Price",-9} ║"); Console.WriteLine($"╠═{new string('═', 3)}═╬═{new string('═', 20)}═╬═{new string('═', 40)}═╬═{new string('═', 10)}═╬═{new string('═', 10)}═╬═{new string('═', 9)}═╣"); foreach (var game in GamesRepository.List()) { Console.WriteLine($"║ {game.ID,3} ║ {game.Category,-20} ║ {game.Title,-40} ║ {game.Console,-10} ║ {game.StockQuantity,10} ║ {game.Price,9:N2} ║"); } Console.WriteLine($"╚═{new string('═', 3)}═╩═{new string('═', 20)}═╩═{new string('═', 40)}═╩═{new string('═', 10)}═╩═{new string('═', 10)}═╩═{new string('═', 9)}═╝"); Console.WriteLine(""); Console.WriteLine("Press any key to return to games main menu..."); Console.ReadKey(); //Show(); }
public static void AddGame() { HeaderMenu.Show(); Console.WriteLine("You are at: > Games > New game"); Console.WriteLine(""); Game game = new Game(); Console.WriteLine("Input product title: "); game.Title = Console.ReadLine(); Console.Write("Input product price: "); game.Price = Convert.ToDecimal(Console.ReadLine()); GamesRepository.Insert(game); Console.WriteLine(""); Console.WriteLine("Product inserted successfully!"); Console.WriteLine(""); Console.WriteLine("Press any key to return to games main menu..."); Console.ReadKey(); //Show(); }
public static void Show() { int selection = 0; bool invalidSelection = false; do { HeaderMenu.Show(); Console.WriteLine("You are at: > Games"); Console.WriteLine(""); Console.WriteLine("GAMES"); if (invalidSelection) { Console.WriteLine(""); Console.WriteLine("!INVALID SELECTION!"); Console.WriteLine(""); } Console.WriteLine(""); Console.WriteLine("1) List all games"); Console.WriteLine("2) Add new game"); Console.WriteLine("3) Update existing game"); Console.WriteLine("4) Delete game"); Console.WriteLine("0) Return to main menu"); Console.WriteLine(""); Console.Write("Please, input your selection: "); selection = Convert.ToInt32(Console.ReadLine()); invalidSelection = false; switch (selection) { case 1: ListGames(); break; case 2: AddGame(); break; case 3: UpdateGame(); break; case 4: DeleteGame(); break; case 0: //MainMenu.Show(); break; default: invalidSelection = true; break; } }while (selection != 0); }
public static void DeleteMagazine() { HeaderMenu.Show(); Console.WriteLine("You are at: > Magazines > Delete magazines."); Console.WriteLine(""); Console.Write("Type the ID of the magazine you want to delete:"); int id = Convert.ToInt32(Console.ReadLine()); Magazine magazine = MagazinesRepository.Find(id); if (magazine != null) { Console.WriteLine($"You have selected: {magazine.Title}"); Console.WriteLine(""); MagazinesRepository.Delete(magazine); Console.WriteLine(""); Console.WriteLine("Magazine deleted successfully!"); Console.WriteLine(""); Console.WriteLine("Press any key to return."); Console.ReadKey(); } else { Console.WriteLine("Error. Invalid ID."); Console.WriteLine("Press any key to return."); Console.ReadKey(); return; } }
public static void AddBook() { HeaderMenu.Show(); Console.WriteLine("You are at: > Books > Add new book."); Console.WriteLine(""); Book book = new Book(); Console.WriteLine("Type the title of the book you want to add."); book.Title = Console.ReadLine(); Console.WriteLine("Type the price of the book you want to add."); book.Price = Convert.ToDecimal(Console.ReadLine()); BooksRepository.Insert(book); Console.WriteLine(""); Console.WriteLine("Book inserted successfully!"); Console.WriteLine(""); Console.WriteLine("Press any key to return."); Console.ReadKey(); }
static void Main(string[] args) { HeaderMenu.Show(); Console.WriteLine("Seja bem vindo!"); MainMenu.Show(); }
public static void UpdateBook() { HeaderMenu.Show(); Console.WriteLine("You are at: > Books > Update book."); Console.WriteLine(""); Console.Write("Type the ID of the book you want to update:"); int id = Convert.ToInt32(Console.ReadLine()); Book book = BooksRepository.Find(id); if (book != null) { Console.WriteLine($"You have selected: {book.Title}"); Console.WriteLine(""); Console.Write("Type the new title of the book you want to update:"); book.Title = Console.ReadLine(); Console.WriteLine(""); Console.Write("Type the new price of the book you want to update:"); book.Price = Convert.ToDecimal(Console.ReadLine()); Console.WriteLine(""); BooksRepository.Update(book); Console.WriteLine(""); Console.WriteLine("Book updated successfully!"); Console.WriteLine(""); Console.WriteLine("Press any key to return."); Console.ReadKey(); } else { Console.WriteLine("Error. Invalid ID."); Console.WriteLine("Press any key to return."); Console.ReadKey(); return; } }
public static void UpdateGame() { HeaderMenu.Show(); Console.WriteLine("You are at: > Games > Update games."); Console.WriteLine(""); Console.Write("Type the ID of the game you want to update:"); int id = Convert.ToInt32(Console.ReadLine()); Game game = GamesRepository.Find(id); if (game != null) { Console.WriteLine($"You have selected: {game.Title}"); Console.WriteLine(""); Console.Write("Type the new title of the game you want to update:"); game.Title = Console.ReadLine(); Console.WriteLine(""); Console.Write("Type the new price of the game you want to update:"); game.Price = Convert.ToDecimal(Console.ReadLine()); Console.WriteLine(""); GamesRepository.Update(game); Console.WriteLine(""); Console.WriteLine("Game updated successfully!"); Console.WriteLine(""); Console.WriteLine("Press any key to return."); Console.ReadKey(); } else { Console.WriteLine("Error. Invalid ID."); Console.WriteLine("Press any key to return."); Console.ReadKey(); return; } }
public static void AddMagazine() { HeaderMenu.Show(); Console.WriteLine("You are at: > Magazines > Add new Magazine."); Console.WriteLine(""); Magazine magazine = new Magazine(); Console.Write("Insert magazine title:"); magazine.Title = Console.ReadLine(); Console.Write("Insert magazine price:"); magazine.Price = Convert.ToDecimal(Console.ReadLine()); MagazinesRepository.Insert(magazine); Console.WriteLine(""); Console.WriteLine("Magazine inserted successfully!"); Console.WriteLine(""); Console.WriteLine("Press any key to return."); Console.ReadKey(); }
public static void ListBooks() { HeaderMenu.Show(); Console.WriteLine("You are at: > Books > List all books"); Console.WriteLine(""); Console.WriteLine($"╔{new string('═', 109)}╗"); Console.WriteLine($"║ BOOKS LIST{new string(' ', 98)}║"); Console.WriteLine($"╠═{new string('═', 3)}═╦═{new string('═', 20)}═╦═{new string('═', 40)}═╦═{new string('═', 10)}═╦═{new string('═', 10)}═╦═{new string('═', 9)}═╣"); Console.WriteLine($"║ {"ID",-3} ║ {"Category",-20} ║ {"Title",-40} ║ {"Publisher",-10} ║ {"Stock qty.",-10} ║ {"Price",-9} ║"); Console.WriteLine($"╠═{new string('═', 3)}═╬═{new string('═', 20)}═╬═{new string('═', 40)}═╬═{new string('═', 10)}═╬═{new string('═', 10)}═╬═{new string('═', 9)}═╣"); foreach (var book in BooksRepository.List()) { Console.WriteLine($"║ {book.ID,3} ║ {book.Category,-20} ║ {book.Title,-40} ║ {book.Publisher,-10} ║ {book.StockQuantity,10} ║ {book.Price,9:N2} ║"); } Console.WriteLine($"╚═{new string('═', 3)}═╩═{new string('═', 20)}═╩═{new string('═', 40)}═╩═{new string('═', 10)}═╩═{new string('═', 10)}═╩═{new string('═', 9)}═╝"); Console.WriteLine(""); Console.WriteLine("Press any key to return to books main menu..."); Console.ReadKey(); Show(); }
public static void ListMagazine() { HeaderMenu.Show(); Console.WriteLine("You are at: > Magazines > List all magazines"); Console.WriteLine(""); Console.WriteLine($"╔{new string('═', 109)}╗"); Console.WriteLine($"║ MAGAZINES LIST{new string(' ', 94)}║"); Console.WriteLine($"╠═{new string('═', 3)}═╦═{new string('═', 20)}═╦═{new string('═', 40)}═╦═{new string('═', 10)}═╦═{new string('═', 10)}═╦═{new string('═', 9)}═╣"); Console.WriteLine($"║ {"ID",-3} ║ {"Category",-20} ║ {"Title",-40} ║ {"Publisher",-10} ║ {"Stock qty.",-10} ║ {"Price",-9} ║"); Console.WriteLine($"╠═{new string('═', 3)}═╬═{new string('═', 20)}═╬═{new string('═', 40)}═╬═{new string('═', 10)}═╬═{new string('═', 10)}═╬═{new string('═', 9)}═╣"); foreach (var magazine in MagazinesRepository.List()) { Console.WriteLine($"║ {magazine.ID,3} ║ {magazine.Category,-20} ║ {magazine.Title,-40} ║ {magazine.Publisher,-10} ║ {magazine.StockQuantity,10} ║ {magazine.Price,9:N2} ║"); } Console.WriteLine($"╚═{new string('═', 3)}═╩═{new string('═', 20)}═╩═{new string('═', 40)}═╩═{new string('═', 10)}═╩═{new string('═', 10)}═╩═{new string('═', 9)}═╝"); Console.WriteLine(""); Console.WriteLine("Press any key to return to magazines main menu..."); Console.ReadKey(); Show(); }
private void ConsultarCodigoButton_Click(object sender, EventArgs e) { HeaderMenu.Show(ConsultarCodigoButton, new System.Drawing.Point(0, 20)); }