public static DataSet GetSeriesQuestions(string SeriesID) { DataSet ds = new DataSet(); DataTable dtTopInfo = new DataTable(); dtTopInfo.Columns.Add("Info", typeof(string)); Question qs = new Question(); String QuestionSeries = string.Empty; string schoolName = GeneralBLL.SchoolName(); string OpenNewTable = "<table width='100%' style='color:black;font-size:16px;' border='0' >"; string circular = "<b style='border:solid 1px black;padding:2px;paddding-left:12px;padding-right:12px;border-radius:50px;;text-alignment:center;'> "; string close_circular = "</b>"; string CloseNewTable = "</table>"; int longQ, shortQ, mcQ; longQ = shortQ = mcQ = 0; DataTable dtQ = SqlHelper.ExecuteDataset(SqlHelper.Connect, CommandType.Text, "select * from QuestionSeries inner join Classes on Classes.ClassId=QuestionSeries.ClassIDFK inner join subjects on QuestionSeries.SubjectIDFK=Subjects.SubjectID where SID =@SID", new SqlParameter("@SID", SeriesID)).Tables[0]; if (dtQ.Rows.Count > 0) { DataRow dr = dtQ.Rows[0]; qs.LAQ_Marks = dr["LAQMarks"].ToString(); qs.SAQ_Marks = dr["SAQMarks"].ToString(); qs.MCQ_Marks = dr["MCQMarks"].ToString(); qs.ClassName = dr["ClassName"].ToString(); qs.ClassIDFK = dr["ClassIDFK"].ToString(); qs.SeriesIDFK = dr["SID"].ToString(); qs.SubjectName = dr["SubjectName"].ToString(); qs.Series = dr["Series"].ToString(); qs.QTypeIDFK = "3"; longQ = getQuestionsCountBySeriesIDAndTypeID(qs); qs.QTypeIDFK = "2"; shortQ = getQuestionsCountBySeriesIDAndTypeID(qs); qs.QTypeIDFK = "1"; mcQ = getQuestionsCountBySeriesIDAndTypeID(qs); QuestionSeries = OpenNewTable + "<tr><td><h2 style='text-align:center;font-weight:bold;'>" + schoolName + "</h2></td></tr><tr><td><h3 style='text-align:center;font-weight:bold;'>ONLINE EXAMINATION</h3><h5 style='text-align:center;font-weight:bold;'>(" + qs.ClassName + " | " + qs.SubjectName + " | Series-" + qs.Series + ")</h5></td></tr>" + CloseNewTable; QuestionSeries = QuestionSeries + OpenNewTable + "<tr><td width='100%'><hr/><td></tr>" + CloseNewTable; QuestionSeries = QuestionSeries + OpenNewTable; if (longQ > 0) { QuestionSeries = QuestionSeries + "<tr style='font-weight:bold;height:33px;'><td>Long Answer Questions : " + circular + longQ.ToString() + close_circular + "</td><td style='text-align:right;margin:10px;'>Max. Marks " + circular + qs.LAQ_Marks + close_circular + "</td>"; } if (shortQ > 0) { QuestionSeries = QuestionSeries + "<tr style='font-weight:bold;height:33px;'><td>Short Answer Questions : " + circular + shortQ.ToString() + close_circular + "</td><td style='text-align:right;margin:10px;'>Max. Marks " + circular + qs.SAQ_Marks + close_circular + "</td></tr>"; } if (mcQ > 0) { QuestionSeries = QuestionSeries + "<tr style='font-weight:bold;height:33px;'><td>Multiple Choice Questions : " + circular + mcQ.ToString() + close_circular + "</td><td style='text-align:right;margin:10px;'>Max. Marks " + circular + qs.MCQ_Marks + close_circular + "</td></tr>"; } QuestionSeries = QuestionSeries + CloseNewTable; QuestionSeries = QuestionSeries + OpenNewTable + "<tr><td width='100%'><hr/><td></tr>" + CloseNewTable; DataRow drInfo = dtTopInfo.NewRow(); drInfo["Info"] = QuestionSeries; dtTopInfo.Rows.Add(drInfo); ds.Tables.Add(dtTopInfo); } return(ds); }
public static string GetSeriesQuestions(string SeriesID) { Question qs = new Question(); String QuestionSeries = string.Empty; string schoolName = GeneralBLL.SchoolName(); string OpenNewTable = "<table width='100%' style='color:black;font-size:16px;' border='0' >"; string circular = "<b style='border:solid 1px black;padding:2px;paddding-left:12px;padding-right:12px;border-radius:50px;;text-alignment:center;'> "; string close_circular = "</b>"; string CloseNewTable = "</table>"; int longQ, shortQ, mcQ; longQ = shortQ = mcQ = 0; DataTable dtQ = SqlHelper.ExecuteDataset(SqlHelper.Connect, CommandType.Text, "select * from QuestionSeries inner join Classes on Classes.ClassId=QuestionSeries.ClassIDFK inner join subjects on QuestionSeries.SubjectIDFK=Subjects.SubjectID where SID =@SID", new SqlParameter("@SID", SeriesID)).Tables[0]; if (dtQ.Rows.Count > 0) { DataRow dr = dtQ.Rows[0]; qs.LAQ_Marks = dr["LAQMarks"].ToString(); qs.SAQ_Marks = dr["SAQMarks"].ToString(); qs.MCQ_Marks = dr["MCQMarks"].ToString(); qs.ClassName = dr["ClassName"].ToString(); qs.ClassIDFK = dr["ClassIDFK"].ToString(); qs.SeriesIDFK = dr["SID"].ToString(); qs.SubjectName = dr["SubjectName"].ToString(); qs.Series = dr["Series"].ToString(); qs.QTypeIDFK = "3"; longQ = getQuestionsCountBySeriesIDAndTypeID(qs); qs.QTypeIDFK = "2"; shortQ = getQuestionsCountBySeriesIDAndTypeID(qs); qs.QTypeIDFK = "1"; mcQ = getQuestionsCountBySeriesIDAndTypeID(qs); QuestionSeries = OpenNewTable + "<tr><td><h2 style='text-align:center;font-weight:bold;'>" + schoolName + "</h2></td></tr><tr><td><h3 style='text-align:center;font-weight:bold;'>ONLINE EXAMINATION</h3><h5 style='text-align:center;font-weight:bold;'>(" + qs.ClassName + " | " + qs.SubjectName + " | Series-" + qs.Series + ")</h5></td></tr>" + CloseNewTable; QuestionSeries = QuestionSeries + OpenNewTable + "<tr><td width='100%'><hr/><td></tr>" + CloseNewTable; QuestionSeries = QuestionSeries + OpenNewTable; if (longQ > 0) { QuestionSeries = QuestionSeries + "<tr style='font-weight:bold;height:33px;'><td>Long Answer Questions : " + circular + longQ.ToString() + close_circular + "</td><td style='text-align:right;margin:10px;'>Max. Marks " + circular + qs.LAQ_Marks + close_circular + "</td>"; } if (shortQ > 0) { QuestionSeries = QuestionSeries + "<tr style='font-weight:bold;height:33px;'><td>Short Answer Questions : " + circular + shortQ.ToString() + close_circular + "</td><td style='text-align:right;margin:10px;'>Max. Marks " + circular + qs.SAQ_Marks + close_circular + "</td></tr>"; } if (mcQ > 0) { QuestionSeries = QuestionSeries + "<tr style='font-weight:bold;height:33px;'><td>Multiple Choice Questions : " + circular + mcQ.ToString() + close_circular + "</td><td style='text-align:right;margin:10px;'>Max. Marks " + circular + qs.MCQ_Marks + close_circular + "</td></tr>"; } QuestionSeries = QuestionSeries + CloseNewTable; QuestionSeries = QuestionSeries + OpenNewTable + "<tr><td width='100%'><hr/><td></tr>" + CloseNewTable; int QNo = 0; //Long Questions if (longQ > 0) { QNo = 0; qs.QTypeIDFK = "3"; DataTable dtLongQ = getQuestionsBySeriesIDAndTypeID(qs); string Qs = string.Empty; if (dtLongQ.Rows.Count > 0) { QuestionSeries = QuestionSeries + OpenNewTable + "<tr><td><h5><strong>● LONG ANSWER QUESTIONS</strong></h5></td></tr>" + CloseNewTable; QuestionSeries = QuestionSeries + OpenNewTable + "<tr><td width='100%'><hr/></td></tr>" + CloseNewTable; foreach (DataRow drLQ in dtLongQ.Rows) { QNo++; Qs = "<b>QNo." + QNo.ToString() + ") </b>" + drLQ["Question"].ToString(); QuestionSeries = QuestionSeries + OpenNewTable + "<tr><td>" + Qs + "</td></tr><tr><td> </td></tr>" + CloseNewTable; } } } //Short Questions if (shortQ > 0) { QNo = 0; qs.QTypeIDFK = "2"; DataTable dtSQ = getQuestionsBySeriesIDAndTypeID(qs); string Qs = string.Empty; if (dtSQ.Rows.Count > 0) { QuestionSeries = QuestionSeries + OpenNewTable + "<tr><td width='100%'><hr/></td></tr>" + CloseNewTable; QuestionSeries = QuestionSeries + OpenNewTable + "<tr><td><h5><strong>● SHORT ANSWER QUESTIONS</strong></h5></td></tr>" + CloseNewTable; QuestionSeries = QuestionSeries + OpenNewTable + "<tr><td width='100%'><hr/></td></tr>" + CloseNewTable; foreach (DataRow drSQ in dtSQ.Rows) { QNo++; Qs = "<b>QNo." + QNo.ToString() + ") </b>" + drSQ["Question"].ToString(); QuestionSeries = QuestionSeries + OpenNewTable + "<tr><td>" + Qs + "</td></tr><tr><td> </td></tr>" + CloseNewTable; } } } //MCQ Questions if (mcQ > 0) { QNo = 0; qs.QTypeIDFK = "1"; DataTable dtLongQ = getQuestionsBySeriesIDAndTypeID(qs); string Qs = string.Empty; if (dtLongQ.Rows.Count > 0) { QuestionSeries = QuestionSeries + OpenNewTable + "<tr><td width='100%'><hr/></td></tr>" + CloseNewTable; QuestionSeries = QuestionSeries + OpenNewTable + "<tr><td><h5><strong>● MUTLIPLE CHOICE QUESTIONS</strong></h5><td></tr>" + CloseNewTable; QuestionSeries = QuestionSeries + OpenNewTable + "<tr><td width='100%'><hr/></td></tr>" + CloseNewTable; QuestionSeries = QuestionSeries + OpenNewTable; foreach (DataRow drMQ in dtLongQ.Rows) { QNo++; Qs = "<b>QNo." + QNo.ToString() + ") </b>" + drMQ["Question"].ToString(); QuestionSeries = QuestionSeries + "<tr><td>" + Qs + "</td></tr>"; QuestionSeries = QuestionSeries + "<tr><td> A) " + drMQ["OptionA"] + "</td></tr><tr><td> B) " + drMQ["OptionB"] + "</td></tr><tr><td> C) " + drMQ["OptionC"] + "</td></tr><tr><td> D) " + drMQ["OptionD"] + "</td></tr><tr><td> </td></tr>"; } QuestionSeries = QuestionSeries + CloseNewTable; QuestionSeries = QuestionSeries + OpenNewTable + "<tr><td width='100%'><hr/></td></tr>" + CloseNewTable; } } } return(QuestionSeries); }