Ejemplo n.º 1
0
        public Meeting ToEntity()
        {
            var meeting = new Meeting
            {
                MeetingID = MeetingID,
                Title = Title,
                Start = Start,
                StartTimezone = StartTimezone,
                End = End,
                EndTimezone = EndTimezone,
                Description = Description,
                IsAllDay = IsAllDay,
                RecurrenceRule = RecurrenceRule,
                RecurrenceException = RecurrenceException,
                RecurrenceID = RecurrenceID,
                RoomID = RoomID
            };

            return meeting;
        }
Ejemplo n.º 2
0
        private List <int> PopulateMutualConflict()
        {
            object memory = lvMeetings.Columns[0].Tag;

            lvMeetings.Columns[0].Tag = null;
            this.SortBy(lvMeetings, new ColumnClickEventArgs(0));
            List <int> s1, s2;

            s1 = new List <int>();
            s2 = new List <int>();
            for (int i = 0; i < lvMeetings.Items.Count; i++)
            {
                s1.Add(i);
            }

            int[] penalties = new int[3] {
                Convert.ToInt32(tbxPenRR.Text), Convert.ToInt32(tbxPenRD.Text), Convert.ToInt32(tbxPenDD.Text)
            };

            //return s1;
            int greatestConflict = int.MinValue;
            int greatestRival1 = 0, greatestRival2 = 0;

            for (int n1 = 0; n1 < s1.Count - 1; n1++)
            {
                Meeting mtng1 = new Meeting(lvMeetings.Items[s1[n1]].Tag as MeetingSpec);
                for (int n2 = n1 + 1; n2 < s1.Count; n2++)
                {
                    Meeting mtng2 = new Meeting(lvMeetings.Items[s1[n2]].Tag as MeetingSpec);
                    string  dummy;
                    int     score = Schedule.EvaluateMeetingPair(mtng1, mtng2, false, out dummy, penalties);
                    if (score > greatestConflict)
                    {
                        greatestRival1   = s1[n1];
                        greatestRival2   = s1[n2];
                        greatestConflict = score;
                    }
                }
            }
            s2.Add(greatestRival1);
            s1.Remove(greatestRival1);
            if (greatestRival1 != 0 && greatestRival2 != 0)
            {
                s2.Add(greatestRival2);
                s1.Remove(greatestRival2);
            }
            // stage 2...
            while (s1.Count > 0)
            {
                greatestConflict = int.MinValue;
                greatestRival1   = s1[0];
                for (int n1 = 0; n1 < s1.Count; n1++)
                {
                    Meeting mtng1     = new Meeting(lvMeetings.Items[s1[n1]].Tag as MeetingSpec);
                    int     sumscores = 0;
                    for (int n2 = 0; n2 < s2.Count; n2++)
                    {
                        Meeting mtng2 = new Meeting(lvMeetings.Items[s2[n2]].Tag as MeetingSpec);
                        string  dummy;
                        int     score = Schedule.EvaluateMeetingPair(mtng1, mtng2, false, out dummy, penalties);
                        sumscores += score;
                    }
                    if (sumscores > greatestConflict)
                    {
                        greatestRival1   = s1[n1];
                        greatestConflict = sumscores;
                    }
                }
                s2.Add(greatestRival1);
                s1.Remove(greatestRival1);
            }
            lvMeetings.Columns[0].Tag = memory;
            return(s2);
        }