Example #1
0
        private static void DebugReport(TimeSlot[] ts, string item, Cal c)
        {
            string stud = item + "\t";
            foreach (var tst in ts)
            {
                bool free = c.IsFreeOn(tst);
                bool bPossible = free;

                if (bPossible)
                {
                    if (c.IsDayFree(tst.dayOfWeek))
                        bPossible = false;
                }

                if (bPossible)
                {
                    int aft = c.ContinuousStretchAfter(tst);
                    int bef = c.ContinuousStretchBefore(tst);
                    int totSlot = aft + 2 + bef;
                    if (totSlot > 4)
                        bPossible = false;
                }

                if (bPossible)
                    stud += "True\t";
                else
                    stud += "\t";
            }
            Debug.WriteLine(stud);
        }
Example #2
0
        private void button2_Click(object sender, EventArgs e)
        {
            TimeSlot[] ts = new TimeSlot[]
            {
                new TimeSlot(CalItem.GetDay("Monday"), 16, 18),
                new TimeSlot(CalItem.GetDay("Wednesday"), 17, 19),
                new TimeSlot(CalItem.GetDay("Friday"), 9, 11),
                new TimeSlot(CalItem.GetDay("Friday"), 11, 13),
                new TimeSlot(CalItem.GetDay("Friday"), 15, 17),
            };

            foreach (var item in dic.Keys)
            {
                DebugReport(ts, item, dic[item]);
            }
        }