Ejemplo n.º 1
0
        /// <summary>
        /// Applies all Staff Preferences in the given month to the shifts within the Month
        /// </summary>
        /// <param name="p_Month"></param>
        public void ApplyPreferences(Month p_Month)
        {
            // Iterate over all Shifts
            foreach (Shift _Shift in p_Month.GetShifts())
            {
                // Iterate over all Preferenced Time Windows
                foreach (UserTimeSpanPreference _Pref in m_CurrentlyStoredPreferences)
                {
                    // Check if both overlap and Add the Preference to the Shift
                    if (_Shift.ContainsTimeSpan(_Pref.m_Start, _Pref.m_End))
                    {
                        _Shift.possibleUsers.Add(new Shift.UserShift(_Pref.m_User, _Pref.m_Preference));
                    }
                }

                // TODO: Fill every other User with no Preferences with a Default Shift Preference
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Applies all Staff Preferences in the given month to the shifts within the Month
        /// </summary>
        /// <param name="p_Month"></param>
        public void ApplyPreferences( Month p_Month )
        {
            // Iterate over all Shifts
            foreach (Shift _Shift in p_Month.GetShifts())
            {
                // Iterate over all Preferenced Time Windows
                foreach (UserTimeSpanPreference _Pref in m_CurrentlyStoredPreferences)
                {
                    // Check if both overlap and Add the Preference to the Shift
                    if (_Shift.ContainsTimeSpan( _Pref.m_Start, _Pref.m_End ))
                    {
                        _Shift.possibleUsers.Add( new Shift.UserShift( _Pref.m_User, _Pref.m_Preference ) );
                    }
                }

                // TODO: Fill every other User with no Preferences with a Default Shift Preference
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Calculates the Shifts for the given settings
        /// </summary>
        public static void Calculate()
        {
            // generate new shifts
            Current.GenerateShifts(settings);


            // Apply the Preferences of the Staff to the Current Month
            Preferences.ApplyPreferences(Current);


            Dictionary <string, int> hourDictionary = new Dictionary <string, int>();

            // iterate over all shifts
            foreach (Shift shift in Current.GetShifts())
            {
                // calculate the shift
                CalculateShift(shift, ref hourDictionary);
            }
        }