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\"");
        }
Ejemplo n.º 3
0
 public ModEmpEventArgs(Employee modEmp)
 {
     this.modEmp = modEmp;
 }
Ejemplo n.º 4
0
		private void detach_Employees(Employee entity)
		{
			this.SendPropertyChanging();
			entity.Employee1 = null;
		}
Ejemplo n.º 5
0
		private void attach_Employees(Employee entity)
		{
			this.SendPropertyChanging();
			entity.Employee1 = this;
		}
Ejemplo n.º 6
0
 partial void DeleteEmployee(Employee instance);
Ejemplo n.º 7
0
 partial void UpdateEmployee(Employee instance);
Ejemplo n.º 8
0
 partial void InsertEmployee(Employee instance);
Ejemplo n.º 9
0
 public AddEmpEventArgs(Employee e)
 {
     this.newEmp = e;
 }