internal void ViewHomePage()
        {
            bool count = true;

            while (count)
            {
                Console.WriteLine("------------Homepage----------");
                Console.WriteLine("1.Login\n2.SignUp\n3.Search Buses to book ticket\n4.Exit");
                try
                {
                    byte choice = Byte.Parse(Console.ReadLine());
                    switch (choice)
                    {
                    case 1:
                        LoginManager.CheckLogin();

                        break;

                    case 2:
                        UserRepositary.SignUp();

                        break;

                    case 3:

                        BusManager.SearchBus();

                        break;

                    case 4:
                        count = false;
                        break;

                    default:
                        Console.WriteLine("Enter correct number");
                        break;
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                    Console.WriteLine("Enter correct input");
                }
            }
        }
Пример #2
0
        internal static bool PaymentLogin()
        {
            Console.WriteLine("1.Login\n2.Signup");
            byte choice = byte.Parse(Console.ReadLine());

            if (choice == 1)
            {
                LoginManager.CheckLogin();
                return(true);
            }
            else if (choice == 2)
            {
                UserRepositary.SignUp();
                Console.WriteLine("Login to continue");
                LoginManager.CheckLogin();
                return(true);
            }
            else
            {
                Console.WriteLine("Enter correct no");
            }
            return(false);
        }
 internal static void CheckLogin()
 {
     Console.WriteLine("Enter E-mail id");
     username = Console.ReadLine();
     Console.WriteLine("Enter password");
     password = Console.ReadLine();
     if (CheckAdmin(username, password))
     {
         if (session == "finallogin")
         {
             session = "logged";
             Console.WriteLine("Welcome!!! Admin");
         }
         else
         {
             session = "logged";
             Console.WriteLine("Welcome!!! Admin");
             Operation.AdminOperation();
         }
     }
     else if (UserRepositary.Login(username, password))
     {
         if (session == "finallogin")
         {
             session = "logged";
         }
         else
         {
             Console.WriteLine("Welcome User!!");
             BusManager.SearchBus();
         }
     }
     else
     {
         Console.WriteLine("Login Details not found!! SignUp");
     }
 }