Пример #1
0
        // Edit employee details, now accepts an employee parameter
        private void EditEmployeeDetails()
        {
            // Locating the selected employee in the list box and editing it
            ClsEmployeeDetails lcEmplyeeDetails = (ClsEmployeeDetails)LstEmployees.SelectedItem;

            // If employee is not empty we edit it
            if (lcEmplyeeDetails != null && lcEmplyeeDetails.ViewEdit())
            {
                // Call update display method
                UpdateDisplay();
            }
        }
Пример #2
0
        // Create employee method
        private void CreateEmployee()
        {
            // We create a new employee by calling the factory method NewEmployee in ClsEmployeeDetails and stroing it in the local variable lcEmployeeDetails
            ClsEmployeeDetails lcEmployeeDetails = ClsEmployeeDetails.NewEmployee(CboEmployeeType.SelectedIndex);

            // If the user didn't cancel
            if (lcEmployeeDetails != null && lcEmployeeDetails.ViewEdit())
            {
                // Add the new employee details to the list box, as we are adding to a dictionary we need to put the key in
                ClsEmployeeList.EmployeeList.Add(lcEmployeeDetails.ID, lcEmployeeDetails);
                // Then we update the display to show the new employee in teh list box
                UpdateDisplay();
            }
        }