private void getonedata() { try { string sqlstr = string.Format("SELECT * FROM AI_listenScore WHERE itemno='{1}' and validflag='2' AND Statu='0' and batchno={0} order by papercode,itemno limit 1", Convert.ToInt32(cbopici.SelectedValue), cboitemno.Text.Trim()); List <AI_listenScore> singlerecord1 = MySqlHelper.GetDataSet(CommandType.Text, sqlstr).Tables[0].ToModels <AI_listenScore>(); AI_listenScore singlerecord = MySqlHelper.GetDataSet(CommandType.Text, sqlstr).Tables[0].ToModels <AI_listenScore>().First(); session.listenScore = singlerecord; string sql_upd = string.Format("UPDATE AI_listenScore SET statu='9',listenDT=now(),listener='{1}' WHERE Id={0}", singlerecord.Id, session.listenuser.UserName); MySqlHelper.ExecuteScalar(CommandType.Text, sql_upd); label8.Text = singlerecord.papercode; label9.Text = singlerecord.itemno; label14.Text = singlerecord.Score1; label15.Text = singlerecord.Score2; setbtn(); voice_path = session.filead + singlerecord.filename; Id = singlerecord.Id; button2.Text = string.Format("试卷号:{0} | 题目号:{1}", singlerecord.papercode, singlerecord.itemno); if (voice_path != "") { awmp.URL = voice_path; awmp.Ctlcontrols.play(); } querydata(); try { string sqltxt = string.Format("SELECT t1.itemno,t2.papercode,t1.itemtext,t1.answertext,t1.modeltext FROM AI_item t1, AI_paper t2 WHERE t1.itemno='{0}' AND t2.papercode='{1}' AND t1.paperid=t2.paperid", session.listenScore.itemno, session.listenScore.papercode); item item1 = MySqlHelper.GetDataSet(CommandType.Text, sqltxt).Tables[0].ToModels <item>().First(); textBox1.Text = item1.itemtext; textBox2.Text = item1.answertext; } catch (Exception) { MessageBox.Show("取不到题目对应信息!!!"); } session.taskIdlist.Add(Id); } catch (Exception) { MessageBox.Show("取不到题目了!!"); } }
private void getpredata() { int index = session.taskIdlist.FindIndex(a => a == Id); if (index >= 1) { int b = session.taskIdlist[index - 1]; string sqlstr = string.Format("SELECT * FROM ExamScore WHERE Id={0}", b); AI_listenScore singlerecord = SQLHelper.GetDbTable(sqlstr).ToModels <AI_listenScore>().First(); label8.Text = singlerecord.papercode; label9.Text = singlerecord.itemno; label14.Text = singlerecord.Score1; label15.Text = singlerecord.Score2; voice_path = singlerecord.filename; Id = singlerecord.Id; button2.Text = string.Format("试卷号:{0} | 题目号:{1}", singlerecord.papercode, singlerecord.itemno); if (voice_path != "") { awmp.URL = voice_path; awmp.Ctlcontrols.play(); } } }
private void import_data() { List <tmpdata> alist = session.blist; List <AI_listenScore> blist = new List <AI_listenScore>(); string sqlstr = string.Format("SELECT batchno FROM AI_listenScore ORDER BY batchno desc LIMIT 1"); var a = MySqlHelper.ExecuteScalar(CommandType.Text, sqlstr); int batchno = 1; string batchdesc = txtbatchdesc.Text.Trim(); if (a != null) { batchno = Convert.ToInt32(a) + 1; } List <string> sqllist = new List <string>(); foreach (var item1 in alist) { AI_listenScore es = new AI_listenScore(); try { es.papercode = getproval(item1, comboBox1.Text); if (textBox1.Text != "") { es.papercode = es.papercode.Replace(textBox1.Text, textBox12.Text); } es.itemno = getproval(item1, comboBox2.Text); if (textBox2.Text != "") { es.itemno = es.itemno.Replace(textBox2.Text, textBox11.Text); } es.encodeno = getproval(item1, comboBox3.Text); if (textBox3.Text != "") { es.encodeno = es.encodeno.Replace(textBox3.Text, textBox10.Text); } es.filename = getproval(item1, comboBox4.Text); if (textBox4.Text != "") { es.filename = es.filename.Replace(textBox4.Text, textBox9.Text); } es.Score1 = getproval(item1, comboBox5.Text); if (textBox5.Text != "") { es.Score1 = es.Score1.Replace(textBox5.Text, textBox8.Text); } es.Statu = "0"; string sql1 = string.Format("INSERT INTO AI_listenScore ( papercode, itemno, encodeno, filename, Score1, Statu,batchno,batchdesc) VALUES ('{0}','{1}','{2}','{3}','{4}' ,'{5}','{6}','{7}')", es.papercode, es.itemno, es.encodeno, es.filename.Replace(@"\", "/"), es.Score1, es.Statu, batchno, batchdesc); sqllist.Add(sql1); } catch (Exception) { //blist.Add(es); } } MySqlHelper.ExecuteSqlTran(sqllist); MessageBox.Show("导入成功!!!"); }