示例#1
0
        static void Main(string[] args)
        {
            Employee employee = new Employee("Ingrid Aparicio", new DateTime(2015, 1, 15));

            employee.AddAbsence(new DateTime(2015, 5, 5), 1);
            employee.AddAbsence(new DateTime(2017, 5, 10), 1);
            employee.AddAbsence(new DateTime(2017, 9, 15), 1);

            Console.WriteLine($"Datos de {employee.Name}");
            Console.WriteLine($"Con fecha de contrato {employee.DateHired}");
            Console.WriteLine($"Tiene {employee.Absences.Count()} ausencias");
            Console.WriteLine($"Fecha de ultima ausencia {employee.LastAbsence}");

            if (employee.Absences.Count() > 0)
            {
                Console.WriteLine("Ausencias:");
                foreach (var a in employee.Absences)
                {
                    Console.WriteLine($"\t{a.Item1} {a.Item2} dias");
                }
            }
            IEmployee.SetBonusParameters(new TimeSpan(365, 0, 0, 0), 3, 80);
            IEmployee employee1 = employee;

            Console.WriteLine($"Bonus = {employee1.ComputeBonus()}");
        }