Пример #1
0
        //Adds a new employee when the 'Add' button is clicked
        private void btnEmployeeAdd_Click(object sender, EventArgs e)
        {
            NewEmployeeWindow newEmpWindow = new NewEmployeeWindow("Add");

            newEmpWindow.ShowDialog();
            showEmployee(Convert.ToString(cmbBoxAccType.SelectedItem));         //Calls method ShowEmployee() to reflect the changes made to the list
        }
Пример #2
0
        //Shows the detailed information of a selected employee when the listbox is double clicked
        private void listBoxHR_DoubleClick(object sender, EventArgs e)
        {
            if (listBoxHR.Items.Count != 0)
            {
                string   employeeRecord = Convert.ToString(listBoxHR.SelectedItem);
                string[] employeeID     = employeeRecord.Split(' ');

                Console.WriteLine(employeeID[0]);
                NewEmployeeWindow newEmpWindow = new NewEmployeeWindow("Details", employeeID[0]);

                newEmpWindow.ShowDialog();
            }
        }
Пример #3
0
        //Edits the selected employee record when the 'Edit' button is clicked
        private void btnEmployeeEdit_Click(object sender, EventArgs e)
        {
            string employeeRecord = Convert.ToString(listBoxHR.SelectedItem);       //Reads the selected item from the listbox as a string

            string[] employeeID = employeeRecord.Split(' ');                        //Split the strings into an array of strings, assuming the first array would be the Employee's ID

            //To check is there any records in the listbox
            if (listBoxHR.Items.Count != 0)
            {
                NewEmployeeWindow newEmpWindow = new NewEmployeeWindow("Edit", employeeID[0]);

                newEmpWindow.ShowDialog();
                showEmployee(Convert.ToString(cmbBoxAccType.SelectedItem));
            }
            else
            {
                MessageBox.Show("No Employee Selected !!", "Edit Employee Details", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }