private void dgvApprenticeshipTab_PrerequisiteCourses_CellContentClick(object sender, DataGridViewCellEventArgs e) { switch (e.ColumnIndex) { case 0: break; case 1: frmEnrollmentException frm1 = new frmEnrollmentException(); frm1.CurrentEmployeeLoggedIn = this.CurrentEmployeeLoggedIn; frm1.SelectedEnrollment = (Enrollment)apprenticeshipPreRequisteCurriculumCourseBindingSource.Current; //int x = (int)dgvAprenticeshipTab_Enrollment.Rows[dgvAprenticeshipTab_Enrollment.CurrentRow.Index].Cells[colApprenticeshipEnqiry.Index].Value; frm1.EnquiryID = Convert.ToInt32(dgvAprenticeshipTab_Enrollment.Rows[dgvAprenticeshipTab_Enrollment.CurrentRow.Index].Cells[colApprenticeshipEnqiry.Index].Value); frm1.ShowDialog(); int iCurrentPosition = apprenticeshipPreRequisteCurriculumCourseBindingSource.Position; apprenticeshipPreRequisteCurriculumCourseBindingSource.ResetItem(iCurrentPosition); //refreshApprenticeshipCoursePreRequisites(); //apprenticeshipPreRequisteCurriculumCourseBindingSource.Position = iCurrentPosition; break; case 2: frmScheduleApprenticeship frm = new frmScheduleApprenticeship(); frm.ShowDialog(); break; } }
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(); } }