Exemple #1
0
 private void Login()
 {
     Console.WriteLine("----------Login--------");
     Console.Write("Enter the User Name : ");
     Name = Console.ReadLine();
     Console.Write("Enter the Password : ");
     Password = FlightAdmin.ReadPassword();
     CheckUserCredentials(Name, Password);
 }
Exemple #2
0
        private void SingUp()
        {
            try
            {
                Console.WriteLine("------New Passenger-----");
                Console.Write("Enter PassengerName : ");
                passenger.PassengerName = Console.ReadLine();
                //string name = passenger.PassengerName;
                while (Validator.UserNameValidator(passenger.PassengerName))
                {
                    Console.WriteLine("Invalid name");
                    passenger.PassengerName = Console.ReadLine();
                }

                Console.Write("Enter Mail ID : ");
                passenger.EmailId = Console.ReadLine();
                while (Validator.EmailIdValidator(passenger.EmailId))
                {
                    Console.WriteLine("Invalid mail ID");
                    passenger.EmailId = Console.ReadLine();
                }

                Console.Write("Enter the Age : ");
                bool status = byte.TryParse(Console.ReadLine(), out byte age);
                if (status)
                {
                    passenger.Age = age;
                }
                else
                {
                    Console.WriteLine("Not an valid age!!");
                    passenger.Age = byte.Parse(Console.ReadLine());
                }

                Console.Write("Enter the gender(m/f) : ");
                status = char.TryParse(Console.ReadLine(), out char gender);
                if (status)
                {
                    passenger.Gender = gender;
                }
                else
                {
                    Console.WriteLine("Not an valid gender!!");
                    passenger.Gender = char.Parse(Console.ReadLine());
                }
                Console.Write("Enter the password : "******"Your password is invalid ....Password must contain one capital letter,one small letter,one special character and a digit");
                    passenger.Password = FlightAdmin.ReadPassword();
                    //password = passenger.Password;
                }

                Console.Write("Enter the phone number : ");
                passenger.PhoneNo = Console.ReadLine();
                while (Validator.PhoneNumberValidator(passenger.PhoneNo))
                {
                    Console.WriteLine("Your phonenumber is invalid....");
                    passenger.PhoneNo = Console.ReadLine();
                }
                //foreach (var passengerCollection in PassengerCollection.passengerList)
                //{
                //if (!(passengerCollection.Value.PassengerName == Name && passengerCollection.Value.Password == Password))
                PassengerCollection.passengerList.Add(++Id, new Passenger(passenger.PassengerName, passenger.EmailId, passenger.Age, passenger.Gender, passenger.Password, passenger.PhoneNo));
                //else
                //    Console.WriteLine("Passenger already exist!!!");
                //    }
            }
            catch (FormatException exception)
            {
                Console.WriteLine("Please enter valid Format", exception.Message);
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception.Message);
            }
        }