protected void FillHeading(string strId, string orgid) { RandomExamResultBLL randomExamResultBLL = new RandomExamResultBLL(); RandomExamResult randomExamResult = new RandomExamResult(); randomExamResult = randomExamResultBLL.GetRandomExamResultStation(int.Parse(strId)); OracleAccess db = new OracleAccess(); string strSql = "select a.*" + " from Random_Exam_Result_Detail a" + " where a.Random_Exam_Result_ID=" + randomExamResult.RandomExamResultId + " and Employee_ID=" + randomExamResult.ExamineeId + " and Random_Exam_ID=" + randomExamResult.RandomExamId; DataTable dtExam = db.RunSqlDataSet(strSql).Tables[0]; if (dtExam.Rows.Count == 0) { strSql = "select a.*" + " from Random_Exam_Result_Detail_Temp a" + " where a.Random_Exam_Result_ID=" + randomExamResult.RandomExamResultId + " and Employee_ID=" + randomExamResult.ExamineeId + " and Random_Exam_ID=" + randomExamResult.RandomExamId; dtExam = db.RunSqlDataSet(strSql).Tables[0]; } if (dtExam.Rows.Count > 0) { bool isExists = Directory.Exists(Server.MapPath("/RailExamBao/Online/Photo/" + randomExamResult.RandomExamId + "/")); DataRow drExam = dtExam.Rows[0]; lblFignerDate.Text = drExam["FingerPrint_Date"] == DBNull.Value ? string.Empty : Convert.ToDateTime(drExam["FingerPrint_Date"]).ToString("yyyy-MM-dd HH:mm"); lblPhotoDate1.Text = drExam["Photo1_Date"] == DBNull.Value ? string.Empty : Convert.ToDateTime(drExam["Photo1_Date"]).ToString("yyyy-MM-dd HH:mm"); lblPhotoDate2.Text = drExam["Photo2_Date"] == DBNull.Value ? string.Empty : Convert.ToDateTime(drExam["Photo2_Date"]).ToString("yyyy-MM-dd HH:mm"); lblPhotoDate3.Text = drExam["Photo3_Date"] == DBNull.Value ? string.Empty : Convert.ToDateTime(drExam["Photo3_Date"]).ToString("yyyy-MM-dd HH:mm"); string filepath = Server.MapPath("/RailExamBao/Online/Photo/" + randomExamResult.RandomExamId + "/") + randomExamResult.ExamineeId + "_" + randomExamResult.RandomExamResultId + "_"; string path = "../Online/Photo/" + randomExamResult.RandomExamId + "/" + randomExamResult.ExamineeId + "_" + randomExamResult.RandomExamResultId + "_"; if (PrjPub.IsServerCenter && isExists) { if (File.Exists(filepath + "00.jpg")) { fignerImage.ImageUrl = path + "00.jpg"; } else { fignerImage.ImageUrl = "../images/empty.jpg"; } } else { if (drExam["FingerPrint"] != DBNull.Value) { fignerImage.ImageUrl = "ShowResultImage.aspx?resultDetailID=" + drExam["Random_Exam_Result_Detail_ID"] + "&typeID=0"; } else { fignerImage.ImageUrl = "../images/empty.jpg"; } } DataSet ds = Pub.GetPhotoDateSet(randomExamResult.ExamineeId.ToString()); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0][0] != DBNull.Value) { picImage.ImageUrl = "../RandomExamTai/ShowImage.aspx?EmployeeID=" + randomExamResult.ExamineeId; } else { picImage.ImageUrl = "../images/empty.jpg"; } } else { picImage.ImageUrl = "../images/empty.jpg"; } if (PrjPub.IsServerCenter && isExists) { if (File.Exists(filepath + "01.jpg")) { photoImage1.ImageUrl = path + "01.jpg"; } else { photoImage1.ImageUrl = "../images/empty.jpg"; } } else { if (drExam["Photo1"] != DBNull.Value) { photoImage1.ImageUrl = "ShowResultImage.aspx?resultDetailID=" + drExam["Random_Exam_Result_Detail_ID"] + "&typeID=1"; } else { photoImage1.ImageUrl = "../images/empty.jpg"; } } if (PrjPub.IsServerCenter && isExists) { if (File.Exists(filepath + "02.jpg")) { photoImage2.ImageUrl = path + "02.jpg"; } else { photoImage2.ImageUrl = "../images/empty.jpg"; } } else { if (drExam["Photo2"] != DBNull.Value) { photoImage2.ImageUrl = "ShowResultImage.aspx?resultDetailID=" + drExam["Random_Exam_Result_Detail_ID"] + "&typeID=2"; } else { photoImage2.ImageUrl = "../images/empty.jpg"; } } if (PrjPub.IsServerCenter && isExists) { if (File.Exists(filepath + "03.jpg")) { photoImage3.ImageUrl = path + "03.jpg"; } else { photoImage3.ImageUrl = "../images/empty.jpg"; } } else { if (drExam["Photo3"] != DBNull.Value) { photoImage3.ImageUrl = "ShowResultImage.aspx?resultDetailID=" + drExam["Random_Exam_Result_Detail_ID"] + "&typeID=3"; } else { photoImage3.ImageUrl = "../images/empty.jpg"; } } } else { fignerImage.ImageUrl = "../images/empty.jpg"; DataSet ds = Pub.GetPhotoDateSet(randomExamResult.ExamineeId.ToString()); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0][0] != DBNull.Value) { picImage.ImageUrl = "../RandomExamTai/ShowImage.aspx?EmployeeID=" + randomExamResult.ExamineeId; } else { picImage.ImageUrl = "../images/empty.jpg"; } } else { picImage.ImageUrl = "../images/empty.jpg"; } photoImage1.ImageUrl = "../images/empty.jpg"; photoImage2.ImageUrl = "../images/empty.jpg"; photoImage3.ImageUrl = "../images/empty.jpg"; } string strOrgName = randomExamResult.OrganizationName; 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 = randomExamResult.PostName; lblName.Text = randomExamResult.ExamineeName; lblTime.Text = randomExamResult.BeginDateTime.ToString("yyyy-MM-dd HH:mm"); lblScore.Text = System.String.Format("{0:0.##}", randomExamResult.Score); int RandomExamId = randomExamResult.RandomExamId; RandomExamBLL randomExamBLL = new RandomExamBLL(); RailExam.Model.RandomExam randomExam = randomExamBLL.GetExam(RandomExamId); if (randomExam != null) { lblTitle.Text = randomExam.ExamName; } RandomExamSubjectBLL randomExamSubjectBLL = new RandomExamSubjectBLL(); IList <RailExam.Model.RandomExamSubject> RandomExamSubjects = randomExamSubjectBLL.GetRandomExamSubjectByRandomExamId(RandomExamId); int nItemCount = 0; decimal nTotalScore = 0; for (int i = 0; i < RandomExamSubjects.Count; i++) { nItemCount += RandomExamSubjects[i].ItemCount; nTotalScore += RandomExamSubjects[i].ItemCount * RandomExamSubjects[i].UnitScore; } lblTitleRight.Text = "总共" + nItemCount + "题,共" + System.String.Format("{0:0.##}", nTotalScore) + "分"; }
protected void FillPaper() { // QueryString id stands for EXAM_RESULT_ID string strId = Request.QueryString.Get("id"); string orgid = Request.QueryString.Get("orgid"); // Not pass id if (string.IsNullOrEmpty(strId)) { SessionSet.PageMessage = "参数错误!"; return; } RandomExamResultBLL randomExamResultBLL = new RandomExamResultBLL(); RandomExamResult randomExamResult = new RandomExamResult(); randomExamResult = randomExamResultBLL.GetRandomExamResultStation(int.Parse(strId)); int RandomExamId = randomExamResult.RandomExamId; int randomExamResultId = int.Parse(strId); RandomExamBLL objBll = new RandomExamBLL(); int year = objBll.GetExam(RandomExamId).BeginTime.Year; RandomExamItemBLL randomItemBLL = new RandomExamItemBLL(); RandomExamSubjectBLL subjectBLL = new RandomExamSubjectBLL(); IList <RandomExamSubject> randomExamSubjects = subjectBLL.GetRandomExamSubjectByRandomExamId(RandomExamId); //RandomExamResultAnswerBLL randomExamResultAnswerBLL = new RandomExamResultAnswerBLL(); //IList<RandomExamResultAnswer> examResultAnswers = new List<RandomExamResultAnswer>(); //if (ViewState["NowOrgID"].ToString() != orgid) //{ // examResultAnswers = randomExamResultAnswerBLL.GetExamResultAnswersStation(randomExamResultId); //} //else //{ // examResultAnswers = randomExamResultAnswerBLL.GetExamResultAnswers(randomExamResultId); //} IList <RandomExamItem> TotalItems = new List <RandomExamItem>(); //按年取出每张试卷的Random_Exam_Item_Year 表中的记录 if (ViewState["NowOrgID"].ToString() != orgid) { TotalItems = randomItemBLL.GetItemsStation(0, randomExamResultId, year); } else { TotalItems = randomItemBLL.GetItems(0, randomExamResultId, year); } OracleAccess db = new OracleAccess(); //按考试取出每张试卷的完形填空子题 string strSql = "select * from Random_Exam_Item_" + year + " where Type_ID=" + PrjPub.ITEMTYPE_FILLBLANKDETAIL + " and Random_Exam_ID=" + RandomExamId; DataTable dtDetail = db.RunSqlDataSet(strSql).Tables[0]; //按考试取出每张试卷的完形填空主题 //strSql = "select * from Random_Exam_Item_" + year + " where Type_ID="+ PrjPub.ITEMTYPE_FILLBLANK +" and Random_Exam_ID=" + RandomExamId; //DataTable dt= db.RunSqlDataSet(strSql).Tables[0]; int z = 1; int hasyear = 0; if (randomExamSubjects != null) { for (int i = 0; i < randomExamSubjects.Count; i++) { RandomExamSubject paperSubject = randomExamSubjects[i]; IList <RandomExamItem> PaperItems = new List <RandomExamItem>(); PaperItems = GetSubjectItems(TotalItems, paperSubject.RandomExamSubjectId); if (ViewState["NowOrgID"].ToString() != orgid) { //PaperItems = randomItemBLL.GetItemsStation(paperSubject.RandomExamSubjectId, randomExamResultId, year); hasyear = 1; } else { //PaperItems = randomItemBLL.GetItems(paperSubject.RandomExamSubjectId, randomExamResultId, year); hasyear = 0; } Response.Write("<table width='100%'>"); Response.Write(" <tr > <td class='ExamBigTitle' >"); Response.Write(" " + GetNo(i) + ""); Response.Write(". " + paperSubject.SubjectName + ""); Response.Write(" (共" + paperSubject.ItemCount + "题,共" + System.String.Format("{0:0.##}", paperSubject.ItemCount * paperSubject.UnitScore) + "分)</td></tr >"); if (PaperItems != null) { int x = 1; for (int j = 0; j < PaperItems.Count; j++) { RandomExamItem paperItem = PaperItems[j]; int k = j + 1; if (paperItem.TypeId != 5) { if (paperItem.TypeId == 4) { k = x; x++; } z = 1; Response.Write("<tr > <td class='ExamResultItem'><a name='Test" + i + j + "' id='Test" + i + j + "'></a> " + k + ". " + paperItem.Content + " (" + System.String.Format("{0:0.##}", paperSubject.UnitScore) + "分)</td></tr >"); } else { //string strSql = "select * from Random_Exam_Item_" + year + " where Item_ID='" + // paperItem.ItemId + "' and Random_Exam_ID=" + RandomExamId; //DataRow dr = db.RunSqlDataSet(strSql).Tables[0].Rows[0]; //IList<RandomExamItem> randomExamItems = randomItemBLL.GetItemsByParentItemID(Convert.ToInt32(dr["Parent_Item_ID"]), RandomExamId, year); //查找当前完型子题的主题ID DataRow[] drsDetail = dtDetail.Select("Item_ID=" + paperItem.ItemId); int detailCount = 0; if (drsDetail.Length > 0) { //通过完形填空的主题ID查找完形填空的子题个数,为计算每个子题分数做准备 DataRow[] drs = dtDetail.Select("Parent_Item_ID=" + drsDetail[0]["Parent_Item_ID"]); detailCount = drs.Length; } Response.Write("<tr > <td class='ExamResultItem'><a name='Test" + i + j + "' id='Test" + i + j + "'></a> "//+ z + "). " + paperItem.Content + " (" + System.String.Format("{0:0.##}", (decimal)paperSubject.UnitScore / (decimal)detailCount) + "分)</td></tr >"); z++; } string[] strUserAnswers = new string[0]; string strUserAnswer = string.Empty; // 组织用户答案 //RandomExamResultAnswer theExamResultAnswer = null; //foreach (RandomExamResultAnswer resultAnswer in examResultAnswers) //{ // if (resultAnswer.RandomExamItemId == paperItem.RandomExamItemId) // { // theExamResultAnswer = resultAnswer; // break; // } //} //// 若子表无记录,结束页面输出 //if (theExamResultAnswer == null) //{ // SessionSet.PageMessage = "数据错误!"; //} //// 否则组织考生答案 //if (theExamResultAnswer.Answer != null || theExamResultAnswer.Answer == string.Empty) //{ // strUserAnswers = theExamResultAnswer.Answer.Split(new char[] { '|' }); //} if (paperItem.Answer == null) { SessionSet.PageMessage = "数据错误!"; } if (!string.IsNullOrEmpty(paperItem.Answer)) { strUserAnswers = paperItem.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 == PrjPub.ITEMTYPE_MULTICHOOSE) { string[] strAnswer = paperItem.SelectAnswer.Split(new char[] { '|' }); for (int n = 0; n < strAnswer.Length; n++) { string strN = intToString(n + 1); string strij = "-" + paperItem.RandomExamItemId + "-" + i.ToString() + "-" + j.ToString() + "-" + n.ToString(); string strName = i.ToString() + j.ToString(); Response.Write(" <tr ><td class='ExamItemAnswer'> " + strN + "." + strAnswer[n] + "</td></tr >"); } } else if (paperSubject.ItemTypeId == PrjPub.ITEMTYPE_JUDGE || paperSubject.ItemTypeId == PrjPub.ITEMTYPE_SINGLECHOOSE || paperItem.TypeId == 5) { //单选 string[] strAnswer = paperItem.SelectAnswer.Split(new char[] { '|' }); for (int n = 0; n < strAnswer.Length; n++) { string strN = intToString(n + 1); Response.Write("<tr > <td class='ExamItemAnswer'> " + strN + "." + strAnswer[n] + "</td></tr >"); } } if (paperSubject.ItemTypeId == 1 || paperSubject.ItemTypeId == 2 || paperSubject.ItemTypeId == 3 || paperItem.TypeId == 5) { // 组织正确答案 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; } } string strScore = "0"; string couldScore = "0"; if (paperItem.TypeId == 5) { if (strRightAnswer == strUserAnswer) { strScore = System.String.Format("{0:0.##}", paperItem.Score); } couldScore = paperItem.Score.ToString(); } else { if (strRightAnswer == strUserAnswer) { strScore = System.String.Format("{0:0.##}", paperSubject.UnitScore); } couldScore = paperSubject.UnitScore.ToString(); } if (strScore == "0") { if (hfLoginEmployeeID.Value == "0") { string strFirst = @""""; Response.Write(" <tr><td id='span-" + paperItem.RandomExamItemId + "' class='ExamAnswerZero'> ★标准答案:" + "<span id='span-" + paperItem.RandomExamItemId + "-0' name='span-" + paperItem.RandomExamItemId + "'>" + strRightAnswer + "</span> 考生答案:" + "<span id='span-" + paperItem.RandomExamItemId + "-1' name='span-" + paperItem.RandomExamItemId + "'>" + strUserAnswer + "</span> 得分:" + "<span id='span-" + paperItem.RandomExamItemId + "-2'>" + strScore + "</span>" + " <a id='a-" + paperItem.RandomExamItemId + "' onclick=" + strFirst + "updateScore(" + randomExamResultId + "," + paperItem.RandomExamItemId + "," + couldScore + ",'" + paperItem.StandardAnswer + "'," + hasyear + ")" + strFirst + " href='#Test" + i + j + "' style='cursor: hand;'>更改考生答案</a></td></tr>"); } else { Response.Write(" <tr><td class='ExamAnswerZero'> ★标准答案:" + "<span id='span-" + paperItem.RandomExamItemId + "-0' name='span-" + paperItem.RandomExamItemId + "'>" + strRightAnswer + "</span> 考生答案:" + "<span id='span-" + paperItem.RandomExamItemId + "-1' name='span-" + paperItem.RandomExamItemId + "'>" + strUserAnswer + "</span> 得分:" + "<span id='span-" + paperItem.RandomExamItemId + "-2'>" + strScore + "</span></td></tr>"); } } else { Response.Write(" <tr><td class='ExamAnswer'> ★标准答案:" + "<span id='span-" + paperItem.RandomExamItemId + "-0' name='span-" + paperItem.RandomExamItemId + "'>" + strRightAnswer + "</span> 考生答案:" + "<span id='span-" + paperItem.RandomExamItemId + "-1' name='span-" + paperItem.RandomExamItemId + "'>" + strUserAnswer + "</span> 得分:" + strScore + "</td></tr>"); } } } } Response.Write(" </table> "); } } else { SessionSet.PageMessage = "数据错误!"; return; } }