public LoginService()
 {
     _adminDAO    = new AdminDAOPGSQL();
     _customerDAO = new CustomerDAOPGSQL();
     _airlineDAO  = new AirlineDAOPGSQL();
     _userDAO     = new UserDAOPGSQL();
 }
 public LoginService()
 {
     _airlineDAO          = new AirlineDAOMSSQL();
     _customerDAO         = new CustomerDAOMSSQL();
     mapTypeLoginFunction = new Dictionary <Type, Func <string, string, ILoginToken> >();
     AddToDictionary();
 }
Exemple #3
0
        public bool TryAirlineLogin(string userName, string password, out LoginToken <AirlineCompany> token)
        {
            if (userName == "AlphaUser" || userName == "BetaUser")
            {
                _airlineDAO = new AirlineDAOMSSQL(true);
            }
            else
            {
                _airlineDAO = new AirlineDAOMSSQL();
            }
            AirlineCompany airlineCompany = _airlineDAO.GetAirlineByUsername(userName);

            if (airlineCompany != null)
            {
                if (airlineCompany.Password == password)
                {
                    token = new LoginToken <AirlineCompany>(airlineCompany);
                    return(true);
                }
                else
                {
                    throw new WrongPasswordException($"failed to login as [{userName}], you entered a wrong password! [{password}]");
                }
            }
            token = null;
            return(false);
        }
        public bool TryAirlineLogin(string userName, string password, out LoginToken <AirlineCompany> token)
        {
            try
            {
                _airlineDAO = new AirLineDAOMSSQL();
                AirlineCompany alc = _airlineDAO.GetAirlineByUserame(userName);
                if (alc == null)
                {
                    token = null;
                    return(false);
                }
                else if (alc.PASSWORD == password)
                {
                    token                = new LoginToken <AirlineCompany>();
                    token.User           = new AirlineCompany();
                    token.User.USER_NAME = userName;
                    token.User.PASSWORD  = password;
                    return(true);
                }
                else if (alc.PASSWORD != password)
                {
                    throw new WrongPasswordException("Wrong password");
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }

            token = null;
            return(false);
        }
 public FacadeBase()
 {
     this._airlineDAO  = new AirlineDAOMSSQL();
     this._countryDAO  = new CountryDAOMSQQL();
     this._customerDAO = new CustomerDAOMSSQL();
     this._flightDAO   = new FlightDAOMSSQL();
     this._ticketDAO   = new TIcketDAOMSSQL();
 }
 public FacadeBase()
 {
     _airlineDAO  = new AirlineDAOMSSQL();
     _countryDAO  = new CountryDAOMSSQL();
     _customerDAO = new CustomerDAOMSSQL();
     _flightDAO   = new FlightDAOMSSQL();
     _ticketDAO   = new TicketDAOMSSQL();
 }
Exemple #7
0
 public FacadeBase(IAirlineDAO airlineDAO, ICountryDAO countryDAO, ICustomerDAO customerDAO, IFlightDAO flightDAO, ITicketDAO ticketDAO, IAdministratorDAO administratorDAO)
 {
     _airlineDAO       = airlineDAO;
     _countryDAO       = countryDAO;
     _customerDAO      = customerDAO;
     _flightDAO        = flightDAO;
     _ticketDAO        = ticketDAO;
     _administratorDAO = administratorDAO;
 }
Exemple #8
0
 protected FacadeBase(bool test)
 {
     _airlineDAO  = new AirlineCompany();
     _countryDAO  = new Country();
     _customerDAO = customerDAO;
     _adminDAO    = adminDAO;
     _user        = user;
     _flightDAO   = flightDAO;
     _ticketDAO   = ticketDAO;
 }
 protected FacadeBase()
 {
     _airlineDAO  = new AirlineDAOPGSQL();
     _countryDAO  = new CountryDAOPGSQL();
     _customerDAO = new CustomerDAOPGSQL();
     _adminDAO    = new AdminDAOPGSQL();
     _userDAO     = new UserDAOPGSQL();
     _flightDAO   = new FlightDAOPGSQL();
     _ticketDAO   = new TicketDAOPGSQL();
     _flightsTicketsHistoryDAO = new FlightsTicketsHistoryDAOPGSQL();
 }
Exemple #10
0
 public FacadeBase()
 {
     _airlineDAO        = new AirlineDAO();
     _countryDAO        = new CountryDAO();
     _customerDAO       = new CustomerDAO();
     _flightDAO         = new FlightDAO();
     _ticketDAO         = new TicketDAO();
     _userRoleDAO       = new UserRoleDAO();
     _userRepositoryDAO = new UserRepositoryDAO();
     _adminDAO          = new AdminDAO();
 }
Exemple #11
0
 public FacadeBase(bool testMode)
 {
     GlobalConfig.GetConfiguration(testMode);
     _airlineDAO  = new AirlineDAOPGSQL();
     _countryDAO  = new CountryDAOPGSQL();
     _customerDAO = new CustomerDAOPGSQL();
     _adminDAO    = new AdminDAOPGSQL();
     _userDAO     = new UserDAOPGSQL();
     _flightDAO   = new FlightDAOPGSQL();
     _ticketDAO   = new TicketDAOPGSQL();
 }
Exemple #12
0
 public FacadeBase()
 {
     _adminDAO      = new AdministratorDAOMSSQL();
     _airlineDAO    = new AirlineDAOMSSQL();
     _customerDAO   = new CustomerDAOMSSQL();
     _userDAO       = new UserDAOMSSQL();
     _flightDAO     = new FlightDAOMSSQL();
     _ticketDAO     = new TicketDAOMSSQL();
     _countryDAO    = new CountryDAOMSSQL();
     _backgroundDAO = new MaintenanceDAOMSSQL();
 }
Exemple #13
0
        public FacadeBase(bool testMode = false)
        {
            _ticketDAO   = new TicketDAOMSSQL(testMode);
            _customerDAO = new CustomerDAOMSSQL(testMode);
            _flightDAO   = new FlightDAOMSSQL(testMode);
            _countryDAO  = new CountryDAOMSSQL(testMode);

            log.Debug($"creating airlineDAO from type AirlineDAOMSSQL, testMode = {testMode}");
            _airlineDAO = new AirlineDAOMSSQL(testMode);
            log.Debug("AirlineDAOMSSQL created successfully");
        }
Exemple #14
0
 public void ChangeMyPassword(LoginToken <AirlineCompany> token, string oldPassword, string newPassword)
 {
     if (UserIsValid(token))
     {
         if (token.User.Password == oldPassword)
         {
             token.User.Password = newPassword;
             _airlineDAO         = new AirlineDAOMSSQL();
             _airlineDAO.Update(token.User);
         }
         else
         {
             throw new WrongPasswordException("Your Password Old, Please write new Password");
         }
     }
 }
Exemple #15
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);
        }
        public bool TryAirlineLogin(string userName, string password, out LoginToken <AirlineCompany> token)
        {
            _arilineDAO = new AirlineDAOMSSQL();
            AirlineCompany airline = _arilineDAO.GetAirlineByUsername(userName);

            if (airline != null)
            {
                if (airline.PASSWORD == password)
                {
                    token = new LoginToken <AirlineCompany>()
                    {
                        User = airline
                    };
                    return(true);
                }
                else
                {
                    throw new WrongPasswordException("Wrong password exception");
                }
            }
            token = null;
            return(false);
        }
Exemple #17
0
 public LoginService()
 {
     _airlineDAO       = new AirlineDAOMSSQL();
     _customerDAO      = new CustomerDAOMSSQL();
     _administratorDAO = new AdministratorDAOMSSQL();
 }
 /// <summary>
 /// Default Constructor
 /// </summary>
 public AirLineManager()
 {
     airlineDAO = (IAirlineDAO)AirTravelDAOFactory.GetInstance().Create("Airline");
 }
Exemple #19
0
 /// <summary>
 /// Default Constructor
 /// </summary>
 public AirLineManager()
 {
     airlineDAO = AirTravelDAOFactory.GetInstance().CreateAirlineDAO();
 }
 public LoginService()
 {
     _airlineDAO  = new AirLineDAOMSSQL();
     _customerDAO = new CustomerDAOMSSQL();
 }
 /// <summary>
 /// Parameterized Constructor
 /// </summary>
 /// <param name="airlineDAO"></param>
 public AirLineManager(IAirlineDAO airlineDAO)
 {
     this.airlineDAO = airlineDAO;
 }
 public LoginService(IAirlineDAO airlineDAO, ICustomerDAO customerDAO)
 {
     _airlineDAO  = airlineDAO;
     _customerDAO = customerDAO;
     db           = new FlightsSystemContext(); // make DAO for LoginService ...
 }
Exemple #23
0
 public LoginService(IAirlineDAO arilineDAO)
 {
     _arilineDAO = arilineDAO;
 }
 public LoginServiceBase(IAirlineDAO airlineDAO, ICustomerDAO customerDAO, IAdministratorDAO administratorDAO)
 {
     _airlineDAO       = airlineDAO;
     _customerDAO      = customerDAO;
     _administratorDAO = administratorDAO;
 }