public static void MainMenu() { var menuString = $@" 1. Register New Customer 2. Get Customer 3. Get Customers "; var menuString2 = $@" 4. Rent Movie 5. Return Movie 6. Add Movie 7. Get Movies 8. EXIT "; ConsoleWrite.Heading("START MENU"); Console.WriteLine(Environment.NewLine); ConsoleWrite.Heading("Customer Section"); Console.WriteLine(menuString); ConsoleWrite.Heading("Movie Section"); Console.WriteLine(menuString2); }
private void GetMovies() { ConsoleWrite.Heading("MOVIES in stock"); Console.WriteLine("##########################################" + Environment.NewLine); var nr = 1; foreach (var movie in _videoStore.Movies) { Console.WriteLine("*" + nr + " Title: " + movie.Title + " - Genre: " + movie.Genre); nr++; } Console.WriteLine(Environment.NewLine + "##########################################"); }
private void RegisterCustomer() { var flag = true; var name = ""; var ssn = ""; while (flag) { var menuString1 = $@" EnterName: "; ConsoleWrite.Heading("REGISTER NEW CUSTOMER. Enter EXIT to Abort."); Console.WriteLine(menuString1); name = Console.ReadLine(); if (Abort(name)) { return; } Console.WriteLine("Enter SocialSecurityNumber: (YYY-MM-DD)"); ssn = Console.ReadLine(); if (Abort(ssn)) { return; } try { _videoStore.RegisterCustomer(ssn, name); flag = false; } catch (InvalidSocialSecurityNumberExeption ex) { Console.Clear(); ConsoleWrite.Error(ex.Message.ToString()); } catch (NameNullOrEmptyExeption ex) { Console.Clear(); ConsoleWrite.Error(ex.Message.ToString()); } catch (CustomerExistsExeption ex) { Console.Clear(); ConsoleWrite.Error(ex.Message.ToString()); } } Console.Clear(); ConsoleWrite.Success("Registration Succeded! Name: " + name + ". SocialSecurityNumber: " + ssn); }
private void GetCustomer() { ConsoleWrite.Heading("GET CUSTOMER. enter Exit to abort." + Environment.NewLine); Console.WriteLine("Enter SocialSecurityNumber:"); var ssn = ""; List <Rental> rentals = new List <Rental>(); Customer customer = new Customer(); if (Abort(ssn = Console.ReadLine())) { Console.Clear(); return; } try { rentals = _rentals.GetRentalsFor(ssn); } catch (Exception ex) { Console.Clear(); ConsoleWrite.Error(ex.Message.ToString()); } try { customer = (_videoStore.GetCustomers()).FirstOrDefault(x => x.SSN == ssn); } catch (Exception ex) { Console.Clear(); ConsoleWrite.Error(ex.Message.ToString()); } Console.WriteLine("* Name: " + customer.Name + " - SocialSecurityNumber: " + customer.SSN); Console.WriteLine("Rentals:"); if (rentals.Count == 0) { Console.WriteLine("No rentals"); } else { foreach (var rent in rentals) { Console.WriteLine("Title: " + rent._movieTitle + "Shud be returned before: " + rent._dueDate); if (rent.IsLate()) { ConsoleWrite.Error("MOVIE IS LATE!"); } } } }
private void GetCustomers() { ConsoleWrite.Heading("CUSTOMERS in register"); Console.WriteLine("##########################################" + Environment.NewLine); var nr = 1; var customers = _videoStore.GetCustomers(); foreach (var customer in customers) { Console.WriteLine("*" + nr + " Name: " + customer.Name + " - SocialSecurityNumber: " + customer.SSN); nr++; } if (customers.Count == 0) { Console.WriteLine("Registry is Empty."); } Console.WriteLine(Environment.NewLine + "##########################################"); }