protected void drp_Course_SelectedIndexChanged(object sender, EventArgs e) { if (drp_Course.SelectedItem.Value != "---Select a Course---") { var services = new DAL.DAL(); Connection_StringCLS connstr = new Connection_StringCLS(Campus); int sem = 0; int Year = LibraryMOD.SeperateTerm(LibraryMOD.GetCurrentTerm(), out sem); int iYear = Year; int iSem = sem; string studentid = Session["CurrentStudent"].ToString(); DataTable dt = services.GetCoursesbyCourseId(studentid, connstr.Conn_string, iYear, iSem, drp_Course.SelectedItem.Value); if (dt.Rows.Count > 0) { lbl_CourseCode.Text = drp_Course.SelectedItem.Value; lbl_Instructor.Text = dt.Rows[0]["strLecturerDescEn"].ToString(); lbl_InstructorEmail.Text = LibraryMOD.GetAdvisorEmail(lbl_Instructor.Text); } } else { lbl_CourseCode.Text = ""; lbl_Instructor.Text = ""; lbl_InstructorEmail.Text = ""; } }
private void Export() { ReportDocument myReport = new ReportDocument(); List <Programs_Advisors> myAdvisors = new List <Programs_Advisors>(); Programs_AdvisorsDAL myAdvisorsDAL = new Programs_AdvisorsDAL(); RecommendationDAL myRecommendationDAL = new RecommendationDAL(); try { MirrorCLS myMirror = new MirrorCLS(); MirrorDAL myMirrorDAL = new MirrorDAL(); myMirror = myList[0]; DataSet rptDS = new DataSet(); rptDS = myRecommendationDAL.Prepare_RecommendationReport(myMirror); string reportPath = Server.MapPath("Reports/Recommended_Report3.rpt"); myReport.Load(reportPath); myReport.SetDataSource(rptDS); TextObject txt; int iCount = myMirror.Mirror.Length; if (iCount > 60) { iCount = 60; } for (int i = 0; i < 60; i++) { txt = (TextObject)myReport.ReportDefinition.ReportObjects["h" + (i + 1).ToString()]; txt.Text = ""; txt.Color = Color.White; txt.Color = Color.White; txt.Border.BorderColor = Color.White; txt.Border.BackgroundColor = Color.White; txt = (TextObject)myReport.ReportDefinition.ReportObjects["g" + (i + 1).ToString()]; txt.Text = ""; txt.Color = Color.White; txt.Border.BorderColor = Color.White; txt.Border.BackgroundColor = Color.White; } for (int i = 0; i < iCount; i++) { txt = (TextObject)myReport.ReportDefinition.ReportObjects["h" + (i + 1).ToString()]; txt.Text = myMirror.Mirror[i].sCourse; switch (myMirror.Mirror[i].iClass) { case 9: //MEelect txt.Text = myMirror.Mirror[i].sCourse + "*"; break; case 11: //CEelect txt.Text = myMirror.Mirror[i].sCourse + "#"; break; } txt.Color = Color.Black; txt.Border.BorderColor = Color.Black; txt.Border.BackgroundColor = Color.Silver; txt = (TextObject)myReport.ReportDefinition.ReportObjects["g" + (i + 1).ToString()]; txt.Text = myMirror.Mirror[i].sGrade; txt.Color = Color.Black; txt.Border.BorderColor = Color.Black; txt.Border.BackgroundColor = Color.White; } txt = (TextObject)myReport.ReportDefinition.ReportObjects["Major_txt"]; txt.Text = myMirror.Major; //Previous Semester Campus = (InitializeModule.EnumCampus)Session["CurrentCampus"]; txt = (TextObject)myReport.ReportDefinition.ReportObjects["txtregisteredCourseInPrevSem"]; if (iRegSem == 4) { int iRegCoursesPrevSem = 0; iRegCoursesPrevSem = LibraryMOD.GetRegCoursesPrevSem(myMirror.StudentNumber, iRegYear, iRegSem, Campus); txt.Text = "Previous Semester Courses : " + iRegCoursesPrevSem.ToString(); } else { txt.Text = ""; txt.Width = 0; } txt = (TextObject)myReport.ReportDefinition.ReportObjects["cgpa_txt"]; if (myMirror.CGPA != 101) { txt.Text = string.Format("{0:f}", myMirror.CGPA); } txt = (TextObject)myReport.ReportDefinition.ReportObjects["esl_txt"]; txt.Text = myMirror.Advisor; txt = (TextObject)myReport.ReportDefinition.ReportObjects["eng_txt"]; txt.Text = myMirror.ENG; txt = (TextObject)myReport.ReportDefinition.ReportObjects["score_txt"]; txt.Text = string.Format("{0:f}", myMirror.Score); txt = (TextObject)myReport.ReportDefinition.ReportObjects["Major_Free_Elective_txt"]; string MElective = myMirrorDAL.GetMajorElectiveCourses(myMirror.StudentNumber, Campus); string FElective = myMirrorDAL.GetFreeElectiveCourses(myMirror.StudentNumber, Campus); txt.Text = ""; if (MElective.Length > 0) { txt.Text += "Major Electives: " + "[ " + MElective + " ]"; } if (FElective.Length > 0) { if (MElective.Length > 0) { txt.Text += " --- "; } txt.Text += "Free Electives [" + FElective + " ]"; } txt = (TextObject)myReport.ReportDefinition.ReportObjects["Session_txt"]; txt.Text = myMirror.Period; txt = (TextObject)myReport.ReportDefinition.ReportObjects["Term_txt"]; string sTerm = LibraryMOD.GetTermDesc(iRegYear, iRegSem); txt.Text = sTerm; txt = (TextObject)myReport.ReportDefinition.ReportObjects["Advisor_txt"]; txt.Text = LibraryMOD.GetAdvisorEmail(myMirror.Advisor); txt = (TextObject)myReport.ReportDefinition.ReportObjects["txtTitle"]; txt.Text = myMirror.StudentNumber.Replace(".", "") + " - " + myMirror.Name; txt = (TextObject)myReport.ReportDefinition.ReportObjects["UserTXT"]; string sUserName = Session["CurrentUserName"].ToString(); txt.Text = sUserName; //coordinator_txt //advisors_txt string sCoordinator = ""; string sAdvisors = ""; string sMajor = ""; List <Applications> myStudent = new List <Applications>(); ApplicationsDAL myApplicationsDAL = new ApplicationsDAL(); myStudent = myApplicationsDAL.GetList(Campus, " lngStudentNumber='" + myMirror.StudentNumber + "'", false); if (myStudent.Count > 0) { sMajor = myStudent[0].strSpecialization; } myStudent.Clear(); myAdvisors = myAdvisorsDAL.GetPrograms_Advisors(Campus, sMajor); for (int i = 0; i < myAdvisors.Count; i++) { if (myAdvisors[i].byteCategory == 1) { sCoordinator += LibraryMOD.GetAdvisorEmail(myAdvisors[i].SAdvisor); } else { sAdvisors += LibraryMOD.GetAdvisorEmail(myAdvisors[i].SAdvisor) + ","; } } txt = (TextObject)myReport.ReportDefinition.ReportObjects["coordinator_txt"]; txt.Text = sCoordinator; txt = (TextObject)myReport.ReportDefinition.ReportObjects["advisors_txt"]; txt.Text = sAdvisors; myReport.ExportToHttpResponse(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, Page.Response, true, "ECTReport"); } catch (Exception exp) { Console.WriteLine("{0} Exception caught.", exp); } finally { myAdvisors.Clear(); myReport.Close(); myReport.Dispose(); } }
private System.Web.UI.WebControls.Table Create_Table(MirrorCLS myMirror) { System.Web.UI.WebControls.Table MyTable = new System.Web.UI.WebControls.Table(); try { myList.Add(myMirror); //First Row //MyTable.Width = 70%; MyTable.Width = Unit.Percentage(100); MyTable.BorderWidth = 1; MyTable.GridLines = GridLines.Horizontal; //MyTable.ID = "tblDetail"; TableHeaderRow Hr = new TableHeaderRow(); TableHeaderCell Hc = new TableHeaderCell(); TableCell Hd = new TableCell(); Hc.ColumnSpan = 4; Hc.Text = "Student Info"; Hc.HorizontalAlign = HorizontalAlign.Center; Hr.Cells.Add(Hc); MyTable.Rows.Add(Hr); //No Hr = new TableHeaderRow(); Hc = new TableHeaderCell(); Hc.Text = "No : "; //Hc.HorizontalAlign = HorizontalAlign.Center; Hr.Cells.Add(Hc); Hd = new TableCell(); Hd.Text = sNo.Replace(".", ""); Hd.HorizontalAlign = HorizontalAlign.Center; Hr.Cells.Add(Hd); //Name Hc = new TableHeaderCell(); Hc.Text = "Name : "; //Hc.HorizontalAlign = HorizontalAlign.Center; Hr.Cells.Add(Hc); Hd = new TableCell(); Hd.Text = sName; Hd.HorizontalAlign = HorizontalAlign.Center; Hr.Cells.Add(Hd); MyTable.Rows.Add(Hr); //Second Row Hr = new TableHeaderRow(); Hc = new TableHeaderCell(); Hc.Text = "Major : "; //Hc.HorizontalAlign = HorizontalAlign.Center; Hr.Cells.Add(Hc); Hd = new TableCell(); Hd.ColumnSpan = 3; Hd.Text = myMirror.Major; Hd.HorizontalAlign = HorizontalAlign.Center; Hr.Cells.Add(Hd); MyTable.Rows.Add(Hr); //Third Row Hr = new TableHeaderRow(); Hc = new TableHeaderCell(); Hc.Text = "CGPA : "; //Hc.HorizontalAlign = HorizontalAlign.Center; Hr.Cells.Add(Hc); Hd = new TableCell(); if (myMirror.CGPA != 101) { Hd.Text = string.Format("{0:F}", myMirror.CGPA); } Hd.HorizontalAlign = HorizontalAlign.Center; Hr.Cells.Add(Hd); Hc = new TableHeaderCell(); Hc.Text = "Advisor : "; //Hc.HorizontalAlign = HorizontalAlign.Center; Hr.Cells.Add(Hc); Hd = new TableCell(); //Get Max Esl (Advisor Now) Hd.HorizontalAlign = HorizontalAlign.Center; Hd.Text = LibraryMOD.GetAdvisorEmail(myMirror.Advisor); Hr.Cells.Add(Hd); MyTable.Rows.Add(Hr); //Fourth Row Hr = new TableHeaderRow(); Hc = new TableHeaderCell(); Hc.Text = "ENG : "; Hr.Cells.Add(Hc); Hd = new TableCell(); Hd.Text = myMirror.ENG; Hd.HorizontalAlign = HorizontalAlign.Center; Hr.Cells.Add(Hd); Hc = new TableHeaderCell(); Hc.Text = "Score : "; Hr.Cells.Add(Hc); Hd = new TableCell(); Hd.Text = string.Format("{0:F}", myMirror.Score); Hd.HorizontalAlign = HorizontalAlign.Center; Hr.Cells.Add(Hd); MyTable.Rows.Add(Hr); } catch (Exception ex) { LibraryMOD.ShowErrorMessage(ex); } finally { } return(MyTable); }