Ejemplo n.º 1
0
 public void OnSelectedEmployeeChanged(object sender, Employee employee)
 {
     var selectedEmployeeChangedDelegate = SelectedEmployeeChanged as EventHandler<SelectedEmployeeEventArgs>;
     if (selectedEmployeeChangedDelegate != null)
     {
         selectedEmployeeChangedDelegate(sender, new SelectedEmployeeEventArgs { Employee = employee });
     }
 }
Ejemplo n.º 2
0
        private static Employee GenerateRandomEmployee(Random random, ICollection<Employee> collection)
        {
            var newEmployee = new Employee();

            newEmployee.FirstName = RandomNames[random.Next(RandomNames.Count)];
            newEmployee.LastName = RandomNames[random.Next(RandomNames.Count)];
            newEmployee.Email = newEmployee.FirstName + newEmployee.LastName + "@email.com";
            newEmployee.PhoneNumber = random.Next(200, 1000).ToString() + "-" + random.Next(100, 1000).ToString() + "-" + random.Next(1000, 10000).ToString();
            newEmployee.IsHourly = random.Next(2) == 0;
            newEmployee.Wage = random.Next(8, 100000);
            newEmployee.Id = newEmployee.GenerateUniqueId(random, collection);

            return newEmployee;
        }
Ejemplo n.º 3
0
 public void Save(Employee newValues)
 {
     this.FirstName = newValues.FirstName;
     this.LastName = newValues.LastName;
     this.IsHourly = newValues.IsHourly;
     this.Email = newValues.Email;
     this.PhoneNumber = newValues.PhoneNumber;
     this.Wage = newValues.Wage;
 }
Ejemplo n.º 4
0
 public Employee Copy()
 {
     var copy = new Employee();
     copy.Id = this.Id;
     copy.FirstName = this.FirstName;
     copy.LastName = this.LastName;
     copy.IsHourly = this.IsHourly;
     copy.Email = this.Email;
     copy.PhoneNumber = this.PhoneNumber;
     copy.Wage = this.Wage;
     return copy;
 }
Ejemplo n.º 5
0
        private void LoadEmployee(Employee employee)
        {
            if (employee == null || employee.Id == null)
            {
                ModelEmployee = new Employee();
                return;
            }

            var selectedEmployee = Employee.GetEmployees().FirstOrDefault(e => e.Id == employee.Id);
            if (selectedEmployee == null)
            {
                ModelEmployee = new Employee();
                return;
            }
            else
            {
                ModelEmployee = selectedEmployee.Copy();
                SavedEmployee = ModelEmployee.Copy();
            }
        }