public Employee validateEmployeeLogin(string id, string plainTextPassword)
 {
     foreach (Employee e in employees)
         if (e.IdMatch(id))
             if (e.PasswordMatch(plainTextPassword))
             {
                 loggedInEmployee = e;
                 return e;
             }
     return null;
 }
 public void logOut()
 {
     if (loggedInEmployee is AdminEmployee)
         updateMatrices();
     loggedInEmployee = null;
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Password of this instance is changed if the employee is of type AdminEmployee.
 /// </summary>
 /// <param name="employee"></param>
 /// <param name="newPassword"></param>
 /// <returns></returns>
 public bool changePassword(Employee employee, string newPassword)
 {
     if (employee is AdminEmployee)
     {
         setPassword(newPassword);
         return true;
     }
     return false;
 }
 public bool addEmployee(Employee e)
 {
     if (employees.Contains(e))
         return false;
     employees.Add(e);
     return true;
 }
Ejemplo n.º 5
0
        private void employeeEditButton_Click(object sender, EventArgs e)
        {
            employeeTypeComboBox.Enabled = false;
            employeeAddButton.Text = SAVE;
            addEmployee = false;

            currentEmployee = employeesListBox.SelectedItem as Employee;
            employeesListBox.ClearSelected();
            employeeIdTextBox.Text = currentEmployee.Id;
            firstNameTextBox.Text = currentEmployee.FirstName;
            middleNameTextBox.Text = currentEmployee.MiddleName;
            lastNameTextBox.Text = currentEmployee.LastName;
            newPasswordTextBox.Focus();

            if (currentEmployee is AdminEmployee)
            {
                employeeTypeComboBox.SelectedIndex = 0;
            }
            else if (currentEmployee is AcceptanceEmployee)
            {
                employeeTypeComboBox.SelectedIndex = 1;
                AcceptanceEmployee a = currentEmployee as AcceptanceEmployee;
                if (a != null)
                    employeeCurrentComboBox.SelectedItem = a.CurrentStoreFront;
            }
            else if (currentEmployee is WarehouseEmployee)
            {
                employeeTypeComboBox.SelectedIndex = 2;
                WarehouseEmployee a = currentEmployee as WarehouseEmployee;
                if (a != null)
                    employeeCurrentComboBox.SelectedItem = a.CurrentLocation;
            }
            else if (currentEmployee is DeliveryEmployee)
            {
                employeeTypeComboBox.SelectedIndex = 3;
                DeliveryEmployee a = currentEmployee as DeliveryEmployee;
                if (a != null)
                    employeeCurrentComboBox.SelectedItem = a.CurrentRoute;
            }
        }