Exemple #1
0
        /// <summary>
        /// Shows the employee's details depending on which Id is selected in the list box
        /// </summary>
        private void HoursIndexChanged()
        {
            // get the employe id of the date selected
            EmployeeHours selectedEmployee = (EmployeeHours)lstbxHoursEmpID.SelectedItem;
            int           empId            = selectedEmployee.EmpID;

            // return those employee details by running the search method
            ResultFind employee = _empController.FindEmployeeById(empId); // uses that Id to search for the employee

            // fills the label boxes with their details
            lblHoursEmail.Text = employee.Employee.Email;
            lblHoursName.Text  = employee.Employee.FullName;
            lblHoursPhone.Text = employee.Employee.Phone;
        }
Exemple #2
0
        /// <summary>
        /// Search for an employee via the ID entered into the Id textbox
        /// </summary>
        /// <param name="id"></param>
        private void SearchById(int id)
        {
            ResultFind foundEmp = _empController.FindEmployeeById(id);

            if (foundEmp.Status == ResultsEnum.Fail)
            {
                lblStatus.Text = @"Employee not found, try another ID";
                ClearTextFields();
                return;
            }

            // load up the text fields if the search was successful
            txtAddId.Text            = foundEmp.Employee.EmpID.ToString();
            txtAddFirstName.Text     = foundEmp.Employee.FirstName;
            txtAddLastName.Text      = foundEmp.Employee.LastName;
            dateTimeAddEmployee.Text = RemoveTimeFromBirthDate(foundEmp.Employee.DateOfBirth);
            txtAddPhone.Text         = foundEmp.Employee.Phone;
            txtAddEmail.Text         = foundEmp.Employee.Email;
        }