private System.Web.UI.WebControls.Table Create_Rec_Table(MirrorCLS myMirror)
        {
            System.Web.UI.WebControls.Table MyTable = new System.Web.UI.WebControls.Table();
            try
            {
                myList.Add(myMirror);
                //First Row
                MyTable.Width       = Unit.Percentage(100);
                MyTable.BorderWidth = 1;
                MyTable.GridLines   = GridLines.Horizontal;


                TableRow  tr = new TableRow();
                TableCell td = new TableCell();


                //Fifth
                tr.CssClass   = "th";
                td.ColumnSpan = 4;
                td.Text       = "Student Mirror";
                tr.Cells.Add(td);
                MyTable.Rows.Add(tr);

                tr            = new TableRow();
                td            = new TableCell();
                td.ColumnSpan = 4;


                string sPath  = "";
                string sTable = "<table align='left' border='1' >";
                sTable += "<tr>";

                int    iMax    = 0;
                string sDegree = myMirror.SDegree;
                string sMajor  = myMirror.SMajor;
                //Get the count of general courses
                iMax = LibraryMOD.GetMajorGeneralIndex(sDegree, sMajor);

                for (int i = 0; i < iMax; i++)
                {
                    sPath   = "Images/Majors/GIF/" + myMirror.Mirror[i].sCourse + ".gif";
                    sTable += "<td><img alt='' src='" + sPath + "' /></td>";
                }
                sTable += "</tr>";
                sTable += "<tr>";

                for (int i = 0; i < iMax; i++)
                {
                    if (myMirror.Mirror[i].isRecommended)
                    {
                        sTable += "<td style='font-family: Arial, Helvetica, sans-serif; font-size: small; color: #000000; text-align: center; vertical-align: top; background-color: #F2B702'>" + myMirror.Mirror[i].sGrade + "</td>";
                    }
                    else
                    {
                        sTable += "<td style='font-family: Arial, Helvetica, sans-serif; font-size: small; color: #000000; text-align: center; vertical-align: top'>" + myMirror.Mirror[i].sGrade + "</td>";
                    }
                }
                sTable += "</tr>";
                sTable += "</table>";

                Literal Lt = new Literal();
                Lt.Text = sTable;
                td.Controls.Add(Lt);
                tr.Cells.Add(td);

                MyTable.Rows.Add(tr);

                tr            = new TableRow();
                td            = new TableCell();
                td.ColumnSpan = 4;

                int iCourses = 0;
                iCourses = myMirror.Mirror.Length;

                sPath   = "";
                sTable  = "<table align='left' border='1' >";
                sTable += "<tr>";
                for (int i = iMax; i < iCourses; i++)
                {
                    sPath   = "Images/Majors/GIF/" + myMirror.Mirror[i].sCourse + ".gif";
                    sTable += "<td><img alt='' src='" + sPath + "' /></td>";
                }
                sTable += "</tr>";
                sTable += "<tr>";
                for (int i = iMax; i < iCourses; i++)
                {
                    if (myMirror.Mirror[i].isRecommended)
                    {
                        sTable += "<td style='font-family: Arial, Helvetica, sans-serif; font-size: small; color: #000000; text-align: center; vertical-align: top; background-color: #F2B702'>" + myMirror.Mirror[i].sGrade + "</td>";
                    }
                    else
                    {
                        sTable += "<td style='font-family: Arial, Helvetica, sans-serif; font-size: small; color: #000000; text-align: center; vertical-align: top'>" + myMirror.Mirror[i].sGrade + "</td>";
                    }
                }
                sTable += "</tr>";
                sTable += "</table>";

                Lt      = new Literal();
                Lt.Text = sTable;
                td.Controls.Add(Lt);
                tr.Cells.Add(td);

                MyTable.Rows.Add(tr);

                //Majoe Electives & Free Electives
                MirrorDAL myMirrorDAL = new MirrorDAL();

                tr            = new TableRow();
                td            = new TableCell();
                td.ColumnSpan = 4;

                string MElective = myMirrorDAL.GetMajorElectiveCourses(myMirror.StudentNumber, Campus);
                string FElective = myMirrorDAL.GetFreeElectiveCourses(myMirror.StudentNumber, Campus);
                if (MElective.Length > 0 || FElective.Length > 0)
                {
                    tr            = new TableRow();
                    td            = new TableCell();
                    td.ColumnSpan = 4;
                }
                td.Text = "";
                if (MElective.Length > 0)
                {
                    td.Text += "Major Electives: " + "[ " + MElective + " ]";
                }

                if (FElective.Length > 0)
                {
                    if (MElective.Length > 0)
                    {
                        td.Text += " --- ";
                    }
                    td.Text += "Free Electives [" + FElective + " ]";
                }
                if (MElective.Length > 0 || FElective.Length > 0)
                {
                    tr.Cells.Add(td);
                    MyTable.Rows.Add(tr);
                }

                //Recommended
                tr = new TableRow();
                td = new TableCell();

                tr.CssClass   = "th";
                td.ColumnSpan = 4;
                td.Text       = "Recommended Courses";

                tr.Cells.Add(td);
                MyTable.Rows.Add(tr);

                int iCompletedHours = LibraryMOD.GetCompletedHours(sNo, Campus);

                //Tr=new TableRow();
                for (int i = 0; i < myMirror.Recommended.Count; i++)
                {
                    if ((iCompletedHours < 99 && myMirror.Recommended[i].sCourse.Contains("415") && myMirror.Recommended[i].sCourse != "RTV415") || (iCompletedHours < 99 && myMirror.Recommended[i].sCourse.Contains("419")))
                    {
                        //dont add Internship & graduation project in completed hours less than 99 credit hours
                    }
                    else
                    {
                        tr = new TableRow();
                        if (myMirror.Recommended[i].isOver)
                        {
                            tr.CssClass = "R_Critical";
                        }
                        else
                        {
                            if (i % 2 == 0)
                            {
                                tr.CssClass = "R_NormalWhite";
                            }
                            else
                            {
                                tr.CssClass = "R_NormalGray";
                            }
                        }
                        td                 = new TableCell();
                        td.Text            = (i + 1).ToString();
                        td.HorizontalAlign = HorizontalAlign.Center;
                        tr.Cells.Add(td);

                        td                 = new TableCell();
                        td.Text            = myMirror.Recommended[i].sCourse;
                        td.HorizontalAlign = HorizontalAlign.Center;
                        tr.Cells.Add(td);

                        td                 = new TableCell();
                        td.ColumnSpan      = 2;
                        td.Text            = myMirror.Recommended[i].sDesc;
                        td.HorizontalAlign = HorizontalAlign.Left;
                        tr.Cells.Add(td);

                        MyTable.Rows.Add(tr);
                    }
                }
            }
            catch (Exception ex)
            {
                LibraryMOD.ShowErrorMessage(ex);
            }
            finally
            {
            }
            return(MyTable);
        }
        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();
            }
        }