Ejemplo n.º 1
0
        //ADMIN COMPLETE SECTION
        private void AdminSection()
        {
            Console.ForegroundColor = ConsoleColor.Cyan;
            Console.WriteLine("Welcome-to-Admin-Section--------------");
            Console.ForegroundColor = ConsoleColor.White;
            bool adminLoop = true;

            while (adminLoop == true)
            {
                try
                {
                    GetAdminMenu();
                    int adminCase = int.Parse(Console.ReadLine());
                    switch (adminCase)
                    {
                    case 1:
                        BookPL bookSection = new BookPL();
                        bookSection.BookSection();
                        break;

                    case 2:
                        UserPL userSection = new UserPL();
                        userSection.UserSection();
                        break;

                    case 3:
                        RequestedSection();
                        break;

                    case 4:
                        RecievedSection();
                        break;

                    case 5:
                        Console.ForegroundColor = ConsoleColor.Green;
                        Console.WriteLine("Logged out successfully..\nTada have a nice day...");
                        Console.ForegroundColor = ConsoleColor.White;
                        adminLoop = false;
                        break;

                    default:
                        Console.ForegroundColor = ConsoleColor.Red;
                        Console.WriteLine("Invalid input!!!");
                        Console.ForegroundColor = ConsoleColor.White;
                        break;
                    }
                }
                catch (FormatException)
                {
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine("Sorry try agian once!!!");
                    Console.ForegroundColor = ConsoleColor.White;
                }
                catch (LibraryMSException)
                {
                    throw new LibraryMSException("Some unknown exception is occured..");
                }
            }
        }
Ejemplo n.º 2
0
        //MAIN PROGRAM
        static void Main(string[] args)
        {
            bool logLoop = true;

            while (logLoop == true)
            {
                try
                {
                    Console.ForegroundColor = ConsoleColor.Cyan;
                    Console.WriteLine("Welcome to ABC Library Management System");
                    Console.ForegroundColor = ConsoleColor.White;
                    Console.WriteLine("1) Press 1 to login as Admin\n" +
                                      "2) Press 2 to login as User\n" +
                                      "3) Press 3 to exit");

                    int logCase = int.Parse(Console.ReadLine());
                    switch (logCase)
                    {
                    case 1:
                        AdminPL adminPL = new AdminPL();
                        adminPL.AdminLogin();
                        break;

                    case 2:
                        UserPL userPL = new UserPL();
                        userPL.UserLogin();
                        break;

                    case 3:
                        logLoop = false;
                        break;

                    default:
                        Console.ForegroundColor = ConsoleColor.Red;
                        Console.WriteLine("Enter a valid input...");
                        Console.ForegroundColor = ConsoleColor.White;
                        break;
                    }
                }
                catch (FormatException)
                {
                    logLoop = true;
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine("Try again...");
                    Console.ForegroundColor = ConsoleColor.White;
                }
                catch (LibraryMSException)
                {
                    throw new LibraryMSException("Some unknown exception is occured..");
                }
            }
        }
Ejemplo n.º 3
0
        //ADMIN RECIEVED BOOK MENU
        private void RecievedSection()
        {
            bool recLoop = true;

            while (recLoop == true)
            {
                try
                {
                    Console.ForegroundColor = ConsoleColor.Cyan;
                    Console.WriteLine("Welcome-to-Accepted-Section--------------");
                    Console.ForegroundColor = ConsoleColor.White;
                    Console.WriteLine("1) Press 1 to show all book accepted\n" +
                                      "2) Press 2 to takeback accepted books\n" +
                                      "3) Press 3 to exit");
                    int recCase = int.Parse(Console.ReadLine());
                    switch (recCase)
                    {
                    case 1:
                        UserPL userPL = new UserPL();
                        userPL.GetRecievedBook();
                        break;

                    case 2:
                        DeleteRecieved();
                        break;

                    case 3:
                        Console.WriteLine();
                        recLoop = false;
                        break;

                    default:
                        Console.ForegroundColor = ConsoleColor.Red;
                        Console.WriteLine("Invalid input!!!");
                        Console.ForegroundColor = ConsoleColor.White;
                        break;
                    }
                }
                catch (FormatException)
                {
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine("Sorry try agian once!!!");
                    Console.ForegroundColor = ConsoleColor.White;
                }
                catch (LibraryMSException)
                {
                    throw new LibraryMSException("Some unknown exception is occured..");
                }
            }
        }