Ejemplo n.º 1
0
        private void btnEdit_Click(object sender, RoutedEventArgs e)
        {
            using (var context = new DatabaseContext())
            {
                var selectedRow = dcEmployeesList.SelectedItem as EmployeeView;
                var employee = context.Employees.FirstOrDefault
                    (c => c.FirstName.ToLower() + " " + c.MiddleName.ToLower()
                        + " " + c.LastName.ToLower() == selectedRow.EmployeeName.ToLower());

                if (employee != null)
                {
                    EmployeeWindow.EmployeeId = employee.EmployeeId;

                    var window = new EmployeeWindow();
                    window.ShowDialog();
                }
                else
                {
                    NullMessage();
                }
                LoadEmployees();

                EmployeeWindow.EmployeeId = 0;
            }
        }
Ejemplo n.º 2
0
        private void btnAdd_Click(object sender, RoutedEventArgs e)
        {
            var window = new EmployeeWindow();
            window.ShowDialog();

            LoadEmployees();
        }