private void btnGenerate_Click(object sender, EventArgs e) { string teacherName = string.Empty; if (teach != null) { teacherName = teach.LastName + ", " + teach.FirstName + " "; if (teach.MiddleName != string.Empty || teach.MiddleName == " ") { teacherName = teacherName + " " + teach.MiddleName.Substring(0, 1) + "."; } } GradeLevel glSelected = new GradeLevel(); glSelected = gradeLevels.Find(x => x.GradeLev == cmbGradeLevel.SelectedValue.ToString()); string category = string.Empty; switch (glSelected.Category) { case 1: category = "Primary"; break; case 2: category = "Secondary"; break; case 3: category = "Tertiary"; break; case 4: category = "College"; break; default: category = ""; break; } string gradeLevelSection = cmbGradeLevel.Text + " - " + cmbSection.Text; if (cmbGradeLevel.Text != string.Empty || cmbSection.Text != string.Empty || cmbSY.Text != string.Empty) { if (_report == "Grading Sheet") { if (cmbReportType.Text == "Subjects") { frmGradingSheetTemplate1 fmGradingSheet = new frmGradingSheetTemplate1(); fmGradingSheet.setVars(cmbSY.Text, cmbGradeLevel.SelectedValue.ToString(), cmbSection.SelectedValue.ToString(), teacherName, gradeLevelSection, txtSection.Text); fmGradingSheet.ShowDialog(); } if (cmbReportType.Text == "Traits") { frmGradingSheetTrait1 fmGradingSheet = new frmGradingSheetTrait1(); fmGradingSheet.setVars(cmbSY.Text, cmbGradeLevel.SelectedValue.ToString(), cmbSection.SelectedValue.ToString(), teacherName, gradeLevelSection, txtSection.Text, glSelected.Category); fmGradingSheet.ShowDialog(); } } if (_report == "Promotional") { PromotionalTemplate1 pm1 = new PromotionalTemplate1(); pm1.setVars(cmbSY.Text, cmbGradeLevel.SelectedValue.ToString(), cmbSection.SelectedValue.ToString(),cmbSection.Text, teacherName, category, txtSection.Text); pm1.Show(); } } }
private void btnGenerate_Click(object sender, EventArgs e) { string teacherName = string.Empty; if (cmbSection.SelectedIndex == -1) { return; } if (teach != null) { teacherName = teach.LastName + ", " + teach.FirstName + " "; if (teach.MiddleName != string.Empty || teach.MiddleName == " ") { teacherName = teacherName + " " + teach.MiddleName.Substring(0, 1) + "."; } } GradeLevel glSelected = new GradeLevel(); glSelected = gradeLevels.Find(x => x.GradeLev == cmbGradeLevel.SelectedValue.ToString()); string category = string.Empty; switch (glSelected.Category) { case 1: category = "Primary"; break; case 2: category = "Secondary"; break; case 3: category = "Tertiary"; break; case 4: category = "College"; break; default: category = ""; break; } string gradeLevelSection = cmbGradeLevel.Text + " - " + cmbSection.Text; if (cmbGradeLevel.Text != string.Empty || cmbSection.Text != string.Empty || cmbSY.Text != string.Empty) { if (_report == "Grading Sheet") { if (cmbReportType.Text == "Subjects") { frmGradingSheetTemplate1 fmGradingSheet = new frmGradingSheetTemplate1(); fmGradingSheet.setVars(cmbSY.Text, cmbGradeLevel.SelectedValue.ToString(), cmbSection.SelectedValue.ToString(), teacherName, gradeLevelSection, txtSection.Text); fmGradingSheet.ShowDialog(); } if (cmbReportType.Text == "Traits") { frmGradingSheetTrait1 fmGradingSheet = new frmGradingSheetTrait1(); fmGradingSheet.setVars(cmbSY.Text, cmbGradeLevel.SelectedValue.ToString(), cmbSection.SelectedValue.ToString(), teacherName, gradeLevelSection, txtSection.Text, glSelected.Category); fmGradingSheet.ShowDialog(); } } if (_report == "Promotional") { PromotionalTemplate1 pm1 = new PromotionalTemplate1(); pm1.setVars(cmbSY.Text, cmbGradeLevel.SelectedValue.ToString(), cmbSection.SelectedValue.ToString(), cmbSection.Text, teacherName, category, txtSection.Text); pm1.Show(); } } }