Beispiel #1
0
        private void btnEditEmployee_Click(object sender, EventArgs e)
        {
            EmployeeForm employeeForm = new EmployeeForm(_dataStore.Employees, _selectedEmployee);

            employeeForm.SaveComplete += save_Clicked;
            employeeForm.Show();
        }
        private void BtnEditEmployee_Click(object sender, EventArgs e)
        {
            var employee = _dataStore.Employees.Single(proj => proj.Id == _selectedEmployeeId);

            // call the constructor, indicate edit with the false parameter
            EmployeeForm employeeForm = new EmployeeForm(employee, false);

            // attach the event listener, SaveEmployeeAndReload, to the DoSave event
            employeeForm.DoSave += SaveEmployeeAndReload;
            employeeForm.Show();
        }
        private void BtnAddEmployee_Click(object sender, EventArgs e)
        {
            var employee = new Employee();

            employee.Id = _dataStore.GetNextEmployeeId();

            // indicate that we are saving via the true add parameter
            EmployeeForm employeeForm = new EmployeeForm(employee, true);

            // attach the event listener, SaveEmployeeAndReload, to the DoSave event
            employeeForm.DoSave += SaveEmployeeAndReload;
            employeeForm.Show();
        }
        private void btnAddEmployee_Click(object sender, EventArgs e)
        {
            EmployeeForm employeeForm = new EmployeeForm(_dataStore.Employees);

            employeeForm.Show();
        }