Beispiel #1
0
 /// <summary>
 /// Print the first menu the standard user sees after login
 /// </summary>
 public static void PrintBuyMenuOptions()
 {
     Console.Clear();
     SharedView.PrintWithGreenText($"\tVälkommen till bokshoppen");
     Console.WriteLine("\t1. Köp böcker");
     Console.WriteLine("\tX. Logga ut");
 }
Beispiel #2
0
        /// <summary>
        /// prints options for adding a book and asks the user for input,
        /// returning those options to controller for managing the book creation.
        /// </summary>
        /// <returns>returns a dictionary with neccessary things for creating a book</returns>
        internal static Dictionary <string, string> AddBook()
        {
            SharedView.PrintWithDarkGreyText("Lägg till en bok");
            var bookInformation = AskForInputToCreateBook();

            return(bookInformation);
        }
Beispiel #3
0
 /// <summary>
 /// Prints the admin functions
 /// </summary>
 public static void PrintAdminFunctions()
 {
     Console.Clear();
     SharedView.PrintWithDarkGreyText("Administratorfunktioner\n");
     Console.WriteLine();
     SharedView.PrintWithDarkGreyText($"Användaralternativ");
     Console.WriteLine($"\t1. Lägg till användare");
     Console.WriteLine($"\t2. Lista alla användare");
     Console.WriteLine($"\t3. Sök en användare");
     Console.WriteLine();
     SharedView.PrintWithDarkGreyText($"Bokmeny - Admin");
     Console.WriteLine($"\t4. Lägg till en bok");
     Console.WriteLine($"\t5. Ta bort en bok");
     Console.WriteLine($"\t6. Sök efter en bok");
     Console.WriteLine($"\t7. Lista alla böcker");
     Console.WriteLine();
     SharedView.PrintWithDarkGreyText($"Kategorihantering - Admin");
     Console.WriteLine($"\t8. Lägg till en kategori");
     Console.WriteLine($"\t9. Ta bort en kategori");
     Console.WriteLine($"\t10. Uppdatera en kategori");
     Console.WriteLine();
     SharedView.PrintWithDarkGreyText($"Statistik - Admin");
     Console.WriteLine($"\t11. Sålda böcker");
     Console.WriteLine($"\t12. Intjänade kronor");
     Console.WriteLine($"\t13. Bästa kunden");
     Console.WriteLine();
     Console.WriteLine($"\tX. Backa ett steg");
 }
Beispiel #4
0
 /// <summary>
 /// Prints out that the user has entered wrong credentials
 /// </summary>
 /// <param name="user">takes a user to check if it is null</param>
 public static void PrintWrongCredentials(User user)
 {
     if (user == null)
     {
         SharedView.PrintWithRedText("\tFelaktigt användarnamn eller lösenord.");
         GeneralViewHelper.WaitAndClearScreen();
     }
 }
Beispiel #5
0
 /// <summary>
 /// Print the main menu option when admin logs in.
 /// </summary>
 public static void Print()
 {
     Console.Clear();
     SharedView.PrintWithDarkGreyText("Administratoralternativ");
     Console.WriteLine("\t1. Adminfunktioner");
     Console.WriteLine("\t2. Handla böcker");
     Console.WriteLine("\tX. Logga ut");
 }
Beispiel #6
0
        /// <summary>
        /// Prints a list with books
        /// </summary>
        /// <param name="listWithBooks">takes a list with books to print</param>
        internal static void ListAllBooks(List <Book> listWithBooks)
        {
            SharedView.PrintWithDarkGreyText("Lista med alla böcker som matchar");

            for (int i = 0; i < listWithBooks.Count; i++)
            {
                Console.WriteLine($"\t{i + 1}. {listWithBooks[i].Title} av författaren {listWithBooks[i].Author}");
            }
        }
Beispiel #7
0
 /// <summary>
 /// Prints out menu for buying a book
 /// </summary>
 internal static void BuyBook()
 {
     SharedView.PrintWithDarkGreyText("Köp en bok");
     Console.WriteLine("\tLeta reda på boken du vill köpa på följande sätt");
     Console.WriteLine("\t1. Sök efter bok (nyckelord)");
     Console.WriteLine("\t2. Sök efter författare");
     Console.WriteLine("\t3. Sök efter kategori");
     Console.WriteLine("\t4. Lista samtliga kategorier");
     Console.WriteLine("\tX. Backa ett steg");
 }
Beispiel #8
0
        /// <summary>
        /// Asks user for username and password, and returns this
        /// </summary>
        /// <returns>Username and password for creating a user</returns>
        internal static (string userName, string password) AddUser()
        {
            Console.Clear();
            SharedView.PrintWithDarkGreyText("Lägg till en användare");
            Console.Write("\tAnge användarnamn >");
            var userName = Console.ReadLine();

            Console.Write("\tAnge lösenord >");
            var password = Console.ReadLine();

            return(userName, password);
        }
Beispiel #9
0
        /// <summary>
        /// Print info and options for showing info about the book
        /// </summary>
        /// <param name="book"></param>
        internal static void ShowInfoAboutBook(Book book)
        {
            SharedView.PrintWithDarkGreyText("Information om bok");
            Console.WriteLine($"\tBoktitel: {book.Title}");
            Console.WriteLine($"\tFörfattare: {book.Author}");
            Console.WriteLine($"\tKategori: {book.Category.Name}");
            Console.WriteLine($"\tPris: {book.Price}");
            Console.WriteLine($"\tAntal tillgängliga böcker: {book.Amount}");

            Console.WriteLine();
            Console.Write("\tVill du köpa boken? j/n >");
        }
Beispiel #10
0
        /// <summary>
        /// Prints the register page and takes a input and returns this
        /// </summary>
        /// <returns>returns information for registering a user</returns>
        public static (string username, string password, string verifyPassword) Register()
        {
            Console.Clear();
            SharedView.PrintWithDarkGreyText("Registrera ett konto");
            Console.Write("\tAnge användarnamn> ");
            var username = Console.ReadLine();

            Console.Write("\tAnge lösenord> ");
            var password = Console.ReadLine();

            Console.Write("\tVerifiera lösenord> ");
            var verifiedPassword = Console.ReadLine();

            return(username, password, verifiedPassword);
        }
Beispiel #11
0
        /// <summary>
        /// Prints loginpage and takes input
        /// </summary>
        /// <returns>Returns username and password</returns>
        public static (string userName, string password) PrintLoginPage()
        {
            SharedView.PrintWithDarkGreyText("Logga in\n");
            Console.WriteLine("\tAvbryt när som helst genom att trycka x+enter");
            Console.Write("\tAnvändarnamn> ");
            var userName = Console.ReadLine();

            if (userName.ToLower() == "x")
            {
                return(userName.ToLower(), string.Empty);
            }
            Console.Write("\tLösenord> ");
            var password = Console.ReadLine();

            if (password.ToLower() == "x")
            {
                return(string.Empty, password.ToLower());
            }
            return(userName, password);
        }
Beispiel #12
0
 /// <summary>
 /// Print out that there are still books in the book category
 /// and also says how many books there are
 /// </summary>
 /// <param name="books">takes a integer with books still left in the category</param>
 internal static void BooksStillInCategory(int books)
 {
     SharedView.PrintWithRedText($"\tKan ej ta bort kategori. {books} böcker finns kvar i kategorin");
     Console.WriteLine("\tTryck enter för att fortsätta");
     Console.ReadKey();
 }
Beispiel #13
0
 /// <summary>
 /// Prints options for searching a book
 /// </summary>
 internal static void SearchForBook()
 {
     SharedView.PrintWithDarkGreyText("Sök efter en bok - X + enter för att avbryta");
     Console.Write("\tSök >");
 }
Beispiel #14
0
 /// <summary>
 /// Prints options for searching a category
 /// </summary>
 internal static void SearchForCategory()
 {
     Console.Clear();
     SharedView.PrintWithDarkGreyText("Sök efter en kategori");
     Console.Write("\tSökord >");
 }
Beispiel #15
0
 /// <summary>
 /// Prints options for add category
 /// </summary>
 internal static void AddCategory()
 {
     SharedView.PrintWithDarkGreyText("Lägg till en kategori.");
     Console.Write("\tAnge den nya kategorins namn >");
 }
Beispiel #16
0
 /// <summary>
 /// Prints options for searching books from a author
 /// </summary>
 internal static void SearchBooksFromAuthor()
 {
     SharedView.PrintWithDarkGreyText("Sök efter författare - X + enter för att avbryta");
     Console.Write("\tSök >");
 }
Beispiel #17
0
 /// <summary>
 /// Prints out that the user has entered wrong menu input
 /// </summary>
 public static void PrintWrongMenuInput()
 {
     SharedView.PrintWithRedText("\tFelaktigt menyval, försök igen.");
     GeneralViewHelper.WaitAndClearScreen();
 }
Beispiel #18
0
 /// <summary>
 /// Prints out failed
 /// </summary>
 public static void Failed()
 {
     SharedView.PrintWithRedText("\tMisslyckades.");
     GeneralViewHelper.WaitAndClearScreen();
 }
Beispiel #19
0
 /// <summary>
 /// Prints out that no change was made
 /// </summary>
 internal static void UnChanged()
 {
     SharedView.PrintWithRedText("\tIngen ändring har gjorts.");
     Thread.Sleep(2000);
 }
Beispiel #20
0
 /// <summary>
 /// Prints out wrong input (not specific a menu)
 /// </summary>
 internal static void PrintWrongInput()
 {
     SharedView.PrintWithRedText("\tFelaktig inmatning");
     Thread.Sleep(2000);
 }
Beispiel #21
0
 /// <summary>
 /// Prints out nothing found
 /// </summary>
 internal static void NothingFound()
 {
     SharedView.PrintWithRedText("\tInget hittades");
     Thread.Sleep(2000);
 }
Beispiel #22
0
 /// <summary>
 /// Prints out that the input was empty
 /// </summary>
 internal static void EmptyInput()
 {
     SharedView.PrintWithRedText("\tTom inmatning, vänligen ange något.");
     Thread.Sleep(2000);
 }
Beispiel #23
0
 /// <summary>
 /// Prints out success!
 /// </summary>
 public static void Success()
 {
     SharedView.PrintWithGreenText("\tLyckades!");
     GeneralViewHelper.WaitAndClearScreen();
 }