コード例 #1
0
        public bool TryAirlineLogin(string username, string password, out LoginToken <AirlineCompany> token)
        {
            _airlineDAO = new AirlineDAOMSSQL();
            AirlineCompany company = _airlineDAO.GetAirLineByUserName(username);

            if (company != null)
            {
                if (company.Password == password)
                {
                    token = new LoginToken <AirlineCompany>()
                    {
                        User = company
                    };
                    return(true);
                }
            }
            else
            {
                try
                {
                    if (company == null)
                    {
                        token = null;
                        return(false);
                    }
                }
                catch (WrongPasswordException)
                {
                    token = new LoginToken <AirlineCompany>()
                    {
                        User = company
                    };
                    return(false);

                    throw new WrongPasswordException("Your Password is not correct, Try again");
                }
            }
            token = null;

            return(false);
        }