public ModEmployeeWindow(MainWindow mWindow, Employee oldEmployee, List<int> IDList) { this.mWindow = mWindow; this.modEmployee = new Employee() { EmployeeID = oldEmployee.EmployeeID, FirstName = oldEmployee.FirstName, LastName = oldEmployee.LastName, BirthDate = oldEmployee.BirthDate, HireDate = oldEmployee.HireDate, Address = oldEmployee.Address, PostalCode = oldEmployee.PostalCode, City = oldEmployee.City, Country = oldEmployee.Country, Region = oldEmployee.Region, ReportsTo = oldEmployee.ReportsTo, EmployeeTerritories = oldEmployee.EmployeeTerritories, Extension = oldEmployee.Extension, HomePhone = oldEmployee.HomePhone, Notes = oldEmployee.Notes, Photo = oldEmployee.Photo, PhotoPath = oldEmployee.PhotoPath, Title = oldEmployee.Title, TitleOfCourtesy = oldEmployee.TitleOfCourtesy }; this.IDList = IDList; this.Register(this.mWindow); InitializeComponent(); FillFieldsDefault(); this.Show(); }
private void btnAddEmp_Click(object sender, RoutedEventArgs e) { if (AddEmployeeEvent != null) { try { Employee newEmp = new Employee() { FirstName = tbFirstName.Text, LastName = tbLastName.Text, BirthDate = dpBirthDate.SelectedDate, HireDate = DateTime.Now, Address = tbAdress.Text + "\n" + tbAdress2.Text, PostalCode = tbPostCode.Text, City = tbCity.Text, Country = tbCountry.Text, Region = tbRegion.Text, }; if (tbReportsTo.Text != string.Empty) { int rtID; if (int.TryParse(tbReportsTo.Text, out rtID)) newEmp.ReportsTo = rtID; else throw new InvalidCastException("Le champ \"Supérieur\" doit contenir un nombre entier ou être vide"); } AddEmployeeEvent(this, new AddEmpEventArgs(newEmp)); //MessageBox.Show("Envoyé : " + newEmp.FullName); } catch (Exception ex) { MessageBox.Show(ex.Message); } } else MessageBox.Show("Aucun abonné à \"AddEmployeeEvent\""); }
public ModEmpEventArgs(Employee modEmp) { this.modEmp = modEmp; }
private void detach_Employees(Employee entity) { this.SendPropertyChanging(); entity.Employee1 = null; }
private void attach_Employees(Employee entity) { this.SendPropertyChanging(); entity.Employee1 = this; }
partial void DeleteEmployee(Employee instance);
partial void UpdateEmployee(Employee instance);
partial void InsertEmployee(Employee instance);
public AddEmpEventArgs(Employee e) { this.newEmp = e; }