Esempio n. 1
0
 public EmployeeManager(EmployeeGenerator employeeGenerator, EmployeeStats employeeStats)
 {
     this.employeeGenerator = employeeGenerator;
     this.employeeStats     = employeeStats;
     EmployeeList           = new List <EmployeeController>();
     //TO-DO ESTO ES UNA INSTANCIACIÓN DE PRUEBA!
 }
        public EmployeeStatsViewModel(ObservableCollection <Employee> employees)
        {
            _employees = employees;


            foreach (Employee employee in _employees)
            {
                EmployeeStats stats = new EmployeeStats();
                stats.Employee = employee;

                foreach (Task task in employee.Tasks)
                {
                    if (task.SubtaskList.Count == 0 && task.DoneSubtaskList.Count > 0)
                    {
                        stats.FinishedTasks.Add(task);
                    }
                    else
                    {
                        stats.InProgressTasks.Add(task);
                    }
                }

                _stats.Add(stats);
            }
        }
Esempio n. 3
0
    public decimal MaxSalaryBySex(string sex)
    {
        emps.Values.Where(e => e.Sex == sex).Select(e => e.Salary).Aggregate((s1, s2) => s1 >= s2 ? s1 : s2);
        EmployeeStats stats = new EmployeeStats();

        EmployeeStats stats2 = emps.Values
                               .Aggregate(stats, (a, e) => a.Update(e),
                                          a => {
            a.AvgFemaleSalary = a.SumFemaleSalary / a.FemaleCounter;
            a.AvgMaleSalary   = a.SumMaleSalary / a.MaleCounter;
            return(a);
        });

        // stats.AvgMaleSalary = stats.SumMaleSalary / stats.MaleCounter;

        return(emps.Values.Where(e => e.Sex == sex).Max(e => e.Salary));
    }
    internal void SetEmployee(EmployeeStats employeeStats)
    {
        int i = 0;

        while (i < employees.Count && employees[i].gameObject.activeSelf)
        {
            i++;
        }
        if (i >= employees.Count)
        {
            Debug.Log("Max employees");
        }
        else
        {
            employees[i].gameObject.SetActive(true);
            employees[i].SetEmployeeName(employeeStats.GetEmployeeName());
            employees[i].SetPortrait(employeeStats.GetPortrait());
            employees[i].SetTraits(employeeStats.GetTraitObjects());
        }
    }