Example #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            String username = textBoxUsername.Text;
            String password = textBoxPassword.Text;

            if (EmployeeController.isValidEmployee(username, password))
            {
                if (EmployeeController.getEmployees()[username].getAdminStatus())
                {
                    thread = new Thread(openAdminForm);
                    thread.SetApartmentState(ApartmentState.STA);
                    thread.Start();
                    this.Close();
                }
                else
                {
                    EmployeeController.setCurrentEmployee(EmployeeController.getEmployees()[username]);
                    thread = new Thread(openUserForm);
                    thread.SetApartmentState(ApartmentState.STA);
                    thread.Start();
                    this.Close();
                }
            }
            else
            {
                WrongLoginInfoLabel.Show();
            }
        }
        private void AdminForm_Load(object sender, EventArgs e)
        {
            Dictionary <String, Employee> dictionary = EmployeeController.getEmployees();

            foreach (Employee emp in dictionary.Values)
            {
                ListViewItem item = new ListViewItem(emp.getFirstName() + " " + emp.getLastName());
                item.SubItems.Add(emp.getUserName());
                item.SubItems.Add(emp.getLoginID());
                item.SubItems.Add(emp.getPassword());
                item.SubItems.Add(emp.getClockedInStatus().ToString());
                item.SubItems.Add(emp.getAdminStatus().ToString());
                listViewEmployees.Items.Add(item);
            }
        }