Ejemplo n.º 1
0
        public Schedule(List <Employee> existing, List <Employee> newemployees, List <Employee> formeremployees, Department department)
        {
            this.department       = department;
            firstDayOfCurrentWeek = TimeControl.FirstDayOfWeek(DateTime.Today);
            fullListemployees     = existing;
            formerEList           = formeremployees;
            stageforChanges       = new List <Shift>();

            foreach (Employee ne in newemployees)
            {
                if (!fullListemployees.Contains(ne))
                {
                    fullListemployees.Add(ne);
                }
            }

            allshifts = conn.LoadShifts(department, fullListemployees);
            newshifts = new List <Shift>();
            presentAndFutureShifts = new List <Shift>();
            foreach (Shift s in allshifts)
            {
                if (s.Date >= firstDayOfCurrentWeek)
                {
                    presentAndFutureShifts.Add(s);
                }
            }
            preferences  = conn.LoadPreferences();
            availability = conn.LoadAcceptedAbsence();
            limitStorage = conn.LoadAssigningLimits();
        }
Ejemplo n.º 2
0
        public List <Shift> GetAllShiftsForAWeek(DateTime day)
        {
            DateTime     firstDayOfSelectedWeek = TimeControl.FirstDayOfWeek(day);
            List <Shift> templist = new List <Shift>();

            foreach (Shift s in presentAndFutureShifts)
            {
                if (s.Date >= firstDayOfSelectedWeek && s.Date <= firstDayOfSelectedWeek.AddDays(6))
                {
                    templist.Add(s);
                }
            }
            return(templist);
        }