コード例 #1
0
        public frmSchedule()
        {
            InitializeComponent();
            year    = System.DateTime.Now.Year;
            plan    = new AcademicYear[1];
            mainDB  = CourseDB.LoadDB();
            plan[0] = AcademicYear.LoadYear(year);

            if (mainDB == null)
            {
                mainDB = new CourseDB(1000);
                mainDB.SaveDB();
            }

            if (plan[0] == null)
            {
                plan[0] = new AcademicYear(year);
                plan[0].SaveYear();
            }

            plan[0].Fall.PopulateListBox(lbxFall);
            plan[0].Winter.PopulateListBox(lbxWinter);
            plan[0].Spring.PopulateListBox(lbxSpring);
            plan[0].Summer.PopulateListBox(lbxSummer);
            mainDB.PopulateListBox(lbxAvailable);
            yearIndex = 0;
        }
コード例 #2
0
        public frmBuilder()
        {
            InitializeComponent();

            if ((mainDB = CourseDB.LoadDB()) == null)
            {
                mainDB = new CourseDB(1000);
                mainDB.SaveDB();
            }

            mainDB.PopulateListBox(lbxCList);
        }
コード例 #3
0
        private void   cmdGo_Click(object sender, EventArgs e)
        {
            try
            {
                string id      = GetString(txtCourseID);
                string name    = GetString(txtCourseName);
                byte   units   = 0;
                NList  prereqs = new NList();

                if (!Byte.TryParse(GetString(txtCourseUnits), out units))
                {
                    units = 0;
                }

                foreach (object course in lbxPrereqs.Items)
                {
                    prereqs.Append((Course)course);
                }

                Course cs = new Course(id,
                                       name,
                                       units,
                                       cbxFall.Checked,
                                       cbxWinter.Checked,
                                       cbxSpring.Checked,
                                       cbxSummer.Checked,
                                       prereqs,
                                       null);

                mainDB.Add(id, cs);
                mainDB.SaveDB();
                mainDB.PopulateListBox(lbxCList);
            }
            catch (Exception ex)
            {
                MessageBox.Show(String.Format("Error creating course. {0}", ex.Message));
            }
        }