コード例 #1
0
        public EditClass(StudentWorker selectedStudentWorker, int eventDetailsID)
        {
            InitializeComponent();
            deleteButton.Visible = true;

            checkBoxes    = new CheckBox[] { mondayCheckBox, tuesdayCheckBox, wednesdayCheckBox, thursdayCheckBox, fridayCheckBox };
            studentWorker = selectedStudentWorker;
            studentWorkerNameLabel.Text = selectedStudentWorker.Name;
            isNewClass     = false;
            EventDetailsID = eventDetailsID;

            // add class meeting times for the class to edit
            oldClass = DatabaseManager.GetClass(EventDetailsID);
            DatabaseManager.RemoveClass(EventDetailsID);                // remove the class from database while editing so new times will not conflict with times of the same class
            if (oldClass.Count > 0)
            {
                classNameTextBox.Text = oldClass[0].EventName;
            }
            foreach (CalendarEvent classEvent in oldClass)
            {
                newClassSchedule.AddEvent(classEvent);
                ClassMeetingTimePanel newTimePanel = new ClassMeetingTimePanel();
                classTimePanel.Controls.Add(newTimePanel);
            }
            LayoutTimePanels();
        }