/// <summary> /// 保存盲检错误答案 /// </summary> private void SaveErrorAnswer() { try { Bll.T_MJAnswer ta = new Bll.T_MJAnswer(); foreach (var item in Model.UserAnswerQuestions.UserAnswer) { string trueAnswer = ta.GetTrueAnswer(BarCode, item.Key); string value = string.Join("", item.Value); if (trueAnswer != value) { Bll.T_MJAnswer bt = new Bll.T_MJAnswer(); string userId = Bll.User.UserID; bt.SaveErrorAnswer(item.Key, BarCode, value, userId); } } } catch (Exception ex) { } }
private void AnswerQuestions() { try { ShowErrorMessageInfo("请回答盲检问题"); AnswerControlList.Clear(); panel2.Controls.Clear(); GC.Collect(); Bll.T_MJAnswer bt = new Bll.T_MJAnswer(); DataTable dt = bt.GetAnswer(BarCode); Bll.T_AnswerPic t_AnswerPic = new T_AnswerPic(); int locationX = 0; int locationY = 0; foreach (DataRow item in dt.Rows) { AnswerControl ac = new AnswerControl(); ac.QuestionNumber = item["MJProblemCode"].ToString(); ac.Questions = item["Problem"].ToString(); string picPath = t_AnswerPic.GetPicPath(item["Answers"].ToString()); if (picPath != "") { string localPath = GlobalPath.ApplicationPath + "\\盲检图片\\" + Path.GetFileName(picPath); DownFile(picPath, localPath); ac.pic1 = new Bitmap(localPath); ac.Answers = ""; } //else //{ ac.Answers = item["Answers"].ToString(); //} string picPath2 = t_AnswerPic.GetPicPath(item["Answers2"].ToString()); if (picPath2 != "") { string localPath = GlobalPath.ApplicationPath + "\\盲检图片\\" + Path.GetFileName(picPath2); DownFile(picPath2, localPath); ac.pic2 = new Bitmap(localPath); ac.Answers2 = ""; } //else //{ ac.Answers2 = item["Answers2"].ToString(); //} string picPath3 = t_AnswerPic.GetPicPath(item["Answers3"].ToString()); if (picPath3 != "") { string localPath = GlobalPath.ApplicationPath + "\\盲检图片\\" + Path.GetFileName(picPath3); DownFile(picPath3, localPath); ac.pic3 = new Bitmap(localPath); ac.Answers3 = ""; } //else //{ ac.Answers3 = item["Answers3"].ToString(); //} string picPath4 = t_AnswerPic.GetPicPath(item["Answers4"].ToString()); if (picPath4 != "") { string localPath = GlobalPath.ApplicationPath + "\\盲检图片\\" + Path.GetFileName(picPath4); DownFile(picPath4, localPath); ac.pic4 = new Bitmap(localPath); ac.Answers4 = ""; } //else //{ ac.Answers4 = item["Answers4"].ToString(); //} //ac.Answers = item["Answers"].ToString(); //ac.Answers2 = item["Answers2"].ToString(); //ac.Answers3 = item["Answers3"].ToString(); //ac.Answers4 = item["Answers4"].ToString(); ac.ZhengQue = item["ZhengQue"].ToString(); ac.SetInfo(panel2.Width, panel2.Height); ac.Location = new Point(locationX, locationY); panel2.Controls.Add(ac); locationY += (ac.Height + 10); AnswerControlList.Add(ac); } } catch (Exception ex) { this.mesInfo.Text = "未找到盲检信息"; MessageBox.Show(ex.Message); } }