Example #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;
        }
Example #2
0
 private void btn_add_Click(object sender, EventArgs e)
 {
     if (GlobalData.usedSubjects())
     {
         var editor = new SubjectEditor(null);
         editor.ShowDialog();
         if (editor.DialogResult == DialogResult.Yes)
         {
             GlobalData.useSubjects();
         }
     }
     else if (GlobalData.usedStudents())
     {
         var editor = new StudentEditor(null);
         editor.ShowDialog();
         if (editor.DialogResult == DialogResult.Yes)
         {
             GlobalData.useStudents();
         }
     }
 }
Example #3
0
 private void dgview_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     if (GlobalData.usedSubjects() && (GlobalData.Bind.Current is Subject))
     {
         var editor = new SubjectEditor(GlobalData.Bind.Current as Subject);
         editor.ShowDialog();
         if (editor.DialogResult == DialogResult.Yes)
         {
             GlobalData.useSubjects();
         }
     }
     else if (GlobalData.usedStudents() && (GlobalData.Bind.Current is Student))
     {
         var editor = new StudentEditor(GlobalData.Bind.Current as Student);
         editor.ShowDialog();
         if (editor.DialogResult == DialogResult.Yes)
         {
             GlobalData.useStudents();
         }
     }
 }
Example #4
0
 private void student_view_btn_Click(object sender, EventArgs e)
 {
     GlobalData.useStudents();
 }