Beispiel #1
0
        private void ShowPanel(string panelName)
        {
            if (panelName == "PNL_EditEmployee")
            {
                PNL_EditEmployee.Show();

                EmployeeLogic        employeeLogic    = new EmployeeLogic();
                List <EmployeeModel> employeeListView = employeeLogic.GetAllEmployees();

                ListView_Employees.Items.Clear();

                foreach (OrderSystemModel.EmployeeModel employee in employeeListView)
                {
                    ListViewItem li = new ListViewItem(employee.name);
                    li.SubItems.Add(employee.username);
                    li.SubItems.Add(employee.password);
                    li.SubItems.Add(employee.type.ToString());
                    ListView_Employees.Items.Add(li);
                }
            }
        }
Beispiel #2
0
        //Shows the requested panel
        private void ShowPanel(string panelName)
        {
            if (panelName == "PNL_ManageEmployees")
            {
                PNL_AddEmployee.Hide();
                PNL_EditEmployee.Hide();
                PNL_ManageEmployee.Show();


                List <Employee> employeeListView = employeeLogic.GetAllEmployees();

                ListView_Employees.Items.Clear();

                foreach (OrderSystemModel.Employee employee in employeeListView)
                {
                    ListViewItem li = new ListViewItem(employee.ID.ToString());
                    li.SubItems.Add(employee.name);
                    li.SubItems.Add(employee.username);
                    li.SubItems.Add(employee.password);
                    li.SubItems.Add(employee.type.ToString());
                    ListView_Employees.Items.Add(li);
                }
            }
            else if (panelName == "PNL_EditEmployee")
            {
                TXTB_EditEmployeeName.Text     = selectedEmployee.name;
                TXTB_EditEmployeeUsername.Text = selectedEmployee.username;
                TXTB_EditEmployeePassword.Text = selectedEmployee.password;
                DB_EditEmployeeType.Text       = selectedEmployee.type.ToString();
                PNL_ManageEmployee.Hide();
                PNL_EditEmployee.Show();
            }
            else if (panelName == "PNL_AddEmployee")
            {
                PNL_ManageEmployee.Hide();
                PNL_AddEmployee.Show();
            }
        }