public PhotoPictureVM() { StringBuilder buider = new StringBuilder(); buider.Append("select exam.iexamineeid,exam.nvcName,exam.bsex,exam.nvcNation,exam.nvcIDNum,exam.imgpicture"); buider.Append(" from JAAJ_Batchs bat "); buider.Append("left join JAAJ_BatchExamineeMap map on bat.iBatchID=map.iBatchID "); buider.Append("left join JAAJ_Examinees exam on map.iExamineeID=exam.iExamineeID "); buider.Append("left join JAAJ_Exams exams on exams.nvcBatchNO=bat.nvcBatchNO "); buider.Append("where exam.iExamineeID = " + 491 + " and bat.iBatchID=" + 102); //查询数据库 转变成图片 DataTable table = SQLHelp.GetDataTable(buider.ToString()); if (table.Rows.Count > 0) { byte[] imagebyte = (byte[])table.Rows[0]["imgpicture"]; //开始加载图像 BitmapImage bim = new BitmapImage(); bim.BeginInit(); bim.StreamSource = new MemoryStream(imagebyte); bim.EndInit(); ImagePicture = bim; } }
private void button_Click(object sender, RoutedEventArgs e) { //提交成绩 List <JAAJ_SubItemScoreInfo> listsuItemScoreInfos = new List <JAAJ_SubItemScoreInfo>(); string cardNum = ""; int batchId = 0; //查询考生信息 StringBuilder buiderSql = new StringBuilder(); buiderSql.Append("select "); buiderSql.Append("exam.iexamineeid,exam.nvcName,exam.bsex,exam.nvcNation,"); buiderSql.Append("exam.nvcIDNum,sub.iSubjectID,sub.nvcSubjectItemIDs,bat.nvcBatchNo "); buiderSql.Append(" from JAAJ_Batchs bat "); buiderSql.Append("left join JAAJ_BatchExamineeMap map on bat.iBatchID=map.iBatchID "); buiderSql.Append("left join JAAJ_Examinees exam on map.iExamineeID=exam.iExamineeID "); buiderSql.Append("left join JAAJ_Exams exams on exams.nvcBatchNO=bat.nvcBatchNO "); buiderSql.Append(" left join JAAJ_ExamSubjects sub on sub.iExamID=exams.iExamID "); buiderSql.Append(" where exam.nvcIDNum = '" + cardNum + "' and bat.iBatchID='" + batchId + "'"); DataTable table = SQLHelp.GetDataTable(buiderSql.ToString()); if (table == null) { return; } JAAJ_SubjectScoreInfo scorInfo = new JAAJ_SubjectScoreInfo(); scorInfo.iExamineeID = int.Parse(table.Rows[0]["iexamineeid"].ToString()); scorInfo.iSubjectID = int.Parse(table.Rows[0]["iSubjectID"].ToString()); scorInfo.iSubjectItemID = int.Parse(table.Rows[0]["nvcSubjectItemIDs"].ToString()); scorInfo.nvcBatchNO = table.Rows[0]["nvcBatchNo"].ToString(); scorInfo.datScoreDate = DateTime.Now; scorInfo.nvcIDNum = cardNum; scorInfo.nvcName = table.Rows[0]["nvcName"].ToString(); scorInfo.decTotalScore = 100; JAAJ_SubItemScoreInfo itemScoreInfo = new JAAJ_SubItemScoreInfo(); itemScoreInfo.nvcTitleName = "人工考试"; itemScoreInfo.iExamineeID = int.Parse(table.Rows[0]["iexamineeid"].ToString()); for (int i = 0; i < 10; i++) { JAAJ_StepScoreInfo stepScoreInfo = new JAAJ_StepScoreInfo(); stepScoreInfo.decStepScore = 10; stepScoreInfo.decTitleScore = 10; stepScoreInfo.nvcStepName = "步骤" + i + 1 + "操作正确"; itemScoreInfo.decSubjectItemScore += stepScoreInfo.decStepScore; itemScoreInfo.JAAJ_StepScoreInfoList.Add(stepScoreInfo); scorInfo.sumScore += stepScoreInfo.decStepScore; } }