public static void AssignTimes(List <EmployeePlanningWeek> planningemployee,
                                       List <WorkingTimePlanning> worktimes,
                                       List <AbsenceTimePlanning> absencetimes)
        {
            Dictionary <long, EmployeePlanningWeek> dict = ListToDictionary(planningemployee);


            EmployeePlanningWeek currentWeekEmployee = null;
            EmployeePlanningDay  currentDayEmployee  = null;

            if (worktimes != null)
            {
                foreach (WorkingTimePlanning wtp in worktimes)
                {
                    if (dict.TryGetValue(wtp.EmployeeID, out currentWeekEmployee))
                    {
                        if (currentWeekEmployee.Days.TryGetValue(wtp.Date, out currentDayEmployee))
                        {
                            if (currentDayEmployee.WorkingTimeList == null)
                            {
                                currentDayEmployee.WorkingTimeList = new List <WorkingTimePlanning> ();
                            }
                            currentDayEmployee.WorkingTimeList.Add(wtp);
                        }
                    }
                }
            }

            if (absencetimes != null)
            {
                foreach (AbsenceTimePlanning atp in absencetimes)
                {
                    if (dict.TryGetValue(atp.EmployeeID, out currentWeekEmployee))
                    {
                        if (currentWeekEmployee.Days.TryGetValue(atp.Date, out currentDayEmployee))
                        {
                            if (currentDayEmployee.AbsenceTimeList == null)
                            {
                                currentDayEmployee.AbsenceTimeList = new List <AbsenceTimePlanning>();
                            }
                            currentDayEmployee.AbsenceTimeList.Add(atp);
                        }
                    }
                }
            }
        }
        public static void AssignTimes(List <EmployeePlanningWeek> planningemployee,
                                       long employeeid,
                                       DateTime date,
                                       List <WorkingTimePlanning> worktimes,
                                       List <AbsenceTimePlanning> absencetimes)
        {
            Dictionary <long, EmployeePlanningWeek> dict = ListToDictionary(planningemployee);


            EmployeePlanningWeek currentWeekEmployee = null;
            EmployeePlanningDay  currentDayEmployee  = null;


            if (dict.TryGetValue(employeeid, out currentWeekEmployee))
            {
                if (currentWeekEmployee.Days.TryGetValue(date, out currentDayEmployee))
                {
                    currentDayEmployee.WorkingTimeList = worktimes;
                    currentDayEmployee.AbsenceTimeList = absencetimes;
                }
            }
        }
Exemple #3
0
 public EmployeePlanningDay(EmployeePlanningWeek parent, /*Employee empl, */ DateTime d)
 {
     _owner = parent;
     //_employee = empl;
     Date = d;
 }
 public EmployeePlanningDay(EmployeePlanningWeek parent, /*Employee empl, */DateTime d)
 {
     _owner = parent;
     //_employee = empl;
     Date = d;
 }