Beispiel #1
0
        private void buttonNewHourly_Click(object sender, EventArgs e)
        {
            Hourly hourly = new Hourly( );

            hourly.Employees = employees;
            hourly.ShowDialog();
            employees.Save(employeesFile);
            PopulateListBox( );
        }
Beispiel #2
0
        //opens the form to edit an employee
        private void buttonEdit_Click(object sender, EventArgs e)
        {
            var selected = employees[listBoxEmployees.SelectedIndex];

            //checks wether employee is a salaried or hourly
            if (selected is SalariedEmployee)
            {
                var dialog = new Salaried2( );
                dialog.Employee = (selected as SalariedEmployee);
                dialog.ShowDialog( );
            }
            else
            {
                var dialog = new Hourly( );
                dialog.Employee = (selected as HourlyEmployee);
                dialog.ShowDialog( );
            }

            employees.Save(employeesFile);
            PopulateListBox( );
        }