示例#1
0
文件: Form1.cs 项目: cimren/Scheduler
        private void btnCreateSchedule_Click(object sender, EventArgs e)
        {
            dataGridView1.Rows.Clear();
            cbxSchedules.Items.Clear();

            List <Array> myList = new List <Array>();

            for (int i = 0; i < selectedCourses.Count; i++)
            {
                myList.Add(selectedCourses[i].sectionNumbers);
            }

            CombinationContext cmbContext = new CombinationContext();

            cmbContext.setCombinationStrategy(new StringCombination(myList));

            ArrayList combinations = cmbContext.getCombinations();

            List <Schedule> schedules = sc.createSchedules(selectedCourses, combinations);

            richTextBox1.Text += "\nCakisma olmayan programlar: \n ";
            foreach (Schedule sch in sc.nonOverlappedSchedules)
            {
                foreach (Lecture lec in sch.lectureList)
                {
                    richTextBox1.Text += lec.section.sectionNumber.ToString() + " ";
                }
                richTextBox1.Text += "\n";
            }

            insertRows();

            lblSchedules.Text = sc.nonOverlappedSchedules.Count.ToString() + " schedules possible.";
            for (int i = 1; i <= sc.nonOverlappedSchedules.Count; i++)
            {
                cbxSchedules.Items.Add(i.ToString());
            }
        }
示例#2
0
文件: Form1.cs 项目: cimren/Scheduler
        private void btnCreateSchedule_Click(object sender, EventArgs e)
        {
            dataGridView1.Rows.Clear();
            cbxSchedules.Items.Clear();

            List<Array> myList = new List<Array>();

            for (int i = 0; i < selectedCourses.Count; i++)
            {
                myList.Add(selectedCourses[i].sectionNumbers);
            }

            CombinationContext cmbContext = new CombinationContext();
            cmbContext.setCombinationStrategy(new StringCombination(myList));

            ArrayList combinations = cmbContext.getCombinations();
    
            List<Schedule> schedules = sc.createSchedules(selectedCourses, combinations);

            richTextBox1.Text+="\nCakisma olmayan programlar: \n ";
            foreach (Schedule sch in sc.nonOverlappedSchedules)
            {
                foreach (Lecture lec in sch.lectureList)
                {
                    richTextBox1.Text+=lec.section.sectionNumber.ToString() + " ";
                }
                richTextBox1.Text+="\n" ;
                
            }

            insertRows();

            lblSchedules.Text = sc.nonOverlappedSchedules.Count.ToString() + " schedules possible.";
            for (int i = 1; i <= sc.nonOverlappedSchedules.Count; i++)
            {
                cbxSchedules.Items.Add(i.ToString());
            }
        }