public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            rptCCEReportBackDaffo6TO8 rpt = new rptCCEReportBackDaffo6TO8();

            rpt.Site = this.Site;
            return(rpt);
        }
Esempio n. 2
0
        private void btnBackView_Click(object sender, EventArgs e)
        {
            int       Indexer = 0;
            DataTable dtTable = new DataTable("dtTable");

            this.NonPrimaryFlage = Convert.ToBoolean(Connection.GetExecuteScalar("Select NonPrimary From tbl_ClassMaster Where ClassCode = '" + cmbClass.SelectedValue + "'"));

            DataTable dtStudentMarksDetail  = Connection.GetDataTable("[dbo].[GetViewCCEMarksDetail] " + cmbClass.SelectedValue + "," + cmbScetion.SelectedValue + "," + school.CurrentSessionCode + "");
            DataTable dtStudentSkillsDetail = Connection.GetDataTable("Select (Case When t1.ExamCode=0 Then 'FA1_' When t1.ExamCode=1 Then 'FA2_' When t1.ExamCode=2 Then 'SA1_' When t1.ExamCode=3 Then 'FA3_' When t1.ExamCode=4 Then 'FA4_' When t1.ExamCode=5 Then 'SA2_' End) AS ExamCode , " +
                                                                      " t2.studentno StudentNo,t2.scholarno ScholarNo,t2.Name ,t1.SkillId ,t1.SkillName ,t1.Description ,t1.Grade  From ( " +
                                                                      " Select s2.ExamCode,s1.SkillId ,s1.SkillName ,s2.StudentNo ,s2.Description ,s2.Grade ,s2.ClassNo ,s2.SectionCode  From tbl_CCESkills s1,tbl_CCEStudentSkills s2 Where s1.SkillId =s2.SkillId And " +
                                                                      " s2.SectionCode ='" + cmbScetion.SelectedValue + "' And s2.ClassNo='" + cmbClass.SelectedValue + "' And s2.SessionCode ='" + school.CurrentSessionCode + "') t1 ,( " +
                                                                      " Select s.studentno ,s.scholarno ,s.name,cs.classno ,cs.Section ,cs.Stream  From tbl_student s ,tbl_classstudent cs Where cs.studentno =s.studentno And cs.sessioncode ='" + school.CurrentSessionCode + "'" +
                                                                      " And cs.classno ='" + cmbClass.SelectedValue + "' And cs.Section ='" + cmbScetion.SelectedValue + "') t2 " +
                                                                      " Where t1.StudentNo =t2.studentno And t1.SectionCode =t2.Section And t1.ClassNo =t2.classno Order By t1.SkillId ,t1.SkillName");
            DataTable dt = dtStudentMarksDetail.DefaultView.ToTable(true, "SessionCode", "StudentNo", "ScholarNo");

            dtTable.Columns.Add("SessionCode", typeof(int)); Indexer++;
            dtTable.Columns.Add("ScholarNo", typeof(string)); Indexer++;
            dtTable.Columns.Add("Name", typeof(string)); Indexer++;
            dtTable.Columns.Add("Height", typeof(string)); Indexer++;
            dtTable.Columns.Add("Width", typeof(string)); Indexer++;
            for (int i = 1; i <= 9; i++)
            {
                dtTable.Columns.Add("SubCode_" + i, typeof(string)); Indexer++;
                dtTable.Columns["SubCode_" + i].DefaultValue = "00";
                dtTable.Columns.Add("Sub_" + i, typeof(string)); Indexer++;
            }
            for (int j = 9; j < dtStudentMarksDetail.Columns.Count; j++)
            {
                string Sub = dtStudentMarksDetail.Columns[j].ColumnName;
                for (int i = 1; i <= 9; i++)
                {
                    dtTable.Columns.Add("Sub_" + i + "_" + Sub, typeof(string)); Indexer++;
                }
            }

            for (int r = 0; r < 2; r++)
            {
                //string Exam = (r["ExamCode"].Equals("0"))?"FA1_":(r["ExamCode"].Equals("1"))?"FA2_":(r["ExamCode"].Equals("2"))?"SA1_":
                //    (r["ExamCode"].Equals("3"))?"FA3_":(r["ExamCode"].Equals("4"))?"FA4_":(r["ExamCode"].Equals("5"))?"SA2_":"";

                dataReader = Connection.GetDataReader("SELECT SkillId, SkillName, Status FROM tbl_CCESkills Order By SkillId");
                if (dataReader.HasRows)
                {
                    string Exam = (r.Equals(0)) ? "SA1_" : "SA2_";
                    while (dataReader.Read())
                    {
                        dtTable.Columns.Add(Exam + dataReader["SkillName"].ToString(), typeof(string));
                        dtTable.Columns.Add(Exam + dataReader["SkillName"].ToString() + "_G", typeof(string));
                    }
                }
                dataReader.Close();
            }

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                DataRow[] Student = dtStudentMarksDetail.Select("StudentNo='" + dt.Rows[i]["StudentNo"] + "' And ScholarNo='" + dt.Rows[i]["ScholarNo"] + "'");
                DataRow   NewRow  = dtTable.NewRow();
                NewRow["SessionCode"] = Student[0]["SessionCode"]; NewRow["ScholarNo"] = Student[0]["ScholarNo"]; NewRow["Name"] = Student[0]["Name"];
                NewRow["Height"]      = Student[0]["Height"]; NewRow["Width"] = Student[0]["Width"];
                for (int subject = 1; subject <= Student.Length; subject++)
                {
                    NewRow["SubCode_" + subject] = Student[subject - 1]["SubjectCode"];
                    NewRow["Sub_" + subject]     = Student[subject - 1]["SubjectName"];
                }

                for (int subject = 1; subject <= Student.Length; subject++)
                {
                    for (int GetGrade = 9; GetGrade < dtStudentMarksDetail.Columns.Count; GetGrade++)
                    {
                        string Sub = dtStudentMarksDetail.Columns[GetGrade].ColumnName;
                        NewRow["Sub_" + subject + "_" + Sub] = Student[subject - 1][Sub];
                    }
                }

                if (dtStudentSkillsDetail != null)
                {
                    DataTable dtExam  = dtStudentSkillsDetail.DefaultView.ToTable(true, "ExamCode");
                    DataTable dtSkill = dtStudentSkillsDetail.DefaultView.ToTable(true, "SkillId", "SkillName");

                    if (this.NonPrimaryFlage)
                    {
                        for (int Exam = 0; Exam < dtExam.Rows.Count; Exam++)
                        {
                            for (int skill = 0; skill < dtSkill.Rows.Count; skill++)
                            {
                                string DI    = string.Empty;
                                string Grade = string.Empty;

                                DataRow[] desc = dtStudentSkillsDetail.Select("ExamCode='" + dtExam.Rows[Exam]["ExamCode"] + "' And SkillName='" + dtSkill.Rows[skill][1] + "' And StudentNo='" + dt.Rows[i]["StudentNo"] + "' And ScholarNo='" + dt.Rows[i]["ScholarNo"] + "'");
                                for (int des = 0; des < desc.Length; des++)
                                {
                                    DI    = DI + desc[des]["Description"].ToString();
                                    Grade = desc[0]["Grade"].ToString();
                                }
                                NewRow[dtExam.Rows[Exam]["ExamCode"].ToString() + dtSkill.Rows[skill][1].ToString()]        = DI.TrimEnd(',') + ".";
                                NewRow[dtExam.Rows[Exam]["ExamCode"].ToString() + dtSkill.Rows[skill][1].ToString() + "_G"] = Grade;
                            }
                        }
                    }
                    else
                    {
                        int      N  = Indexer;
                        DataView dv = dtExam.DefaultView;
                        dv.Sort = "ExamCode asc";
                        DataTable sortedDT = dv.ToTable();
                        //dtExam.DefaultView.Sort = "ExamCode asc";
                        for (int Exam = 0; Exam < sortedDT.Rows.Count; Exam++)
                        {
                            for (int skill = 0; skill < dtSkill.Rows.Count; skill++)
                            {
                                DataRow[] desc = dtStudentSkillsDetail.Select("ExamCode='" + sortedDT.Rows[Exam]["ExamCode"] + "' And SkillName='" + dtSkill.Rows[skill][1] + "' And StudentNo='" + dt.Rows[i]["StudentNo"] + "' And ScholarNo='" + dt.Rows[i]["ScholarNo"] + "'");
                                NewRow[Indexer] = desc[0][5]; Indexer++;
                                NewRow[Indexer] = desc[0][7]; Indexer++;
                            }
                        }
                        Indexer = N;
                    }
                }
                dtTable.Rows.Add(NewRow);
            }

            dtTable.WriteXmlSchema(@"" + Connection.GetAccessPathId() + @"Barcodes\a\rptCBSEMarksBackDetail.xsd");
            int a = dtTable.Columns.Count;

            CrystalDecisions.CrystalReports.Engine.ReportDocument s = null;
            if (cmbClass.Text.Trim().Equals("IX") || cmbClass.Text.Trim().Equals("X"))
            {
                if (ttype.Equals("DAFFO"))
                {
                    s = new rptCCEReportBackDaffo1TO5();
                }
                if (ttype.Equals("LIS"))
                {
                    s = new rptCCEReportBackMpConvent1TO8();
                }
                if (ttype.Equals("AGRO"))
                {
                    s = new rptCCEReportBackAgrod6TO8();
                }
                if (ttype.Equals("Yatharth"))
                {
                    s = new rptCCEReportBackYatharth6TO8();
                }
                s.PrintOptions.PaperOrientation = PaperOrientation.Landscape;
                s.PrintOptions.PaperSize        = CrystalDecisions.Shared.PaperSize.PaperA4;
            }
            else if (cmbClass.Text.Trim().Equals("I") || cmbClass.Text.Trim().Equals("II") || cmbClass.Text.Trim().Equals("III") || cmbClass.Text.Trim().Equals("IV") ||
                     cmbClass.Text.Trim().Equals("V"))
            {
                if (ttype.Equals("DAFFO"))
                {
                    s = new rptCCEReportBackDaffo1TO5();
                }
                if (ttype.Equals("LIS"))
                {
                    s = new rptCCEReportBackMpConvent1TO8();
                }
                if (ttype.Equals("AGRO"))
                {
                    s = new rptCCEReportBackAgrod1TO5();
                }
                if (ttype.Equals("Yatharth"))
                {
                    s = new rptCCEReportBackYatharth6TO8();
                }
                s.PrintOptions.PaperOrientation = PaperOrientation.Landscape;
                s.PrintOptions.PaperSize        = CrystalDecisions.Shared.PaperSize.PaperA4;
            }
            else if (cmbClass.Text.Trim().Equals("VI") || cmbClass.Text.Trim().Equals("VII") || cmbClass.Text.Trim().Equals("VIII"))
            {
                if (ttype.Equals("DAFFO"))
                {
                    s = new rptCCEReportBackDaffo6TO8();
                }
                if (ttype.Equals("LIS"))
                {
                    s = new rptCCEReportBackMpConvent1TO8();
                }
                if (ttype.Equals("AGRO"))
                {
                    s = new rptCCEReportBackAgrod6TO8();
                }
                if (ttype.Equals("Yatharth"))
                {
                    s = new rptCCEReportBackYatharth6TO8();
                }
                s.PrintOptions.PaperOrientation = PaperOrientation.Landscape;
                s.PrintOptions.PaperSize        = CrystalDecisions.Shared.PaperSize.PaperA4;
            }
            else
            {
                if (ttype.Equals("DAFFO"))
                {
                    s = new rptCCEReportBackFormat3();
                }
                if (ttype.Equals("LIS"))
                {
                    s = new rptCCEReportBackMpConventNUR();
                }
                if (ttype.Equals("AGRO"))
                {
                    s = new rptCCEReportBackFormat3();
                }
                if (ttype.Equals("Yatharth"))
                {
                    s = new rptCCEReportBackYatharth6TO8();
                }
                s.PrintOptions.PaperOrientation = PaperOrientation.Landscape;
                s.PrintOptions.PaperSize        = CrystalDecisions.Shared.PaperSize.PaperA4;
            }

            s.SetDataSource(dtTable);
            ShowAllReports cr = new ShowAllReports();

            cr.crystalReportViewer1.ReportSource = s;
            s.SetParameterValue("Class", cmbClass.Text.Trim());
            cr.crystalReportViewer1.Zoom(75);
            cr.Show();
        }