Exemple #1
0
        private void B_Enrol_Click(object sender, EventArgs e)
        {
            StudentAccessLayer SAL    = new StudentAccessLayer(Session.Database);
            Student            result = MakeStudent();

            try
            {
                if (_existingStudent == null) // If not editing a student
                {
                    result.Id = SAL.InsertStudent(result);
                }
                else // Updates student ID so existing record is updated
                {
                    result.Id = _existingStudent.Id;
                    SAL.UpdateStudent(result);
                }
            }
            catch (System.Data.SqlClient.SqlException ex)
            {
                MessageBox.Show("Student not added/updated.  There was an SQL issue: \n" + ex.Message, "SQL ERROR");
                return;
            }
            F_Enrolment ES = new F_Enrolment(result);

            ES.Show();
        }
Exemple #2
0
        // Buttons

        private void B_EnrolStudent_Click(object sender, EventArgs e)
        {
            // Makes sure that only one student is selected
            if (DGV_Students.SelectedRows.Count == 1)
            {
                StudentAccessLayer SAL = new StudentAccessLayer(Session.Database);
                F_Enrolment        ES  = new F_Enrolment(SAL.GetStudentById(Convert.ToInt32(DGV_Students.SelectedRows[0].Cells[0].Value.ToString())));
                ES.Show();  // Opening enrolment form
            }
            else
            {
                MessageBox.Show("You have selected more than 1 or less than 1 students.");
            }
        }