Exemplo n.º 1
0
        private bool CheckForConflict(Preference preference)
        {
            var noPrefCount = PreferenceCounter.CountPreference(preference, CurrentMeeting.Participants, CurrentMeeting.ScheduledTimeSlot);

            if (noPrefCount >= 1)
            {
                return(true);
            }

            return(false);
        }
        private string FindEarliestSlot(List <MeetingParticipant> participants)
        {
            var SlotsPreferenceCount = new Dictionary <string, int>
            {
                { "Slot 1", PreferenceCounter.CountPreference(Preference.Excluded, participants, "Slot 1") },
                { "Slot 2", PreferenceCounter.CountPreference(Preference.Excluded, participants, "Slot 2") },
                { "Slot 3", PreferenceCounter.CountPreference(Preference.Excluded, participants, "Slot 3") },
                { "Slot 4", PreferenceCounter.CountPreference(Preference.Excluded, participants, "Slot 4") },
                { "Slot 5", PreferenceCounter.CountPreference(Preference.Excluded, participants, "Slot 5") }
            };

            foreach (var kvp in SlotsPreferenceCount)
            {
                if (kvp.Value == 0)
                {
                    return(kvp.Key);
                }
            }

            return("No Slots");
        }
        private string FindEarliestAlternatice(List <MeetingParticipant> participants)
        {
            var SlotsPreferenceCount = new Dictionary <string, int>
            {
                { "Slot 1", PreferenceCounter.CountPreference(Preference.Excluded, participants, "Slot 1") },
                { "Slot 2", PreferenceCounter.CountPreference(Preference.Excluded, participants, "Slot 2") },
                { "Slot 3", PreferenceCounter.CountPreference(Preference.Excluded, participants, "Slot 3") },
                { "Slot 4", PreferenceCounter.CountPreference(Preference.Excluded, participants, "Slot 4") },
                { "Slot 5", PreferenceCounter.CountPreference(Preference.Excluded, participants, "Slot 5") }
            };

            foreach (var kvp in SlotsPreferenceCount)
            {
                if (kvp.Value == 0)
                {
                    return(kvp.Key);
                }
            }

            return($"No Slots for {MeetingDate.Content}. \nTry another Date.");
        }
        private string FindMostPreferedSlot(List <MeetingParticipant> participants)
        {
            var SlotsPreferenceCount = new Dictionary <string, int>
            {
                { "Slot 1", PreferenceCounter.CountPreference(Preference.Prefered, participants, "Slot 1") },
                { "Slot 2", PreferenceCounter.CountPreference(Preference.Prefered, participants, "Slot 2") },
                { "Slot 3", PreferenceCounter.CountPreference(Preference.Prefered, participants, "Slot 3") },
                { "Slot 4", PreferenceCounter.CountPreference(Preference.Prefered, participants, "Slot 4") },
                { "Slot 5", PreferenceCounter.CountPreference(Preference.Prefered, participants, "Slot 5") }
            };

            var max = new KeyValuePair <string, int>();

            foreach (var kvp in SlotsPreferenceCount)
            {
                if (kvp.Value > max.Value)
                {
                    max = kvp;
                }
            }

            return(max.Key);;
        }