private void dgvEnrollmentPreRequisites_CellContentClick(object sender, DataGridViewCellEventArgs e) { //Enrollment PreRequisiteEnrollment = ((CurriculumCourseEnrollment)curriculumCourseEnrollmentPreRequisiteCourseBindingSource.Current).Enrollment; CurriculumCourseEnrollment CurriculumCourseEnrollmentObj = ((CurriculumCourseEnrollment)curriculumCourseEnrollmentPreRequisiteCourseBindingSource.Current); switch (e.ColumnIndex) { case 3: this.CurrentEnrollmentPreRequisiteID = CurriculumCourseEnrollmentObj.Enrollment.EnrollmentID; this.CurrentCurriculumCourseEnrollmentID = CurriculumCourseEnrollmentObj.CurriculumCourseEnrollmentID; this.refreshEnrollment(); this.hideAddCourseForEnrollment(); break; case 4: if (Convert.ToInt32(dgvEnrollmentPreRequisites.Rows[e.RowIndex].Cells[e.ColumnIndex].Tag) == 0) { using (frmEnrollmentException frm = new frmEnrollmentException()) { frm.CurrentEmployeeLoggedIn = this.CurrentEmployeeLoggedIn; frm.EnquiryID = CurrentEquiryID; frm.SelectedCurriculumCourseEnrollment = (CurriculumCourseEnrollment)curriculumCourseEnrollmentPreRequisiteCourseBindingSource.Current; frm.ShowDialog(); } } else { } refreshEnrollment(); break; } }
private void button3_Click(object sender, EventArgs e) { frmEnrollmentException frm = new frmEnrollmentException(); frm.CurrentEmployeeLoggedIn = CurrentEmployeeLoggedIn; using (var Dbconnection = new MCDEntities()) { frm.SelectedCurriculumCourseEnrollment = (from a in Dbconnection.CurriculumCourseEnrollments orderby a.EnrollmentID descending select a).FirstOrDefault <CurriculumCourseEnrollment>(); frm.ShowDialog(); } }