Exemplo n.º 1
0
        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);
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
        /*public EmployeePlanningWeek(Employee empl, DateTime from,DateTime to)
        {
            Debug.Assert(from.DayOfWeek == DayOfWeek.Monday);
            Debug.Assert(to.DayOfWeek == DayOfWeek.Sunday);

            _employee = empl;
            BeginDate = from;
            EndDate = to;

            DateTime d = BeginDate ;
            while (d <= EndDate)
            {
                _dictionDays[d] = new EmployeePlanningDay(this, PlanningEmployee, d);
                d = d.AddDays(1);
            }
        }*/
        public EmployeePlanningWeek(long id, string fullname, DateTime from, DateTime to)
        {
            Debug.Assert(from.DayOfWeek == DayOfWeek.Monday);
            Debug.Assert(to.DayOfWeek == DayOfWeek.Sunday);

            _EmployeeId = id;
            _EmployeeFullName = fullname;
            BeginDate = from;
            EndDate = to;

            DateTime d = BeginDate;
            while (d <= EndDate)
            {
                _dictionDays[d] = new EmployeePlanningDay(this, d);
                d = d.AddDays(1);
            }
        }
Exemplo n.º 3
0
        /*public EmployeePlanningWeek(Employee empl, DateTime from,DateTime to)
         * {
         *  Debug.Assert(from.DayOfWeek == DayOfWeek.Monday);
         *  Debug.Assert(to.DayOfWeek == DayOfWeek.Sunday);
         *
         *  _employee = empl;
         *  BeginDate = from;
         *  EndDate = to;
         *
         *  DateTime d = BeginDate ;
         *  while (d <= EndDate)
         *  {
         *      _dictionDays[d] = new EmployeePlanningDay(this, PlanningEmployee, d);
         *      d = d.AddDays(1);
         *  }
         * }*/

        public EmployeePlanningWeek(long id, string fullname, DateTime from, DateTime to)
        {
            Debug.Assert(from.DayOfWeek == DayOfWeek.Monday);
            Debug.Assert(to.DayOfWeek == DayOfWeek.Sunday);

            _EmployeeId       = id;
            _EmployeeFullName = fullname;
            BeginDate         = from;
            EndDate           = to;

            DateTime d = BeginDate;

            while (d <= EndDate)
            {
                _dictionDays[d] = new EmployeePlanningDay(this, d);
                d = d.AddDays(1);
            }
        }
Exemplo n.º 4
0
        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;
                }
            }
        }
Exemplo n.º 5
0
        public static void ResetTimesForDate(List <EmployeePlanningWeek> planningemployee, DateTime date)
        {
            if (planningemployee != null)
            {
                EmployeePlanningDay epd = null;

                foreach (EmployeePlanningWeek epw in planningemployee)
                {
                    if (epw.Days.ContainsKey(date))
                    {
                        epd = epw.Days[date];
                        if (epd.WorkingTimeList != null)
                        {
                            epd.WorkingTimeList.Clear();
                        }
                        if (epd.AbsenceTimeList != null)
                        {
                            epd.AbsenceTimeList.Clear();
                        }
                    }
                }
            }
        }
Exemplo n.º 6
0
        public bool IsHasWorldByDate(long id, DateTime date)
        {
            EmployeePlanningDay epd = Days[date];

            return(epd.WorldId == id);
        }