コード例 #1
0
 // Create New Customer.
 public void CreateNewCustomer(LoginToken <Administrator> token, Customer customer)
 {
     if (UserIsValid(token))
     {
         _customerDAO.Add(customer);
     }
 }
コード例 #2
0
        // Create New Customer.
        public long CreateNewCustomer(LoginToken <Administrator> token, Customer customer)
        {
            long newId = 0;

            if (UserIsValid(token))
            {
                newId = _customerDAO.Add(customer);
            }
            return(newId);
        }
コード例 #3
0
        public void GetFlightsByCustomer()
        {
            countryDAO.Add(new Country("Israel"));
            Country israel = countryDAO.GetCountryByName("Israel");

            airlineDAO.Add(new AirlineCompany("ELAL", "ELALUSERNAME", "PASSWORD", israel.ID));
            AirlineCompany elal = airlineDAO.GetAirlineByName("ELAL");

            flightDAO.Add(new Flight(elal.ID, israel.ID, israel.ID, new DateTime((DateTime.Now.Year + 2), 12, 5, 14, 00, 00), new DateTime((DateTime.Now.Year + 2), 12, 7, 14, 00, 00), 50, FlightStatus.NotDeparted));
            flightDAO.Add(new Flight(elal.ID, israel.ID, israel.ID, new DateTime((DateTime.Now.Year + 2), 12, 5, 14, 00, 00), new DateTime((DateTime.Now.Year + 2), 12, 7, 14, 00, 00), 20, FlightStatus.NotDeparted));

            customerDAO.Add(new Customer("FIRSTNAME", "LAST NAME", "USERNAME", "PASSWORD", "ADDRESS", "PHONENUMBE", "CARDNUMBER"));
            Customer customerTest = customerDAO.GetAll()[0];

            ticketDAO.Add(new Ticket(flightDAO.GetAll()[0].ID, customerTest.ID));
            ticketDAO.Add(new Ticket(flightDAO.GetAll()[1].ID, customerTest.ID));

            List <Flight> customerFlights = (List <Flight>)flightDAO.GetFlightsByCustomer(customerTest);

            Assert.AreEqual(2, customerFlights.Count);
        }
コード例 #4
0
 public void Add()
 {
     customerDAO.Add(new Customer("FIRSTNAME", "LASTNAME", "USERNAME", "PASSWORD", "ADDRESS", "PHONENUMBER", "CARDNUMBER"));
     Assert.AreEqual(1, customerDAO.GetAll().Count);
     Assert.AreEqual("FIRSTNAME", customerDAO.GetAll()[0].FirstName);
 }
コード例 #5
0
 public void Save(ICustomerBO dto)
 {
     _dao.Add(CustomerDTOAdapter.ToDTO(dto));
 }
コード例 #6
0
        public void Add()
        {
            Customer theCustomer = new Customer("FIRSTNAME", "LASTNAME", "USERNAME", "PASSWORD", "ADDRESS", "PHNUMBER", "CRDNUMBER");

            customerDAO.Add(theCustomer);
            theCustomer = customerDAO.GetAll()[0];

            Country israel = new Country("Israel");

            countryDAO.Add(israel);
            israel = countryDAO.GetAll()[0];

            AirlineCompany elal = new AirlineCompany("ELAL", "ELALUSERNAME", "ELALPASSWORD", israel.ID);

            airlineDAO.Add(elal);
            elal = airlineDAO.GetAll()[0];

            Flight theFlight = new Flight(elal.ID, israel.ID, israel.ID, new DateTime((DateTime.Now.Year + 2), 12, 5, 14, 00, 00), new DateTime((DateTime.Now.Year + 2), 12, 7, 14, 00, 00), 50, FlightStatus.NotDeparted);

            flightDAO.Add(theFlight);
            theFlight = flightDAO.GetAll()[0];

            ticketDAO.Add(new Ticket(theFlight.ID, theCustomer.ID));
            Assert.AreEqual(1, ticketDAO.GetAll().Count);
        }