Beispiel #1
0
        public MainForm()
        {
            InitializeComponent();

            GlobalData.addStudent(new Student()
            {
                Name = "Ivanov I.I.", Group = "CE-12-4"
            });
            GlobalData.addStudent(new Student()
            {
                Name = "Petrov P.P.", Group = "CE-12-1"
            });

            GlobalData.addSubject(new Subject()
            {
                Name = "Programming"
            });
            GlobalData.addSubject(new Subject()
            {
                Name = "Sports"
            });

            Student student = GlobalData.findStudent("Ivanov I.I.");
            Subject subject = GlobalData.findSubject("Sports");

            student.addSubject(subject);

            GlobalData.useStudents();
            dgview.DataSource = GlobalData.Bind;
        }
Beispiel #2
0
        private void apply_btn_Click(object sender, EventArgs e)
        {
            if (studentName.Text == "")
            {
                Hide();
                return;
            }

            if (m_student == null)
            {
                m_student = new Student();
                GlobalData.addStudent(m_student);
            }

            m_student.Name  = studentName.Text;
            m_student.Group = groupName.Text;

            m_student.clearSubjects();
            foreach (Subject subject in selectedSubjects.Items)
            {
                m_student.addSubject(subject);
            }

            DialogResult = DialogResult.Yes;
            Hide();
        }