private void showButton_Click(object sender, EventArgs e)
        {
            employeeList.Clear();

            employeeList.View          = View.Details;
            employeeList.GridLines     = true;
            employeeList.FullRowSelect = true;
            employeeList.MultiSelect   = false;

            idHeader        = employeeList.Columns.Add("ID");
            firstNameHeader = employeeList.Columns.Add("First Name");
            lastNameHeader  = employeeList.Columns.Add("Last Name");
            depHeader       = employeeList.Columns.Add("Department ID");
            dateHeader      = employeeList.Columns.Add("Date of Hire");
            contractHeader  = employeeList.Columns.Add("Contract");

            employeeRepo empRepo = new employeeRepo();

            employeeService empService = new employeeService(empRepo);

            List <employeeViewModel> employees = empService.getAll();

            foreach (employeeViewModel au in employees)
            {
                ListViewItem lvi;

                lvi = new ListViewItem(au.ID);

                lvi.SubItems.Add(au.FirstName);
                lvi.SubItems.Add(au.LastName);
                lvi.SubItems.Add(au.Department);
                lvi.SubItems.Add(au.dateOFHire);
                lvi.SubItems.Add(au.Contract);
                employeeList.Items.Add(lvi);

                employeeList.Columns[0].Width = -2;
                employeeList.Columns[1].Width = -2;
                employeeList.Columns[2].Width = -2;
                employeeList.Columns[3].Width = -2;
                employeeList.Columns[4].Width = -2;
                employeeList.Columns[5].Width = -2;
            }
        }
        public Form1()
        {
            InitializeComponent();

            addButton.Enabled    = false;
            removeButton.Enabled = false;

            employeeList.View          = View.Details;
            employeeList.GridLines     = true;
            employeeList.FullRowSelect = true;
            employeeList.MultiSelect   = false;

            projectList.Activation    = ItemActivation.OneClick;
            projectList.View          = View.Details;
            projectList.GridLines     = true;
            projectList.FullRowSelect = true;
            projectList.MultiSelect   = false;

            projEmployeeList.View          = View.Details;
            projEmployeeList.GridLines     = true;
            projEmployeeList.FullRowSelect = true;
            projEmployeeList.MultiSelect   = false;

            idHeader        = employeeList.Columns.Add("ID");
            firstNameHeader = employeeList.Columns.Add("First Name");
            lastNameHeader  = employeeList.Columns.Add("Last Name");
            depHeader       = employeeList.Columns.Add("Department ID");
            dateHeader      = employeeList.Columns.Add("Date of Hire");
            contractHeader  = employeeList.Columns.Add("Contract");

            projIdHeader  = projectList.Columns.Add("ID");
            projDesHeader = projectList.Columns.Add("Description");

            idHeader        = projEmployeeList.Columns.Add("ID");
            firstNameHeader = projEmployeeList.Columns.Add("First Name");
            lastNameHeader  = projEmployeeList.Columns.Add("Last Name");
            depHeader       = projEmployeeList.Columns.Add("Department ID");
            dateHeader      = projEmployeeList.Columns.Add("Date of Hire");
            contractHeader  = projEmployeeList.Columns.Add("Contract");

            employeeList.Columns[0].Width = -2;
            employeeList.Columns[1].Width = -2;
            employeeList.Columns[2].Width = -2;
            employeeList.Columns[3].Width = -2;
            employeeList.Columns[4].Width = -2;
            employeeList.Columns[5].Width = -2;

            projectList.Columns[0].Width = -2;
            projectList.Columns[1].Width = -2;

            projEmployeeList.Columns[0].Width = -2;
            projEmployeeList.Columns[1].Width = -2;
            projEmployeeList.Columns[2].Width = -2;
            projEmployeeList.Columns[3].Width = -2;
            projEmployeeList.Columns[4].Width = -2;
            projEmployeeList.Columns[5].Width = -2;


            employeeRepo empRepo = new employeeRepo();

            employeeService empService = new employeeService(empRepo);

            List <employeeViewModel> employees = empService.getAll();


            projectRepository projRepo = new projectRepository();

            projectService projService = new projectService(projRepo);

            List <projectViewModel> projects = projService.getAll();


            foreach (employeeViewModel au in employees)
            {
                ListViewItem lvi;

                lvi = new ListViewItem(au.ID);

                lvi.SubItems.Add(au.FirstName);
                lvi.SubItems.Add(au.LastName);
                lvi.SubItems.Add(au.Department);
                lvi.SubItems.Add(au.dateOFHire);
                lvi.SubItems.Add(au.Contract);
                employeeList.Items.Add(lvi);
            }

            foreach (projectViewModel au in projects)
            {
                ListViewItem lvi;

                lvi = new ListViewItem(au.ID);

                lvi.SubItems.Add(au.Description);
                projectList.Items.Add(lvi);
            }

            projectList.ItemActivate += new EventHandler(ProjectClick);
        }
        private void findButton_Click(object sender, EventArgs e)
        {
            employeeRepo empRepo = new employeeRepo();

            idToFind = findBox.Text.Trim();

            if (idToFind == null)
            {
                MessageBox.Show("One or more fields missing valid input.");
                return;
            }

            if (string.IsNullOrWhiteSpace(idToFind))
            {
                MessageBox.Show("One or more fields missing valid input.");
                findBox.Text = null;
                return;
            }

            List <employee> foundEmployee = empRepo.FindByID(idToFind);

            employeeList.Clear();

            employeeList.View          = View.Details;
            employeeList.GridLines     = true;
            employeeList.FullRowSelect = true;
            employeeList.MultiSelect   = false;

            idHeader        = employeeList.Columns.Add("ID");
            firstNameHeader = employeeList.Columns.Add("First Name");
            lastNameHeader  = employeeList.Columns.Add("Last Name");
            depHeader       = employeeList.Columns.Add("Department ID");
            dateHeader      = employeeList.Columns.Add("Date of Hire");
            contractHeader  = employeeList.Columns.Add("Contract");

            ListViewItem lvi;

            try
            {
                lvi = new ListViewItem(foundEmployee[0].id.ToString());
            }
            catch (Exception)
            {
                employeeRepo empRepo2 = new employeeRepo();

                employeeService empService = new employeeService(empRepo2);

                List <employeeViewModel> employees = empService.getAll();

                foreach (employeeViewModel au in employees)
                {
                    lvi = new ListViewItem(au.ID);

                    lvi.SubItems.Add(au.FirstName);
                    lvi.SubItems.Add(au.LastName);
                    lvi.SubItems.Add(au.Department);
                    lvi.SubItems.Add(au.dateOFHire);
                    lvi.SubItems.Add(au.Contract);
                    employeeList.Items.Add(lvi);
                }

                employeeList.Columns[0].Width = -2;
                employeeList.Columns[1].Width = -2;
                employeeList.Columns[2].Width = -2;
                employeeList.Columns[3].Width = -2;
                employeeList.Columns[4].Width = -2;
                employeeList.Columns[5].Width = -2;

                return;
            }

            lvi.SubItems.Add(foundEmployee[0].firstName);
            lvi.SubItems.Add(foundEmployee[0].lastName);
            lvi.SubItems.Add(foundEmployee[0].department);
            lvi.SubItems.Add(foundEmployee[0].dateOfHire.ToString());

            if (foundEmployee[0].contract == true)
            {
                lvi.SubItems.Add("Yes");
            }
            if (foundEmployee[0].contract == false)
            {
                lvi.SubItems.Add("No");
            }

            employeeList.Items.Add(lvi);

            employeeList.Columns[0].Width = -2;
            employeeList.Columns[1].Width = -2;
            employeeList.Columns[2].Width = -2;
            employeeList.Columns[3].Width = -2;
            employeeList.Columns[4].Width = -2;
            employeeList.Columns[5].Width = -2;
        }