protected void FillPage(string strId) { PaperBLL paperBLL = new PaperBLL(); RailExam.Model.Paper paper = paperBLL.GetPaper(int.Parse(strId)); if (paper != null) { lblTitle.Text = paper.PaperName; } PaperItemBLL paperItemBLL = new PaperItemBLL(); IList <RailExam.Model.PaperItem> paperItems = paperItemBLL.GetItemsByPaperId(int.Parse(strId)); int nItemCount = paperItems.Count; // 用于前台JS判断是否完成全部试题 hfPaperItemsCount.Value = nItemCount.ToString(); decimal nTotalScore = 0; for (int i = 0; i < paperItems.Count; i++) { nTotalScore += paperItems[i].Score; } lblTitleRight.Text = "总共" + nItemCount + "题,共 " + nTotalScore + "分"; lblOrgName.Text = PrjPub.CurrentStudent.OrgName; lblPost.Text = PrjPub.CurrentStudent.PostName; lblName.Text = PrjPub.CurrentStudent.EmployeeName; }
private string GetFillPaperString(string strId) { string strPaperString = ""; PaperItemBLL paperItemBLL = new PaperItemBLL(); PaperSubjectBLL paperSubjectBLL = new PaperSubjectBLL(); IList <PaperSubject> paperSubjects = paperSubjectBLL.GetPaperSubjectByPaperId(int.Parse(strId)); if (paperSubjects != null) { for (int i = 0; i < paperSubjects.Count; i++) { PaperSubject paperSubject = paperSubjects[i]; IList <PaperItem> paperItems = paperItemBLL.GetItemsByPaperSubjectId(paperSubject.PaperSubjectId); strPaperString += " <table width='100%' border='0' cellpadding='0' cellspacing='0'>"; strPaperString += " <tr><td style='font-size:21px'>"; strPaperString += " " + GetNo(i) + "、" + paperSubject.SubjectName; strPaperString += " (共" + paperItems.Count + "题,共" + paperItems.Count * paperSubject.UnitScore + "分)</td></tr>"; if (paperItems != null) { for (int j = 0; j < paperItems.Count; j++) { PaperItem paperItem = paperItems[j]; int k = j + 1; string strij = i.ToString() + j.ToString(); strPaperString += "<tr><td > " + k + "." + paperItem.Content + " (" + paperItem.Score + "分)</td></tr >"; if (paperSubject.ItemTypeId == 2) //多选 { string[] strAnswer = paperItem.SelectAnswer.Split(new char[] { '|' }); for (int n = 0; n < strAnswer.Length; n++) { string strN = intToString(n + 1); strPaperString += "<tr><td > " + strN + "." + strAnswer[n] + "</td></tr>"; } } else //单选 { string[] strAnswer = paperItem.SelectAnswer.Split(new char[] { '|' }); for (int n = 0; n < strAnswer.Length; n++) { string strN = intToString(n + 1); strPaperString += "<tr><td > " + strN + "." + strAnswer[n] + "</td></tr>"; } } } } strPaperString += "</table>"; } } return(strPaperString); }
private void CheckAnswer(string strAnswer) { string strId = Request.QueryString.Get("id"); PaperBLL paperBLL = new PaperBLL(); RailExam.Model.Paper paper = paperBLL.GetPaper(int.Parse(strId)); PaperItemBLL paperItemBLL = new PaperItemBLL(); string[] strAnswers = strAnswer.Split(new char[] { '$' }); decimal nanswerScore = 0; decimal nScore = paper.TotalScore; for (int n = 0; n < strAnswers.Length; n++) { string str2 = strAnswers[n].ToString(); string[] str3 = str2.Split(new char[] { '|' }); string strPaperItemId = str3[0].ToString(); PaperItem paperItem = paperItemBLL.GetPaperItem(int.Parse(strPaperItemId)); string strTrueAnswer = str2.ToString().Substring(strPaperItemId.Length + 1); if (paperItem.StandardAnswer == strTrueAnswer) { nanswerScore += paperItem.Score; } } string strA = "得分为" + nanswerScore + ",正确率为" + (nanswerScore * 100 / nScore).ToString("0.00") + "%"; Response.Write("<script>alert('提交成功!" + strA + "'); top.window.close();</script>"); }
protected void FillHeading(string strId) { ExamResultBLL examResultBLL = new ExamResultBLL(); PaperBLL kBLL = new PaperBLL(); RailExam.Model.ExamResult examResult = examResultBLL.GetExamResultByOrgID(Convert.ToInt32(strId), Convert.ToInt32(ViewState["OrgID"].ToString())); RailExam.Model.Paper paper = null; EmployeeBLL ebLL = new EmployeeBLL(); RailExam.Model.Employee Employee = ebLL.GetEmployee(examResult.ExamineeId); string strOrgName = Employee.OrgName; string strStationName = ""; string strOrgName1 = ""; int n = strOrgName.IndexOf("-"); if (n != -1) { strStationName = strOrgName.Substring(0, n); strOrgName1 = strOrgName.Substring(n + 1); } else { strStationName = strOrgName; strOrgName1 = ""; } lblOrg.Text = strStationName; lblWorkShop.Text = strOrgName1; lblPost.Text = Employee.PostName; lblName.Text = Employee.EmployeeName; lblTime.Text = examResult.BeginDateTime.ToString("yyyy-MM-dd HH:mm"); lblScore.Text = examResult.Score.ToString(); if (examResult != null) { paper = kBLL.GetPaper(examResult.PaperId); } PaperItemBLL paperItemBLL = new PaperItemBLL(); IList <RailExam.Model.PaperItem> paperItems = paperItemBLL.GetItemsByPaperId(paper.PaperId); int nItemCount = paperItems.Count; decimal nTotalScore = 0; for (int i = 0; i < paperItems.Count; i++) { nTotalScore += paperItems[i].Score; } if (paper != null) { lblTitle.Text = paper.PaperName; lblTitleRight.Text = "总共 " + nItemCount + " 题,共 " + nTotalScore + " 分"; } }
private void OutputData(string id) { PaperBLL paperBLL = new PaperBLL(); RailExam.Model.Paper paper = paperBLL.GetPaper(int.Parse(id)); PaperItemBLL paperItemBLL = new PaperItemBLL(); IList <RailExam.Model.PaperItem> paperItems = paperItemBLL.GetItemsByPaperId(int.Parse(id)); int nItemCount = paperItems.Count; decimal nTotalScore = 0; for (int i = 0; i < paperItems.Count; i++) { nTotalScore += paperItems[i].Score; } string str = "<table border='0' cellpadding='0' cellspacing='0' >"; str += "<tr><td colspan='2' align='center' style='font-size:28px' >" + paper.PaperName + "</td> </tr><tr> <td colspan='2' align='right'>总共" + nItemCount + "题共 " + nTotalScore + "分</td></tr> "; str += "<tr> <td style='width: 15%; vertical-align: top'>"; str += "<table border='1' cellpadding='0' cellspacing='0' ><tr><td style='width: 100px; height: 50px' valign='top'> 所属单位:</td> </tr> <tr><td style='height: 50px' valign='top'>车间:</td> </tr><tr><td style='height: 50px' valign='top'>姓名:</td></tr><tr><td style='height: 50px' valign='top'>职名:</td></tr><tr><td style='height: 50px' valign='top'>考试日期:</td></tr></table> </td> "; str += " <td style='width: 85%; vertical-align: top'> "; str += GetFillPaperString(id); str += "</td></tr></table> "; Response.Clear(); Response.Charset = "utf-7"; Response.Buffer = true; EnableViewState = false; Response.AppendHeader("Content-Disposition", "attachment;filename=Paper.doc"); Response.ContentEncoding = System.Text.Encoding.GetEncoding("utf-7"); Response.ContentType = "application/ms-word"; Response.Write(str); Response.End(); }
protected void FillPage(int nId) { PaperBLL paperBLL = new PaperBLL(); RailExam.Model.Paper paper = paperBLL.GetPaper(nId); if (paper != null) { lblTitle.Text = paper.PaperName; } PaperItemBLL paperItemBLL = new PaperItemBLL(); IList <RailExam.Model.PaperItem> paperItems = paperItemBLL.GetItemsByPaperId(nId); int nItemCount = paperItems.Count; decimal nTotalScore = 0; for (int i = 0; i < paperItems.Count; i++) { nTotalScore += paperItems[i].Score; } lblTitleRight.Text = "总共" + nItemCount + "题,共 " + nTotalScore + "分"; }
protected void FillPaper() { // QueryString id stands for EXAM_RESULT_ID string strId = Request.QueryString.Get("id"); // Not pass id if (string.IsNullOrEmpty(strId)) { SessionSet.PageMessage = "参数错误!"; return; } PaperItemBLL kBLL = new PaperItemBLL(); PaperSubjectBLL kBSLL = new PaperSubjectBLL(); TaskResultBLL taskResultBLL = new TaskResultBLL(); TaskResultAnswerBLL taskResultAnswerBLL = new TaskResultAnswerBLL(); RailExam.Model.TaskResult taskResult = taskResultBLL.GetTaskResult(int.Parse(strId)); // Not found if (taskResult == null) { SessionSet.PageMessage = "数据错误!"; return; } IList <PaperSubject> PaperSubjects = kBSLL.GetPaperSubjectByPaperId(taskResult.PaperId); PaperSubject paperSubject = null; IList <PaperItem> PaperItems = null; IList <TaskResultAnswer> taskResultAnswers = taskResultAnswerBLL.GetTaskResultAnswers(taskResult.TaskResultId); if (PaperSubjects != null) { for (int i = 0; i < PaperSubjects.Count; i++) { paperSubject = PaperSubjects[i]; PaperItems = kBLL.GetItemsByPaperSubjectId(paperSubject.PaperSubjectId); Response.Write("<table style='width:100%;'>"); Response.Write( " <tr class=\"tableFont\" > <td colspan='3' align='left' style='background-color:#54FF9F' >"); Response.Write(" " + CommonTool.GetChineseNumber(i + 1) + ""); Response.Write(". " + paperSubject.SubjectName + ""); Response.Write(" (共" + paperSubject.ItemCount + "题,共" + paperSubject.ItemCount * paperSubject.UnitScore + "分)</td></tr >"); if (PaperItems != null) { for (int j = 0; j < PaperItems.Count; j++) { PaperItem paperItem = PaperItems[j]; int k = j + 1; Response.Write("<tr class=\"tableFont\" > <td colspan='3' style='text-align:left; background-color:gainsboro;'> " + k + ". " + paperItem.Content + " (" + paperSubject.UnitScore + "分)</td></tr >"); // 组织用户答案 TaskResultAnswer theTaskResultAnswer = null; string[] strUserAnswers = new string[0]; string strUserAnswer = string.Empty; foreach (TaskResultAnswer resultAnswer in taskResultAnswers) { if (resultAnswer.PaperItemId == paperItem.PaperItemId) { theTaskResultAnswer = resultAnswer; break; } } // 若子表无记录,结束页面输出 if (theTaskResultAnswer == null) { SessionSet.PageMessage = "数据错误!"; return; } // 否则组织考生答案 if (theTaskResultAnswer.Answer != null) { strUserAnswers = theTaskResultAnswer.Answer.Split(new char[] { '|' }); } for (int n = 0; n < strUserAnswers.Length; n++) { if (n == 0) { strUserAnswer += CommonTool.GetSelectLetter(int.Parse(strUserAnswers[n]) + 1); } else { strUserAnswer += "," + CommonTool.GetSelectLetter(int.Parse(strUserAnswers[n]) + 1); } } //多选 if (paperSubject.ItemTypeId == 2) { string[] strAnswer = paperItem.SelectAnswer.Split(new char[] { '|' }); for (int n = 0; n < strAnswer.Length; n++) { string strij = "-" + paperItem.PaperItemId + "-" + i.ToString() + "-" + j.ToString() + "-" + n.ToString(); string strName = i.ToString() + j.ToString(); Response.Write(" <tr class=\"tableFont\" ><td colspan='3' align='left'> " + "<input type='checkbox' id='Answer" + strij + "' name='Answer" + strName + "' " + (Array.IndexOf(strUserAnswers, n) > -1 ? "checked" : "") + " disabled/> " + CommonTool.GetSelectLetter(n + 1) + "." + strAnswer[n] + "</td></tr >"); } } else { //单选 string[] strAnswer = paperItem.SelectAnswer.Split(new char[] { '|' }); for (int n = 0; n < strAnswer.Length; n++) { string strij = "-" + paperItem.PaperItemId + "-" + i.ToString() + "-" + j.ToString() + "-" + n.ToString(); string strName = i.ToString() + j.ToString(); Response.Write("<tr class=\"tableFont\" > <td colspan='3' align='left'> " + "<input type='Radio' id='RAnswer" + strij + "' name='RAnswer" + strName + "' " + (Array.IndexOf(strUserAnswers, n) > -1 ? "checked" : "") + " disabled/> " + CommonTool.GetSelectLetter(n + 1) + "." + strAnswer[n] + "</td></tr >"); } } // 组织正确答案 string[] strRightAnswers = paperItem.StandardAnswer.Split(new char[] { '|' }); string strRightAnswer = ""; for (int n = 0; n < strRightAnswers.Length; n++) { if (n == 0) { strRightAnswer += CommonTool.GetSelectLetter(n + 1); } else { strRightAnswer += "," + CommonTool.GetSelectLetter(n + 1); } } Response.Write(" <tr class=\"tableFont\"><td colspan='3' style='color:green; text-align:left; '> ★标准答案:" + "<span id='span-" + paperItem.PaperItemId + "-0' name='span-" + paperItem.PaperItemId + "'>" + strRightAnswer + "</span></td></tr>"); Response.Write(" <tr class=\"tableFont\"><td colspan='3' style='color:blue; text-align:left; '> ★考生答案:" + "<span id='span-" + paperItem.PaperItemId + "-1' name='span-" + paperItem.PaperItemId + "'>" + strUserAnswer + "</span></td></tr>"); Response.Write(" <tr class=\"tableFont\" score='" + paperItem.Score + "'><td style='color:purple; text-align:left; width:20%; '>★评分结果:" //+ "<input type='radio' id='rbnCorrect" + "-" + paperItem.PaperItemId //+ "' name='rbnJudge" + "-" + paperItem.PaperItemId //+ "' " + (strRightAnswer.Equals(strUserAnswer) ? "checked" : "") //+ "><font color='green'>对</font></input>" //+ "<input type='radio' id='rbnIncorrect" + "-" + paperItem.PaperItemId //+ "' name='rbnJudge" + "-" + paperItem.PaperItemId //+ "' " + (strRightAnswer.Equals(strUserAnswer) ? "" : "checked") //+ "><font color='red'>错</font></input>" //+ "<input type='radio' id='rbnPartlyCorrect" + "-" + paperItem.PaperItemId //+ "' name='rbnJudge" + "-" + paperItem.PaperItemId + "'>半对</input>" + GetJudgeInputs(paperItem.PaperItemId, theTaskResultAnswer.JudgeStatusId) + " " + "得分 " + theTaskResultAnswer.JudgeScore.ToString() + " " + "评语 " + theTaskResultAnswer.JudgeRemark + "" + "</td></tr>"); } } Response.Write(" </table> "); } } else { SessionSet.PageMessage = "数据错误!"; return; } }
protected void FillPaper() { string strId = Request.QueryString.Get("id"); if (string.IsNullOrEmpty(strId)) { SessionSet.PageMessage = "缺少参数!"; return; } PaperItemBLL kBLL = new PaperItemBLL(); // PaperSubjectBLL psBLL = new PaperSubjectBLL(); PaperSubjectBLL kBSLL = new PaperSubjectBLL(); IList <PaperSubject> PaperSubjects = kBSLL.GetPaperSubjectByPaperId(int.Parse(strId)); if (PaperSubjects != null) { for (int i = 0; i < PaperSubjects.Count; i++) { PaperSubject paperSubject = PaperSubjects[i]; IList <PaperItem> PaperItems = kBLL.GetItemsByPaperSubjectId(paperSubject.PaperSubjectId); Response.Write("<table width='95%' class='contentTable'>"); Response.Write(" <tr> <td align='left' style='background-color:#54FF9F' >"); Response.Write(" " + GetNo(i) + ""); Response.Write("、" + paperSubject.SubjectName + ""); Response.Write(" (共" + paperSubject.ItemCount + "题,共" + paperSubject.TotalScore + "分)</td></tr >"); if (PaperItems != null) { for (int j = 0; j < PaperItems.Count; j++) { PaperItem paperItem = PaperItems[j]; int k = j + 1; Response.Write("<tr > <td align='left'> " + k + ". " + paperItem.Content + " (" + paperItem.Score + "分)</td></tr >"); //多选 if (paperSubject.ItemTypeId == 2) { string[] strAnswer = paperItem.SelectAnswer.Split(new char[] { '|' }); for (int n = 0; n < strAnswer.Length; n++) { string strN = intToString(n + 1); string strij = "-" + paperItem.PaperItemId + "-" + i.ToString() + "-" + j.ToString() + "-" + n.ToString(); string strName = i.ToString() + j.ToString(); Response.Write( " <tr ><td align='left'> <input type='checkbox' id='Answer" + strij + "' name='Answer" + strName + "'> " + strN + "." + strAnswer[n] + "</td></tr >"); } } else { //单选 string[] strAnswer = paperItem.SelectAnswer.Split(new char[] { '|' }); for (int n = 0; n < strAnswer.Length; n++) { string strN = intToString(n + 1); string strij = "-" + paperItem.PaperItemId + "-" + i.ToString() + "-" + j.ToString() + "-" + n.ToString(); string strName = i.ToString() + j.ToString(); Response.Write( "<tr > <td align='left'> <input type='Radio' id='RAnswer" + strij + "' name='RAnswer" + strName + "'> " + strN + "." + strAnswer[n] + "</td></tr >"); } } //string[] strRightAnswer = paperItem.StandardAnswer.Split(new char[] { '|' }); //string strNew = ""; //for (int n = 0; n < strRightAnswer.Length; n++) //{ // string strN = intToString(int.Parse(strRightAnswer[n])+1); // if (n == 0) // { // strNew += strN; // } // else // { // strNew += "," + strN; // } //} //Response.Write(" <tr ><td style='background-color:#7EC0EE' align='left'>★标准答案: " + strNew + "</td></tr >"); } } Response.Write(" </table> "); } Response.Write(" <table><tr><td align='center'><a onclick='SaveRecord()' href='#'><b>提交练习</b></a> "); Response.Write(" <a onclick='Save()' href='#'><b>关闭</b></a> </td></tr></table>"); } else { SessionSet.PageMessage = "未找到记录!"; } }
protected void FillPaper() { // QueryString id stands for EXAM_RESULT_ID string strId = Request.QueryString.Get("id"); // Not pass id if (string.IsNullOrEmpty(strId)) { return; } PaperItemBLL kBLL = new PaperItemBLL(); PaperSubjectBLL kBSLL = new PaperSubjectBLL(); ExamResultBLL examResultBLL = new ExamResultBLL(); ExamResultAnswerBLL examResultAnswerBLL = new ExamResultAnswerBLL(); RailExam.Model.ExamResult examResult = examResultBLL.GetExamResult(int.Parse(strId)); // Not found if (examResult == null) { return; } IList <PaperSubject> PaperSubjects = kBSLL.GetPaperSubjectByPaperId(examResult.PaperId); PaperSubject paperSubject = null; IList <PaperItem> PaperItems = null; IList <ExamResultAnswer> examResultAnswers = examResultAnswerBLL.GetExamResultAnswers(examResult.ExamResultId); if (PaperSubjects != null) { for (int i = 0; i < PaperSubjects.Count; i++) { paperSubject = PaperSubjects[i]; PaperItems = kBLL.GetItemsByPaperSubjectId(paperSubject.PaperSubjectId); Response.Write("<table width='100%'>"); Response.Write(" <tr > <td class='ExamBigTitle' >"); Response.Write(" " + GetNo(i) + ""); Response.Write(". " + paperSubject.SubjectName + ""); Response.Write(" (共" + paperSubject.ItemCount + "题,共" + paperSubject.TotalScore + "分)</td></tr >"); // 用于前台JS判断是否完成全部试题 hfPaperItemsCount.Value = paperSubject.ItemCount.ToString(); if (PaperItems != null) { for (int j = 0; j < PaperItems.Count; j++) { PaperItem paperItem = PaperItems[j]; int k = j + 1; Response.Write("<tr > <td class='ExamResultItem'> " + k + ". " + paperItem.Content + " (" + paperItem.Score + "分)</td></tr >"); // 组织用户答案 ExamResultAnswer theExamResultAnswer = null; string[] strUserAnswers = new string[0]; string strUserAnswer = string.Empty; foreach (ExamResultAnswer resultAnswer in examResultAnswers) { if (resultAnswer.PaperItemId == paperItem.PaperItemId) { theExamResultAnswer = resultAnswer; break; } } // 若子表无记录,结束页面输出 if (theExamResultAnswer == null) { SessionSet.PageMessage = "数据错误!"; return; } // 否则组织考生答案 if (theExamResultAnswer.Answer != null) { strUserAnswers = theExamResultAnswer.Answer.Split(new char[] { '|' }); } for (int n = 0; n < strUserAnswers.Length; n++) { string strN = intToString(int.Parse(strUserAnswers[n]) + 1); if (n == 0) { strUserAnswer += strN; } else { strUserAnswer += "," + strN; } } //多选 if (paperSubject.ItemTypeId == 2) { string[] strAnswer = paperItem.SelectAnswer.Split(new char[] { '|' }); for (int n = 0; n < strAnswer.Length; n++) { string strN = intToString(n + 1); string strij = "-" + paperItem.PaperItemId + "-" + i.ToString() + "-" + j.ToString() + "-" + n.ToString(); string strName = i.ToString() + j.ToString(); Response.Write(" <tr ><td class='ExamItemAnswer'> " + "<input type='checkbox' id='Answer" + strij + "' name='Answer" + strName + "' " + (Array.IndexOf(strUserAnswers, n) > -1 ? "checked" : "") + " disabled/> " + strN + "." + strAnswer[n] + "</td></tr >"); } } else { //单选 string[] strAnswer = paperItem.SelectAnswer.Split(new char[] { '|' }); for (int n = 0; n < strAnswer.Length; n++) { string strN = intToString(n + 1); string strij = "-" + paperItem.PaperItemId + "-" + i.ToString() + "-" + j.ToString() + "-" + n.ToString(); string strName = i.ToString() + j.ToString(); Response.Write("<tr > <td class='ExamItemAnswer'> " + "<input type='Radio' id='RAnswer" + strij + "' name='RAnswer" + strName + "' " + (Array.IndexOf(strUserAnswers, n) > -1 ? "checked" : "") + " disabled/> " + strN + "." + strAnswer[n] + "</td></tr >"); } } // 组织正确答案 string[] strRightAnswers = paperItem.StandardAnswer.Split(new char[] { '|' }); string strRightAnswer = ""; for (int n = 0; n < strRightAnswers.Length; n++) { string strN = intToString(int.Parse(strRightAnswers[n]) + 1); if (n == 0) { strRightAnswer += strN; } else { strRightAnswer += "," + strN; } } Response.Write(" <tr><td class='ExamAnswer'> ★标准答案:" + "<span id='span-" + paperItem.PaperItemId + "-0' name='span-" + paperItem.PaperItemId + "'>" + strRightAnswer + "</span> 考生答案:" + "<span id='span-" + paperItem.PaperItemId + "-1' name='span-" + paperItem.PaperItemId + "'>" + strUserAnswer + "</span></td></tr>"); Response.Write(" <tr score='" + paperItem.Score + "'><td class='ExamJudge'>★评分结果:" + GetJudgeInputs(paperItem.PaperItemId, theExamResultAnswer.JudgeStatusId) + " " + "得分<input type='text' id='txtScore" + "-" + paperItem.PaperItemId + "' name='txtScore" + "-" + paperItem.PaperItemId + "' value='" + theExamResultAnswer.JudgeScore.ToString(".00") + "' size='8'></input> " + "评语<input type='text' id='txtMemo" + "-" + paperItem.PaperItemId + "' name='txtMemo" + "-" + paperItem.PaperItemId + "' size='40' value='" + theExamResultAnswer.JudgeRemark + "'></input>" + "</td></tr>"); } } Response.Write(" </table> "); } } }
protected void FillPaper() { string strId = Request.QueryString.Get("id"); PaperItemBLL paperItemBLL = new PaperItemBLL(); PaperSubjectBLL paperSubjectBLL = new PaperSubjectBLL(); IList <PaperSubject> paperSubjects = paperSubjectBLL.GetPaperSubjectByPaperId(int.Parse(strId)); if (paperSubjects != null) { for (int i = 0; i < paperSubjects.Count; i++) { PaperSubject paperSubject = paperSubjects[i]; IList <PaperItem> paperItems = paperItemBLL.GetItemsByPaperSubjectId(paperSubject.PaperSubjectId); Response.Write(" <table width='95%' >"); Response.Write(" <tr><td id='PaperBigTitle' >"); Response.Write(" " + GetNo(i) + "、" + paperSubject.SubjectName + ""); Response.Write(" (共" + paperItems.Count + "题,共" + paperItems.Count * paperSubject.UnitScore + "分)</td></tr>"); if (paperItems != null) { for (int j = 0; j < paperItems.Count; j++) { PaperItem paperItem = paperItems[j]; int k = j + 1; string strij = i.ToString() + j.ToString(); Response.Write("<tr><td id='PaperItem'> " + k + ". " + paperItem.Content + " (" + paperSubject.UnitScore + "分)</td></tr >"); if (paperSubject.ItemTypeId == 2) //多选 { string[] strAnswer = paperItem.SelectAnswer.Split(new char[] { '|' }); for (int n = 0; n < strAnswer.Length; n++) { string strN = intToString(n + 1); Response.Write("<tr><td id='PaperItemAnswer'> <input type='checkbox' id='Answer" + strij + "' name='Answer" + strij + "'> " + strN + "." + strAnswer[n] + "</td></tr>"); } } else //单选 { string[] strAnswer = paperItem.SelectAnswer.Split(new char[] { '|' }); for (int n = 0; n < strAnswer.Length; n++) { string strN = intToString(n + 1); Response.Write("<tr><td id='PaperItemAnswer'> <input type='Radio' id='RAnswer" + strij + "' name='RAnswer" + strij + "'> " + strN + "." + strAnswer[n] + "</td></tr>"); } } string[] strRightAnswer = paperItem.StandardAnswer.Split(new char[] { '|' }); string strNew = string.Empty; for (int n = 0; n < strRightAnswer.Length; n++) { string strN = intToString(int.Parse(strRightAnswer[n]) + 1); if (n == 0) { strNew += strN; } else { strNew += "," + strN; } } Response.Write("<tr><td id='PaperAnswer'> ★标准答案: " + strNew + "</td></tr>"); } } Response.Write("<tr><td> </td></tr></table>"); } } }
protected string GetFillExamPaperString(string strId, string orgid) { string strPaperString = ""; PaperItemBLL kBLL = new PaperItemBLL(); PaperSubjectBLL kBSLL = new PaperSubjectBLL(); ExamResultBLL examResultBLL = new ExamResultBLL(); ExamResultAnswerBLL examResultAnswerBLL = new ExamResultAnswerBLL(); RailExam.Model.ExamResult examResult = new RailExam.Model.ExamResult(); if (ViewState["NowOrgID"].ToString() == orgid) { examResult = examResultBLL.GetExamResult(Convert.ToInt32(strId)); } else { examResult = examResultBLL.GetExamResultByOrgID(Convert.ToInt32(strId), Convert.ToInt32(orgid)); } IList <PaperSubject> PaperSubjects = new List <PaperSubject>(); if (ViewState["NowOrgID"].ToString() == orgid) { PaperSubjects = kBSLL.GetPaperSubjectByPaperId(examResult.PaperId); } else { PaperSubjects = kBSLL.GetPaperSubjectByPaperIdByOrgID(examResult.PaperId, Convert.ToInt32(orgid)); } RailExam.Model.PaperSubject paperSubject = null; IList <RailExam.Model.PaperItem> PaperItems = null; IList <ExamResultAnswer> examResultAnswers = new List <ExamResultAnswer>(); if (ViewState["NowOrgID"].ToString() == orgid) { examResultAnswers = examResultAnswerBLL.GetExamResultAnswers(examResult.ExamResultIDStation); } else { examResultAnswers = examResultAnswerBLL.GetExamResultAnswersByOrgID(examResult.ExamResultIDStation, Convert.ToInt32(orgid)); } for (int i = 0; i < PaperSubjects.Count; i++) { paperSubject = PaperSubjects[i]; if (ViewState["NowOrgID"].ToString() == orgid) { PaperItems = kBLL.GetItemsByPaperSubjectId(paperSubject.PaperSubjectId); } else { PaperItems = kBLL.GetItemsByPaperSubjectIdByOrgID(paperSubject.PaperSubjectId, Convert.ToInt32(orgid)); } strPaperString += " <table width='100%' border='0' cellpadding='0' cellspacing='0'>"; strPaperString += " <tr><td style='font-size:14pt'>"; strPaperString += " " + GetNo(i) + ""; strPaperString += ". " + paperSubject.SubjectName + ""; strPaperString += " (共" + paperSubject.ItemCount + "题,共" + paperSubject.ItemCount * paperSubject.UnitScore + "分)</td></tr >"; if (PaperItems != null) { for (int j = 0; j < PaperItems.Count; j++) { RailExam.Model.PaperItem paperItem = PaperItems[j]; int k = j + 1; strPaperString += "<tr > <td style='font-size:10.5pt'> " + k + ". " + paperItem.Content + " (" + paperSubject.UnitScore + "分)</td></tr >"; // 组织用户答案 RailExam.Model.ExamResultAnswer theExamResultAnswer = null; string[] strUserAnswers = new string[0]; string strUserAnswer = string.Empty; foreach (RailExam.Model.ExamResultAnswer resultAnswer in examResultAnswers) { if (resultAnswer.PaperItemId == paperItem.PaperItemId) { theExamResultAnswer = resultAnswer; break; } } // 若子表无记录,结束页面输出 if (theExamResultAnswer == null) { SessionSet.PageMessage = "数据错误!"; } // 否则组织考生答案 if (theExamResultAnswer.Answer != null) { strUserAnswers = theExamResultAnswer.Answer.Split(new char[] { '|' }); } for (int n = 0; n < strUserAnswers.Length; n++) { string strN = intToString(int.Parse(strUserAnswers[n]) + 1); if (n == 0) { strUserAnswer += strN; } else { strUserAnswer += "," + strN; } } //多选 if (paperSubject.ItemTypeId == 2) { string[] strAnswer = paperItem.SelectAnswer.Split(new char[] { '|' }); for (int n = 0; n < strAnswer.Length; n++) { string strN = intToString(n + 1); string strij = "-" + paperItem.PaperItemId + "-" + i.ToString() + "-" + j.ToString() + "-" + n.ToString(); string strName = i.ToString() + j.ToString(); strPaperString += " <tr ><td style='font-size:10.5pt'> " + strN + "." + strAnswer[n] + "</td></tr >"; } } else { //单选 string[] strAnswer = paperItem.SelectAnswer.Split(new char[] { '|' }); for (int n = 0; n < strAnswer.Length; n++) { string strN = intToString(n + 1); string strij = "-" + paperItem.PaperItemId + "-" + i.ToString() + "-" + j.ToString() + "-" + n.ToString(); string strName = i.ToString() + j.ToString(); strPaperString += "<tr > <td style='font-size:10.5pt'> " + strN + "." + strAnswer[n] + "</td></tr >"; } } // 组织正确答案 string[] strRightAnswers = paperItem.StandardAnswer.Split(new char[] { '|' }); string strRightAnswer = ""; for (int n = 0; n < strRightAnswers.Length; n++) { string strN = intToString(int.Parse(strRightAnswers[n]) + 1); if (n == 0) { strRightAnswer += strN; } else { strRightAnswer += "," + strN; } } strPaperString += " <tr><td style='font-size:10.5pt'> ★标准答案:" + "<span id='span-" + paperItem.PaperItemId + "-0' name='span-" + paperItem.PaperItemId + "'>" + strRightAnswer + "</span> 考生答案:" + "<span id='span-" + paperItem.PaperItemId + "-1' name='span-" + paperItem.PaperItemId + "'>" + strUserAnswer + "</span> 得分: " + theExamResultAnswer.JudgeScore.ToString() + "</td></tr>"; } } strPaperString += " </table> "; } return(strPaperString); }
private string GetExamOutString(string strId, string orgid) { ExamResultBLL examResultBLL = new ExamResultBLL(); PaperBLL kBLL = new PaperBLL(); RailExam.Model.ExamResult examResult = new RailExam.Model.ExamResult(); if (ViewState["NowOrgID"].ToString() == orgid) { examResult = examResultBLL.GetExamResult(Convert.ToInt32(strId)); } else { examResult = examResultBLL.GetExamResultByOrgID(Convert.ToInt32(strId), Convert.ToInt32(orgid)); } RailExam.Model.Paper paper = null; EmployeeBLL ebLL = new EmployeeBLL(); RailExam.Model.Employee Employee = ebLL.GetEmployee(examResult.ExamineeId); paper = kBLL.GetPaper(examResult.PaperId); PaperItemBLL paperItemBLL = new PaperItemBLL(); IList <RailExam.Model.PaperItem> paperItems = paperItemBLL.GetItemsByPaperId(paper.PaperId); int nItemCount = paperItems.Count; decimal nTotalScore = 0; for (int i = 0; i < paperItems.Count; i++) { nTotalScore += paperItems[i].Score; } string strOrgName = Employee.OrgName; string strStationName = ""; string strOrgName1 = ""; int n = strOrgName.IndexOf("-"); if (n != -1) { strStationName = strOrgName.Substring(0, n); strOrgName1 = strOrgName.Substring(n + 1); } else { strStationName = strOrgName; strOrgName1 = ""; } string str = "<div style='text-align:center;font-size:18pt;'>" + PrjPub.GetRailName() + "考试试卷</div>"; str += "<div style='text-align:left;font-size:10.5pt;'>考试名称:" + paper.PaperName + " </div>"; str += "<div style='text-align:right;font-size:10.5pt;'>总共" + nItemCount + "题,共 " + nTotalScore + "分</div>"; str += "<div style='text-align:center;'><table width='100%' border='1' cellpadding='0' cellspacing='0' >"; str += "<tr><td width='7%' style='font-size:10.5pt' >单位:</td>"; str += "<td width='26%' style='font-size:10.5pt' align='left' >" + strStationName + "</td>"; str += "<td width='7%' style='font-size:10.5pt' >车间:</td>"; str += "<td width='27%' style='font-size:10.5pt' align='left' >" + strOrgName1 + "</td>"; str += "<td width='7%' style='font-size:10.5pt' >职名:</td>"; str += "<td width='26%' style='font-size:10.5pt' align='left' >" + Employee.PostName + "</td></tr>"; str += "<tr><td width='7%' style='font-size:10.5pt' >姓名:</td>"; str += "<td width='26%' style='font-size:10.5pt' align='left' >" + Employee.EmployeeName + "</td>"; str += "<td width='7%' style='font-size:10.5pt' >时间:</td>"; str += "<td width='27%' style='font-size:10.5pt' align='left' >" + examResult.BeginDateTime.ToString("yyyy-MM-dd HH:mm") + "</td>"; str += "<td width='7%' style='font-size:10.5pt' >成绩:</td>"; str += "<td width='26%' style='font-size:10.5pt' align='left' >" + examResult.Score + "</td></tr></table></div>"; str += "<br>"; str += GetFillExamPaperString(strId, orgid); string strReplace; if (PrjPub.IsServerCenter) { strReplace = "http://" + ConfigurationManager.AppSettings["ServerIP"] + "/RailExamBao/"; } else { strReplace = "http://" + ConfigurationManager.AppSettings["StationIP"] + "/RailExamBao/"; } str = str.Replace("/RailExamBao/", strReplace); return(str); }
private void SavePaperItem(IList <RailExam.Model.Item> itemList, int nDifficulty, int nPaperId, int nPaperSubjectId, decimal nUnitScore) { if (itemList.Count > 0) { PaperItemBLL paperItemBLL = new PaperItemBLL(); IList <PaperItem> paperItems = new List <PaperItem>(); if (itemList.Count > nDifficulty) { Random ObjRandom = new Random(); Hashtable hashTable = new Hashtable(); while (hashTable.Count < nDifficulty) { int i = ObjRandom.Next(itemList.Count); hashTable[itemList[i].ItemId] = itemList[i].ItemId; } ItemBLL itemBLL = new ItemBLL(); //把hashtable里的试题加到考试表 foreach (int key in hashTable.Keys) { string strItemId = hashTable[key].ToString(); RailExam.Model.Item item = itemBLL.GetItem(int.Parse(strItemId)); PaperItem paperItem = new PaperItem(); paperItem.PaperId = nPaperId; paperItem.PaperSubjectId = nPaperSubjectId; paperItem.AnswerCount = item.AnswerCount; paperItem.BookId = item.BookId; paperItem.CategoryId = item.CategoryId; paperItem.ChapterId = item.ChapterId; paperItem.CompleteTime = item.CompleteTime; paperItem.Content = item.Content; paperItem.CreatePerson = item.CreatePerson; paperItem.CreateTime = item.CreateTime; paperItem.Description = item.Description; paperItem.DifficultyId = item.DifficultyId; paperItem.ItemId = item.ItemId; paperItem.Memo = item.Memo; paperItem.OrderIndex = 0; paperItem.OrganizationId = item.OrganizationId; paperItem.OutDateDate = item.OutDateDate; paperItem.Score = nUnitScore; paperItem.SelectAnswer = item.SelectAnswer; paperItem.Source = item.Source; paperItem.StandardAnswer = item.StandardAnswer; paperItem.StatusId = item.StatusId; paperItem.TypeId = item.TypeId; paperItem.UsedCount = item.UsedCount; paperItem.Version = item.Version; paperItems.Add(paperItem); } } else //直接把这些试题加到考试表 { foreach (RailExam.Model.Item item in itemList) { PaperItem paperItem = new PaperItem(); paperItem.PaperId = nPaperId; paperItem.PaperSubjectId = nPaperSubjectId; paperItem.AnswerCount = item.AnswerCount; paperItem.BookId = item.BookId; paperItem.CategoryId = item.CategoryId; paperItem.ChapterId = item.ChapterId; paperItem.CompleteTime = item.CompleteTime; paperItem.Content = item.Content; paperItem.CreatePerson = item.CreatePerson; paperItem.CreateTime = item.CreateTime; paperItem.Description = item.Description; paperItem.DifficultyId = item.DifficultyId; paperItem.ItemId = item.ItemId; paperItem.Memo = item.Memo; paperItem.OrderIndex = 0; paperItem.OrganizationId = item.OrganizationId; paperItem.OutDateDate = item.OutDateDate; paperItem.Score = nUnitScore; paperItem.SelectAnswer = item.SelectAnswer; paperItem.Source = item.Source; paperItem.StandardAnswer = item.StandardAnswer; paperItem.StatusId = item.StatusId; paperItem.TypeId = item.TypeId; paperItem.UsedCount = item.UsedCount; paperItem.Version = item.Version; paperItems.Add(paperItem); } } if (paperItems.Count > 0) { paperItemBLL.AddPaperItem(paperItems); } } }
protected void btnSave_Click(object sender, EventArgs e) { PaperStrategyBookChapterBLL psbcBll = new PaperStrategyBookChapterBLL(); int Ncount = psbcBll.GetBookChapterCount(int.Parse(Request.QueryString.Get("id"))); if (Ncount == 0) { SessionSet.PageMessage = "请添加策略!"; return; } string strPaperID = Request.QueryString.Get("Paperid"); if (!string.IsNullOrEmpty(strPaperID)) { int nStrategyId = int.Parse(Request.QueryString.Get("id")); int nPaperId = int.Parse(strPaperID); PaperStrategyBLL paperStrategyBLL = new PaperStrategyBLL(); RailExam.Model.PaperStrategy paperStrategy = paperStrategyBLL.GetPaperStrategy(nStrategyId); PaperStrategySubjectBLL paperStrategySubjectBLL = new PaperStrategySubjectBLL(); IList <PaperStrategySubject> paperStrategySubjects = paperStrategySubjectBLL.GetPaperStrategySubjectByPaperStrategyId(nStrategyId); int nStrategyMode = paperStrategy.StrategyMode; for (int i = 0; i < paperStrategySubjects.Count; i++) { //大题 PaperSubjectBLL paperSubjectBLL = new PaperSubjectBLL(); PaperSubject paperSubject = new PaperSubject(); paperSubject.ItemCount = paperStrategySubjects[i].ItemCount; paperSubject.ItemTypeId = paperStrategySubjects[i].ItemTypeId; paperSubject.Memo = paperStrategySubjects[i].Memo; paperSubject.OrderIndex = paperStrategySubjects[i].OrderIndex; paperSubject.PaperId = nPaperId; paperSubject.Remark = paperStrategySubjects[i].Remark; paperSubject.SubjectName = paperStrategySubjects[i].SubjectName; paperSubject.TotalScore = paperStrategySubjects[i].TotalScore; paperSubject.UnitScore = paperStrategySubjects[i].UnitScore; decimal nUnitScore = paperSubject.UnitScore; int nPaperSubjectId = paperSubjectBLL.AddPaperSubject(paperSubject); ItemBLL itemBLL = new ItemBLL(); if (nStrategyMode == 2) //教材章节模式 { PaperStrategyBookChapterBLL paperStrategyBookChapterBLL = new PaperStrategyBookChapterBLL(); IList <PaperStrategyBookChapter> paperStrategyBookChapters = paperStrategyBookChapterBLL.GetItemsByPaperStrategySubjectID(paperStrategySubjects[i].PaperStrategySubjectId); for (int k = 0; k < paperStrategyBookChapters.Count; k++) { //策略 int nChapterId = paperStrategyBookChapters[k].RangeId; int nRangeType = paperStrategyBookChapters[k].RangeType; int typeId = paperStrategyBookChapters[k].ItemTypeId; int nDifficultR = paperStrategyBookChapters[k].ItemDifficultyRandomCount; //int nDifficulty1 = paperStrategyBookChapters[k].ItemDifficulty1Count; //int nDifficulty2 = paperStrategyBookChapters[k].ItemDifficulty2Count; //int nDifficulty3 = paperStrategyBookChapters[k].ItemDifficulty3Count; //int nDifficulty4 = paperStrategyBookChapters[k].ItemDifficulty4Count; //int nDifficulty5 = paperStrategyBookChapters[k].ItemDifficulty5Count; decimal uScore = paperStrategyBookChapters[k].UnitScore; string strExcludeIDs = paperStrategyBookChapters[k].ExcludeChapterId; //难度1 //IList<RailExam.Model.Item> itemList = itemBLL.GetItemsByStrategy(nRangeType,1, nChapterId, typeId, strExcludeIDs); //SavePaperItem(itemList, nDifficulty1, nPaperId, nPaperSubjectId, nUnitScore); ////难度2 //itemList = itemBLL.GetItemsByStrategy(nRangeType,2, nChapterId, typeId, strExcludeIDs); //SavePaperItem(itemList, nDifficulty2, nPaperId, nPaperSubjectId, nUnitScore); ////难度3 //itemList = itemBLL.GetItemsByStrategy(nRangeType,3, nChapterId, typeId, strExcludeIDs); //SavePaperItem(itemList, nDifficulty3, nPaperId, nPaperSubjectId, nUnitScore); ////难度4 //itemList = itemBLL.GetItemsByStrategy(nRangeType,4, nChapterId, typeId, strExcludeIDs); //SavePaperItem(itemList, nDifficulty4, nPaperId, nPaperSubjectId, nUnitScore); ////难度5 //itemList = itemBLL.GetItemsByStrategy(nRangeType,5, nChapterId, typeId, strExcludeIDs); //SavePaperItem(itemList, nDifficulty5, nPaperId, nPaperSubjectId, nUnitScore); //随机难度 Random ObjRandom = new Random(); int ndr = ObjRandom.Next(1, 5); //IList<RailExam.Model.Item> itemList = itemBLL.GetItemsByStrategy(nRangeType, ndr, nChapterId, typeId, strExcludeIDs); //SavePaperItem(itemList, nDifficultR, nPaperId, nPaperSubjectId, nUnitScore); } } } int itemCount = 0; decimal totalScore = 0; PaperItemBLL paperBLL = new PaperItemBLL(); IList <RailExam.Model.PaperItem> PaperItems = paperBLL.GetItemsByPaperId(nPaperId); if (PaperItems.Count > 0) { itemCount = PaperItems.Count; totalScore = PaperItems[0].Score * PaperItems.Count; } btnPreview.Visible = true; this.btnedit.Visible = true; this.btnSave.Visible = false; NewButton.Visible = false; btnLast.Visible = false; SessionSet.PageMessage = "随机生成试卷共" + itemCount + "题," + totalScore + "分,如果试卷题数不等于设定的总题数请手工进行修改!"; ViewState["DeleteFlag"] = 1; } else { Response.Write("<script>top.window.opener.form1.Refresh.value='true';top.window.opener.form1.submit();top.window.close();</script>"); } }
protected void btnSave_Click(object sender, EventArgs e) { int nStrategyId = int.Parse(hfStrategyId.Value); int nPaperId = int.Parse(Request.QueryString.Get("id")); PaperStrategyBLL paperStrategyBLL = new PaperStrategyBLL(); RailExam.Model.PaperStrategy paperStrategy = paperStrategyBLL.GetPaperStrategy(nStrategyId); PaperStrategySubjectBLL paperStrategySubjectBLL = new PaperStrategySubjectBLL(); IList <PaperStrategySubject> paperStrategySubjects = paperStrategySubjectBLL.GetPaperStrategySubjectByPaperStrategyId(nStrategyId); int nStrategyMode = paperStrategy.StrategyMode; txtStrategyName.Text = paperStrategy.PaperStrategyName; for (int i = 0; i < paperStrategySubjects.Count; i++) { //大题 PaperSubjectBLL paperSubjectBLL = new PaperSubjectBLL(); PaperSubject paperSubject = new PaperSubject(); paperSubject.ItemCount = paperStrategySubjects[i].ItemCount; paperSubject.ItemTypeId = paperStrategySubjects[i].ItemTypeId; paperSubject.Memo = paperStrategySubjects[i].Memo; paperSubject.OrderIndex = paperStrategySubjects[i].OrderIndex; paperSubject.PaperId = nPaperId; paperSubject.Remark = paperStrategySubjects[i].Remark; paperSubject.SubjectName = paperStrategySubjects[i].SubjectName; paperSubject.TotalScore = paperStrategySubjects[i].TotalScore; paperSubject.UnitScore = paperStrategySubjects[i].UnitScore; decimal nUnitScore = paperSubject.UnitScore; int nPaperSubjectId = paperSubjectBLL.AddPaperSubject(paperSubject); ItemBLL itemBLL = new ItemBLL(); if (nStrategyMode == 2) //教材章节模式 { PaperStrategyBookChapterBLL paperStrategyBookChapterBLL = new PaperStrategyBookChapterBLL(); IList <PaperStrategyBookChapter> paperStrategyBookChapters = paperStrategyBookChapterBLL.GetItemsByPaperStrategySubjectID(paperStrategySubjects[i].PaperStrategySubjectId); for (int k = 0; k < paperStrategyBookChapters.Count; k++) { //策略 int nChapterId = paperStrategyBookChapters[k].RangeId; int typeId = paperStrategyBookChapters[k].ItemTypeId; int nRangeType = paperStrategyBookChapters[k].RangeType; int nDifficultR = paperStrategyBookChapters[k].ItemDifficultyRandomCount; //int nDifficulty1 = paperStrategyBookChapters[k].ItemDifficulty1Count; //int nDifficulty2 = paperStrategyBookChapters[k].ItemDifficulty2Count; //int nDifficulty3 = paperStrategyBookChapters[k].ItemDifficulty3Count; //int nDifficulty4 = paperStrategyBookChapters[k].ItemDifficulty4Count; //int nDifficulty5 = paperStrategyBookChapters[k].ItemDifficulty5Count; decimal uScore = paperStrategyBookChapters[k].UnitScore; string strExcludeIDs = paperStrategyBookChapters[k].ExcludeChapterId; ////难度1 //IList<RailExam.Model.Item> itemList = itemBLL.GetItemsByStrategy(nRangeType, 1, nChapterId, typeId, strExcludeIDs); //SavePaperItem(itemList, nDifficulty1, nPaperId, nPaperSubjectId, nUnitScore); ////难度2 //itemList = itemBLL.GetItemsByStrategy(nRangeType, 2, nChapterId, typeId, strExcludeIDs); //SavePaperItem(itemList, nDifficulty2, nPaperId, nPaperSubjectId, nUnitScore); ////难度3 //itemList = itemBLL.GetItemsByStrategy(nRangeType, 3, nChapterId, typeId, strExcludeIDs); //SavePaperItem(itemList, nDifficulty3, nPaperId, nPaperSubjectId, nUnitScore); ////难度4 //itemList = itemBLL.GetItemsByStrategy(nRangeType, 4, nChapterId, typeId, strExcludeIDs); //SavePaperItem(itemList, nDifficulty4, nPaperId, nPaperSubjectId, nUnitScore); ////难度5 //itemList = itemBLL.GetItemsByStrategy(nRangeType, 5, nChapterId, typeId, strExcludeIDs); //SavePaperItem(itemList, nDifficulty5, nPaperId, nPaperSubjectId, nUnitScore); //随机难度 Random ObjRandom = new Random(); int ndr = ObjRandom.Next(1, 5); //IList<RailExam.Model.Item> itemList = itemBLL.GetItemsByStrategy(nRangeType, ndr, nChapterId, typeId, strExcludeIDs); //SavePaperItem(itemList, nDifficultR, nPaperId, nPaperSubjectId, nUnitScore); } } else //试题辅助分类模式 { PaperStrategyItemCategoryBLL paperStrategyItemCategoryBLL = new PaperStrategyItemCategoryBLL(); IList <PaperStrategyItemCategory> paperStrategyItemCategorys = paperStrategyItemCategoryBLL.GetItemsByPaperSubjectId(paperStrategySubjects[i].PaperStrategySubjectId); for (int k = 0; k < paperStrategyItemCategorys.Count; k++) { //策略 int nChapterId = paperStrategyItemCategorys[k].ItemCategoryId; int typeId = paperStrategyItemCategorys[k].ItemTypeId; int nDifficultR = paperStrategyItemCategorys[k].ItemDifficultyRandomCount; //int nDifficulty1 = paperStrategyItemCategorys[k].ItemDifficulty1Count; //int nDifficulty2 = paperStrategyItemCategorys[k].ItemDifficulty2Count; //int nDifficulty3 = paperStrategyItemCategorys[k].ItemDifficulty3Count; //int nDifficulty4 = paperStrategyItemCategorys[k].ItemDifficulty4Count; //int nDifficulty5 = paperStrategyItemCategorys[k].ItemDifficulty5Count; decimal uScore = paperStrategyItemCategorys[k].UnitScore; string strExcludeIDs = paperStrategyItemCategorys[k].ExcludeCategorysId; ////难度1 //IList<RailExam.Model.Item> itemList = itemBLL.GetItemsByStrategyItem(1, nChapterId, typeId, strExcludeIDs); //SavePaperItem(itemList, nDifficulty1, nPaperId, nPaperSubjectId, nUnitScore); ////难度2 //itemList = itemBLL.GetItemsByStrategyItem(2, nChapterId, typeId, strExcludeIDs); //SavePaperItem(itemList, nDifficulty2, nPaperId, nPaperSubjectId, nUnitScore); ////难度3 //itemList = itemBLL.GetItemsByStrategyItem(3, nChapterId, typeId, strExcludeIDs); //SavePaperItem(itemList, nDifficulty3, nPaperId, nPaperSubjectId, nUnitScore); ////难度4 //itemList = itemBLL.GetItemsByStrategyItem(4, nChapterId, typeId, strExcludeIDs); //SavePaperItem(itemList, nDifficulty4, nPaperId, nPaperSubjectId, nUnitScore); ////难度5 //itemList = itemBLL.GetItemsByStrategyItem(5, nChapterId, typeId, strExcludeIDs); //SavePaperItem(itemList, nDifficulty5, nPaperId, nPaperSubjectId, nUnitScore); //随机难度 Random ObjRandom = new Random(); int ndr = ObjRandom.Next(1, 5); IList <RailExam.Model.Item> itemList = itemBLL.GetItemsByStrategyItem(ndr, nChapterId, typeId, strExcludeIDs); SavePaperItem(itemList, nDifficultR, nPaperId, nPaperSubjectId, nUnitScore); } } } int itemCount = 0; decimal totalScore = 0; PaperItemBLL paperBLL = new PaperItemBLL(); IList <RailExam.Model.PaperItem> PaperItems = paperBLL.GetItemsByPaperId(nPaperId); if (PaperItems.Count > 0) { itemCount = PaperItems.Count; totalScore = PaperItems[0].Score * PaperItems.Count; } SessionSet.PageMessage = "随机生成试卷共" + itemCount + "题," + totalScore + "分,如果试卷题数不等于设定的总题数请手工进行修改!"; this.btnSave.Visible = false; this.btnLast.Visible = false; btnPreview.Visible = true; btnEdit.Visible = true; }
protected void FillResultPaper(string strTaskResultId) { string strId = strTaskResultId; // Not pass id if (string.IsNullOrEmpty(strId)) { return; } PaperItemBLL kBLL = new PaperItemBLL(); PaperSubjectBLL kBSLL = new PaperSubjectBLL(); TaskResultBLL examResultBLL = new TaskResultBLL(); TaskResultAnswerBLL examResultAnswerBLL = new TaskResultAnswerBLL(); TaskResult examResult = examResultBLL.GetTaskResult(int.Parse(strId)); // Not found if (examResult == null) { return; } IList <PaperSubject> PaperSubjects = kBSLL.GetPaperSubjectByPaperId(examResult.PaperId); PaperSubject paperSubject = null; IList <PaperItem> PaperItems = null; IList <TaskResultAnswer> examResultAnswers = examResultAnswerBLL.GetTaskResultAnswers(examResult.TaskResultId); if (PaperSubjects != null) { for (int i = 0; i < PaperSubjects.Count; i++) { paperSubject = PaperSubjects[i]; PaperItems = kBLL.GetItemsByPaperSubjectId(paperSubject.PaperSubjectId); Response.Write("<table width='100%' class='contentTable'>"); Response.Write(" <tr > <td align='left' style='background-color:#54FF9F' >"); Response.Write(" " + GetNo(i) + ""); Response.Write(". " + paperSubject.SubjectName + ""); Response.Write(" (共" + paperSubject.ItemCount + "题,共" + paperSubject.ItemCount * paperSubject.UnitScore + "分)</td></tr >"); // 用于前台JS判断是否完成全部试题 hfPaperItemsCount.Value = paperSubject.ItemCount.ToString(); if (PaperItems != null) { for (int j = 0; j < PaperItems.Count; j++) { PaperItem paperItem = PaperItems[j]; int k = j + 1; Response.Write("<tr > <td style='text-align:left; background-color:gainsboro;'> " + k + ". " + paperItem.Content + " (" + paperSubject.UnitScore + "分)</td></tr >"); // 组织用户答案 TaskResultAnswer theExamResultAnswer = null; string[] strUserAnswers = new string[0]; string strUserAnswer = string.Empty; foreach (TaskResultAnswer resultAnswer in examResultAnswers) { if (resultAnswer.PaperItemId == paperItem.PaperItemId) { theExamResultAnswer = resultAnswer; break; } } // 若子表无记录,结束页面输出 if (theExamResultAnswer == null) { SessionSet.PageMessage = "数据错误!"; return; } // 否则组织考生答案 if (theExamResultAnswer.Answer != null) { strUserAnswers = theExamResultAnswer.Answer.Split(new char[] { '|' }); } for (int n = 0; n < strUserAnswers.Length; n++) { string strN = intToString(int.Parse(strUserAnswers[n]) + 1); if (n == 0) { strUserAnswer += strN; } else { strUserAnswer += "," + strN; } } //多选 if (paperSubject.ItemTypeId == 2) { string[] strAnswer = paperItem.SelectAnswer.Split(new char[] { '|' }); for (int n = 0; n < strAnswer.Length; n++) { string strN = intToString(n + 1); string strij = "-" + paperItem.PaperItemId + "-" + i.ToString() + "-" + j.ToString() + "-" + n.ToString(); string strName = i.ToString() + j.ToString(); Response.Write(" <tr ><td align='left'> " + "<input type='checkbox' id='Answer" + strij + "' name='Answer" + strName + "' " + (Array.IndexOf(strUserAnswers, n) > -1 ? "checked" : "") + " disabled/> " + strN + "." + strAnswer[n] + "</td></tr >"); } } else { //单选 string[] strAnswer = paperItem.SelectAnswer.Split(new char[] { '|' }); for (int n = 0; n < strAnswer.Length; n++) { string strN = intToString(n + 1); string strij = "-" + paperItem.PaperItemId + "-" + i.ToString() + "-" + j.ToString() + "-" + n.ToString(); string strName = i.ToString() + j.ToString(); Response.Write("<tr > <td align='left'> " + "<input type='Radio' id='RAnswer" + strij + "' name='RAnswer" + strName + "' " + (Array.IndexOf(strUserAnswers, n) > -1 ? "checked" : "") + " disabled/> " + strN + "." + strAnswer[n] + "</td></tr >"); } } // 组织正确答案 string[] strRightAnswers = paperItem.StandardAnswer.Split(new char[] { '|' }); string strRightAnswer = ""; for (int n = 0; n < strRightAnswers.Length; n++) { string strN = intToString(int.Parse(strRightAnswers[n]) + 1); if (n == 0) { strRightAnswer += strN; } else { strRightAnswer += "," + strN; } } Response.Write(" <tr><td style='color:green; text-align:left; '> ★标准答案:" + "<span id='span-" + paperItem.PaperItemId + "-0' name='span-" + paperItem.PaperItemId + "'>" + strRightAnswer + "</span></td></tr>"); Response.Write(" <tr><td style='color:blue; text-align:left; '> ★考生答案:" + "<span id='span-" + paperItem.PaperItemId + "-1' name='span-" + paperItem.PaperItemId + "'>" + strUserAnswer + "</span></td></tr>"); Response.Write(" <tr score='" + paperItem.Score + "'><td style='color:purple; text-align:left; '>★"// + "得分<input type='text' readonly id='txtScore" + "-" + paperItem.PaperItemId + "' name='txtScore" + "-" + paperItem.PaperItemId + "' value='" + theExamResultAnswer.JudgeScore.ToString(".00") + "' size='8' style='width:20%'></input> " + "评语<input type='text' readonly id='txtMemo" + "-" + paperItem.PaperItemId + "' name='txtMemo" + "-" + paperItem.PaperItemId + "' size='40' value='" + theExamResultAnswer.JudgeRemark + "' style='width:70%'></input>" + "</td></tr>"); } } Response.Write(" </table> "); } } Response.Write("<table width='100%'> <tr></tr><tr><td style='color:purple;text-align:left; '> ★★★该作业最终得分:" + examResult.Score + "分 </td></tr></table>"); Response.Write("<table width='100%'> <tr><td style='text-align:center; '><a onclick='Close()' href='#'><b>关闭</b></a> </td></tr></table>"); }