public LoginV()
 {
     InitializeComponent();
     _adminSrv = new AdministratorService();
     _admins = _adminSrv.getAllFromTable();
     _userlog = new Logger(true, "Login attempt: ");
 }
        // constructor for current logged in admin
        public ReportV(String adminName)
        {

            InitializeComponent();
            // determine last available date for period date pickers
            endDate.DisplayDateEnd = DateTime.Today.AddDays(-1);
            startDate.DisplayDateEnd = DateTime.Today.AddDays(-1);
            if (startDate.SelectedDate == null)
            {
                startDate.DisplayDate = DateTime.Today.AddDays(-1);
            }
            if (endDate.SelectedDate == null)
            {
                endDate.DisplayDate = DateTime.Today.AddDays(-1);
            }


            RoomService roomSrv = new RoomService();
            CustomerService customerSrv = new CustomerService();
            AdministratorService adminSrv = new AdministratorService();

                      
            //populate list of Customers with Customer Names from database. 
            List<CustomerBO> customers = customerSrv.getAllFromTable();
            List<String> customerNames = new List<String>();
            foreach (CustomerBO customer in customers)
            {
                String customerName = customer.CompanyName;
                customerNames.Add(customerName);
            }
            listCustomers.ItemsSource = customerNames;

            //populate comboBox of Rooms with room names from database
            List<RoomBO> rooms = roomSrv.getAllFromTable();
            List<String> roomNames = new List<String>();
            foreach (RoomBO room in rooms)
            {
                String roomName = room.Name;
                roomNames.Add(roomName);
            }
            cboxRooms.ItemsSource = roomNames;
            
        }
        private static void fullFillTableAdministrator()
        {
            AdministratorService adminSrv = new AdministratorService();
            adminSrv.addNew("Alisa", "al_usr", "parol", true);
            adminSrv.addNew("Anna", "an_usr", "parol", true);
            adminSrv.addNew("Sergei", "se_usr", "parol", true);
            adminSrv.addNew("Test Admin", "test", "test", true);
            List<AdministratorBO> admins = adminSrv.getAllFromTable();
            Assert.AreNotEqual(0, admins.Count(), string.Format("There should be values in 'Administrator' Table.")); 

        }
 private static void emptyTableAdministrator()
 {
     AdministratorService adminSrv = new AdministratorService();
     adminSrv.emptyTable();
     List<AdministratorBO> admins = adminSrv.getAllFromTable();
     Assert.AreEqual(0, admins.Count(), string.Format("'Administrator' Table should be empty."));
 }
        private static void fullFillTableBooking()
        {
            RoomService roomSrv = new RoomService();
            List<RoomBO> rooms = roomSrv.getAllFromTable();
            Assert.AreNotEqual(0, rooms.Count(), string.Format("There should be values in 'Rooms' Table."));
            int existingRoomID = rooms.ElementAt(0).RoomID;

            CustomerService customerSrv = new CustomerService();
            List<CustomerBO> customers = customerSrv.getAllFromTable();
            Assert.AreNotEqual(0, customers.Count(), string.Format("There should be values in 'Customer' Table."));
            int existingCustomerID = customers.ElementAt(0).CustomerID;

            AdministratorService adminSrv = new AdministratorService();
            List<AdministratorBO> admins = adminSrv.getAllFromTable();
            Assert.AreNotEqual(0, admins.Count(), string.Format("There should be values in 'Administrator' Table."));
            int existingAdminID = admins.ElementAt(0).AdminID;

            //Verify that booking cannot be created before Customer (CustomerID foreign key)
            //Verify that booking cannot be created before Room (RoomID foreign key)
            //Verify that booking cannot be created before Administrator (AdminID foreign key)
            BookingService bookingSrv = new BookingService();
            bookingSrv.addNew(DateTime.Now.AddDays(1), existingRoomID, existingCustomerID, 25, DateTime.Now, existingAdminID, "no smoking");// take first from list
            bookingSrv.addNew(DateTime.Now.AddDays(1), existingRoomID, existingCustomerID, 40, DateTime.Now, existingAdminID, "no pets allowed");
            bookingSrv.addNew(DateTime.Now.AddDays(10), existingRoomID, existingCustomerID, 77, DateTime.Now, existingAdminID, "reconfirm by phone");
            bookingSrv.addNew(DateTime.Now.AddDays(17), existingRoomID, existingCustomerID, 55, DateTime.Now, existingAdminID, "reconfirm by phone tomorrow");
            bookingSrv.addNew(DateTime.Now.AddDays(-5), existingRoomID, existingCustomerID, 10, DateTime.Now.AddDays(-8), existingAdminID, "catering ");
            bookingSrv.addNew(DateTime.Now.AddDays(-2), existingRoomID, existingCustomerID, 100, DateTime.Now.AddDays(-5), existingAdminID, "no catering");
            List<BookingBO> bookings = bookingSrv.getAllFromTable();
            Assert.AreNotEqual(0, bookings.Count(), string.Format("There should be values in 'Booking' Table."));
        }