private void btnAdd_Click(object sender, EventArgs e)
        {
            frmEmployee fEmployee = new frmEmployee();
            fEmployee.Employee = EmployeeRepository.GetNewEmployee();
            fEmployee.ShowDialog();
            if (!fEmployee.WasCancelled) {
                EmployeeRepository.AddNewEmployee(fEmployee.Employee.Email, fEmployee.Employee.Phone, fEmployee.Employee.Age);
                RefreshDataGrid();
            }

        }
Exemple #2
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            frmEmployee fEmployee = new frmEmployee();

            fEmployee.Employee = EmployeeRepository.GetNewEmployee();
            fEmployee.ShowDialog();
            if (!fEmployee.WasCancelled)
            {
                EmployeeRepository.AddNewEmployee(fEmployee.Employee.Email, fEmployee.Employee.Phone, fEmployee.Employee.Age);
                RefreshDataGrid();
            }
        }
Exemple #3
0
 private void btnEdit_Click(object sender, EventArgs e)
 {
     if (GetSelectedEmployeeID() > 0)
     {
         frmEmployee fEmployee = new frmEmployee();
         fEmployee.Employee = EmployeeRepository.GetAllEmployees()
                              .Where(emp => emp.EmployeeID == GetSelectedEmployeeID())
                              .FirstOrDefault();
         fEmployee.ShowDialog();
         if (!fEmployee.WasCancelled)
         {
             EmployeeRepository.UpdateEmployee(fEmployee.Employee.EmployeeID, fEmployee.Employee.Email, fEmployee.Employee.Phone, fEmployee.Employee.Age);
             RefreshDataGrid();
         }
     }
     else
     {
         MessageBox.Show("Select an employee first.");
     }
 }
        private void btnEdit_Click(object sender, EventArgs e)
        {
            if (GetSelectedEmployeeID() > 0)
            {
                frmEmployee fEmployee = new frmEmployee();
                fEmployee.Employee = EmployeeRepository.GetAllEmployees()
                                        .Where(emp => emp.EmployeeID == GetSelectedEmployeeID())
                                        .FirstOrDefault();
                fEmployee.ShowDialog();
                if (!fEmployee.WasCancelled)
                {
                    EmployeeRepository.UpdateEmployee(fEmployee.Employee.EmployeeID, fEmployee.Employee.Email, fEmployee.Employee.Phone, fEmployee.Employee.Age);
                    RefreshDataGrid();
                }
            }
            else
            {
                MessageBox.Show("Select an employee first.");
            }

        }