public bool TryCustomerLogin(string userName, string password, out LoginToken <Customer> token) { try { _customerDAO = new CustomerDAOMSSQL(); Customer customer = _customerDAO.GetCustomerByUserame(userName); if (customer == null) { token = null; return(false); } else if (customer.PASSWORD == password) { token = new LoginToken <Customer>(); token.User = new Customer(); token.User.USER_NAME = userName; token.User.PASSWORD = password; return(true); } else if (customer.PASSWORD != password) { throw new WrongPasswordException("Wrong password"); } } catch (Exception e) { Console.WriteLine(e.Message); } token = null; return(false); }
public LoginService() { _airlineDAO = new AirlineDAOMSSQL(); _customerDAO = new CustomerDAOMSSQL(); mapTypeLoginFunction = new Dictionary <Type, Func <string, string, ILoginToken> >(); AddToDictionary(); }
public bool TryCustomerLogin(string userName, string password, out LoginToken <Customer> token) { if (userName == "AhronUser" || userName == "BernardUser" || userName == "CharlieUser") { _customerDAO = new CustomerDAOMSSQL(true); } else { _customerDAO = new CustomerDAOMSSQL(); } Customer customer = _customerDAO.GetCustomerByUsername(userName); if (customer != null) { if (customer.Password == password) { token = new LoginToken <Customer>(customer); return(true); } else { throw new WrongPasswordException($"failed to login as [{userName}], you entered a wrong password! [{password}]"); } } token = null; return(false); }
public void TestAddCustomer() { ICustomerDAO dao = Initialize(); Customer c = new Customer { FirstName = "Ronen", LastName = "Haim", Age = 33, AddressCity = "Rishon le zion", AddressStreet = "Hertzel", PhNumber = "03-9644196" }; dao.AddCustomer(c); List <Customer> customers = dao.GetAllCustomers(); Assert.AreEqual(1, customers.Count); //Assert.AreEqual(1, customers[0].Id); Assert.AreEqual("Ronen", customers[0].FirstName); Assert.AreEqual("Haim", customers[0].LastName); Assert.AreEqual(33, customers[0].Age); Assert.AreEqual("Rishon le zion", customers[0].AddressCity); Assert.AreEqual("Hertzel", customers[0].AddressStreet); Assert.AreEqual("03-9644196", customers[0].PhNumber); }
public LoginService() { _adminDAO = new AdminDAOPGSQL(); _customerDAO = new CustomerDAOPGSQL(); _airlineDAO = new AirlineDAOPGSQL(); _userDAO = new UserDAOPGSQL(); }
public FacadeBase() { _airlineDAO = new AirlineDAOMSSQL(); _countryDAO = new CountryDAOMSSQL(); _customerDAO = new CustomerDAOMSSQL(); _flightDAO = new FlightDAOMSSQL(); _ticketDAO = new TicketDAOMSSQL(); }
public FacadeBase() { this._airlineDAO = new AirlineDAOMSSQL(); this._countryDAO = new CountryDAOMSQQL(); this._customerDAO = new CustomerDAOMSSQL(); this._flightDAO = new FlightDAOMSSQL(); this._ticketDAO = new TIcketDAOMSSQL(); }
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; }
public OrderManager(IContextContainer container) : base(container) { _orderDAO = new OrderDAO(container); _productDAO = new ProductDAO(container); _bonusDAO = new BonusDAO(container); _cartDAO = new ShoppingCartDAO(container); _addressInfoDAO = new AddressInfoDAO(container); _customerDAO = new CustomerDAO(container); }
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(); }
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(); }
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(); }
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(); }
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"); }
public void TestAddCustomerExceptionPhNumber() { ICustomerDAO dao = Initialize(); Customer c = new Customer { FirstName = "Ronen", LastName = "Haim", Age = 33, AddressCity = "Rishon le zion", AddressStreet = "Hertzel", PhNumber = "03-9644196" }; dao.AddCustomer(c); dao.AddCustomer(c); }
public FacadeBase() { __airLineDAO = new AirLineDAOMSSQL(); _airLineDAO = __airLineDAO; __countryDAO = new CountryDAOMSSQL(); _countryDAO = __countryDAO; __customerDAO = new CustomerDAOMSSQL(); _customerDAO = __customerDAO; __flightDAO = new FlightDAOMSSQL(); _flightDAO = __flightDAO; __ticketDAO = new TicketDAOMSSQL(); _ticketDAO = __ticketDAO; __flightStatusDAO = new FlightStatusDAOMSSQL(); _flightStatusDAO = __flightStatusDAO; }
public bool TryCustomerLogin(string userName, string password, out LoginToken <Customer> token) { _customerDAO = new CustomerDAOMSSQL(); Customer customer = _customerDAO.GetCustomerByUsername(userName); if (customer != null) { if (customer.PASSWORD == password) { token = new LoginToken <Customer>() { User = customer }; return(true); } else { throw new WrongPasswordException("Wrong Password Exception"); } } token = null; return(false); }
public CustomersController(ICustomerDAO dao) { this.customerDAO = dao; }
public ICustomerDAO createCustomerDAO() { lock (lockObj) { if (customerDAO == null) { if (databaseName == DATABASE_MSSQL) customerDAO = new CustomerMSSqlDAO(); if (customerDAO == null) throw new Exception("Unsupported database : " + databaseName); } return customerDAO; } }
public static void Save() { cus.Save(); cus = new CustomerDAO(); }
public CustomersController(ICustomerDAO CustomerDAO) { this.CustomerDAO = CustomerDAO; }
public LoginService() { _airlineDAO = new AirLineDAOMSSQL(); _customerDAO = new CustomerDAOMSSQL(); }
public CustomerService(ICustomerDAO customerDAO) { _customerDAO = customerDAO; }
public CustomerBOFactory(ICustomerDAO dao) { _dao = dao; }
public CustomersController(ICustomerDAO db) { _db = db; }
public LoginService() { _airlineDAO = new AirlineDAOMSSQL(); _customerDAO = new CustomerDAOMSSQL(); _administratorDAO = new AdministratorDAOMSSQL(); }
public EditProducts(ICustomerDAO customerDAO, IProductDAO productDAO) { _customerDAO = customerDAO; _productDAO = productDAO; }
public CustomersController(ICustomerDAO customerDAL) { this.customerDAL = customerDAL; }
public CustomerManager(IContextContainer container) : base(container) { _customerDAO = new CustomerDAO(container); }
public LoginService(IAirLineDAO airLineDAO, ICustomerDAO customerDAO) { _arilineDAO = airLineDAO; _customerADO = customerDAO; }