private void button1_Click(object sender, EventArgs e) { pp.keyneed = checkBox1.Checked; EXtools tool = new EXtools(); tool.toword(pp); }
private void button9_Click(object sender, EventArgs e) { Exercise_Summary mq = null; if (listBox1.SelectedIndex >= 0) { if (mq == null || mq.IsDisposed) { pp.vdlword = null; pp.elword = null; pp.elword = l1[listBox1.SelectedIndex]; pp.vdlword = lcs[comboBox1.SelectedIndex]; mq = new Exercise_Summary(pp); mq.textBox1.Text = EXtools.toSummary(l1[listBox1.SelectedIndex], lcs[comboBox1.SelectedIndex], pp); mq.ShowDialog(); // mq.Show(); } else { mq.Activate(); mq.WindowState = FormWindowState.Normal; } } else { MessageBox.Show("请选择私有练习"); } }
private void button6_Click(object sender, EventArgs e) { Exercise_Summary mq = null; int irow = -1; if (dataGridView1.CurrentRow != null) { irow = dataGridView1.CurrentRow.Index; } if (irow >= 0 && comboBox7.SelectedIndex >= 0) { if (mq == null || mq.IsDisposed) { // pp.vdlword = null; // pp.elword = null; mq = new Exercise_Summary(pp); mq.textBox1.Text = EXtools.toSummary(tlvedp[irow], lcs[comboBox7.SelectedIndex], pp); mq.ShowDialog(); // mq.Show(); } else { mq.Activate(); mq.WindowState = FormWindowState.Normal; } } }
private void button5_Click(object sender, EventArgs e) { if (dataGridView1.CurrentRow != null) { int irow = dataGridView1.CurrentRow.Index; if (irow >= 0) { exerL yex = tlvedp[irow]; if (dataGridView1.CurrentRow.Cells[2].Value.ToString() != "") { if (!EXtools.isexitel(dataGridView1.CurrentRow.Cells[2].Value.ToString(), yex.courseid, pp)) { yex.name = dataGridView1.CurrentRow.Cells[2].Value.ToString(); pp.context.UpdateObject(yex); pp.context.SaveChanges(); updatalist(); } else { MessageBox.Show("名称已经存在"); } } else { MessageBox.Show("请datagrid中输入新名称"); } } else { MessageBox.Show("请选择书卷"); } } }
private void button6_Click(object sender, EventArgs e) { dataGridView1.DataSource = null; EXtools etool = new Exercise_form.EXtools(); List <featurehelp> lfea = null; // List<helpsimilar> hsl = new List<Exercise_form.helpsimilar>(); hsl.Clear(); lfea = etool.checkfeature(4, pp); foreach (featurehelp fp in lfea) { helpsimilar hs = new Exercise_form.helpsimilar(); hs.id = fp.id; hs.qid = fp.qid; hs.sim = -1; hs.str = fp.featurestr; hs.type1 = fp.type1; hsl.Add(hs); } for (int i = 0; i < hsl.Count() - 1; i++) { for (int j = i + 1; j < hsl.Count(); j++) { if (hsl[j].sim == -1) { if (EXtools.degreeofsimilarity(hsl[i].str, hsl[j].str) > 0.9) { hsl[j].sim = hsl[i].qid; } } } } dataGridView1.DataSource = hsl; }
private void nosubmit_Load(object sender, EventArgs e) { lcs = EXtools.nosubmit(pp, cl, el); textBox1.Text = el.name; dataGridView1.AutoGenerateColumns = false; dataGridView1.DataSource = lcs; }
////////////export all report private void exportreport(classinfo cl1, View_class_exp vst1) { String dirsave = null; List <View_class_student> lstwei = new List <View_class_student>(); // List<View_class_student> lstall = null; if (saveFileDialog1.ShowDialog() == DialogResult.OK) { string localFilePath = saveFileDialog1.FileName.ToString(); dirsave = localFilePath.Substring(0, localFilePath.LastIndexOf("\\")); } List <studreport> lstrep = null; var questionQuery2 = from o in pp.context.studreport where o.classid == cl1.classid && o.expid == vst1.expid select o; if (questionQuery2.Count() > 0) { lstrep = questionQuery2.ToList <studreport>(); foreach (studreport qew in lstrep) { string attaDirectory = dirsave + @"\" + qew.stid + EXtools.getstuname(pp, qew.stid); String repname = qew.fname; if (repname[repname.Length - 1] == 'x' || repname[repname.Length - 1] == 'X') { attaDirectory = attaDirectory + @".docx"; } else { attaDirectory = attaDirectory + @".doc"; } Byte[] Files = qew.rep; BinaryWriter bw = new BinaryWriter(File.Open(attaDirectory, FileMode.OpenOrCreate)); bw.Write(Files); bw.Close(); ///导出附件 /// if (qew.aname != null && qew.atta != null) { string attaDirectory2 = dirsave + @"\" + qew.stid + EXtools.getstuname(pp, qew.stid); attaDirectory2 = attaDirectory2 + @".rar"; Byte[] Files2 = qew.atta; BinaryWriter bw2 = new BinaryWriter(File.Open(attaDirectory2, FileMode.OpenOrCreate)); bw2.Write(Files2); bw2.Close(); } } } else { MessageBox.Show("没有报告可以导出"); } }
private void dataGridView2_CellEnter(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex < e.ColumnIndex) { int indexorder = ell.Count * e.RowIndex + e.ColumnIndex - (e.RowIndex + 1) * (e.RowIndex + 2) / 2; tled = (List <exerDetail>)detailed[indexorder]; dataGridView1.DataSource = tled; textBox1.Text = EXtools.caltotalscore(null, tled, pp).ToString() + "(" + (e.RowIndex + 1) + @"/" + (e.ColumnIndex + 1) + ")"; } }
private void button3_Click(object sender, EventArgs e) { //需要验证以及批改完,传入课程目标 // if (sel1 >= 0 && sel2 >= 0) { var q1 = from o in pp.context.studAnsw where o.mark < 0 && o.lid == ler[sel2].id orderby o.stid select o; if (q1.Count <studAnsw>() > 0) { // MessageBox.Show("还有未批好的作业!"); //return; } // else { ///////////////////////// var q2 = from o in pp.context.Course where o.id == lclinfo[sel1].courseid select o; // int iobj = 0; if (q2.Count <Course>() > 0) { // saveFileDialog2.DefaultExt = ".xlsx"; saveFileDialog2.Filter = "EXCEL file|*.xlsx"; if (saveFileDialog2.ShowDialog() == DialogResult.OK) { // iobj = q2.First <Course>().numobjective; EXtools.toScore(lclinfo[sel1], ler[sel2], saveFileDialog2.FileName, pp, iobj); } } else { MessageBox.Show("未关联任何习题或有问题联系管理员!"); } } } }
private void button6_Click(object sender, EventArgs e) { Exercise_Summary mq = null; if (mq == null || mq.IsDisposed) { // pp.vdlword = null; // pp.elword = null; mq = new Exercise_Summary(pp); mq.textBox1.Text = EXtools.toSummary(pp.elword, pp.vdlword, pp); mq.ShowDialog(); // mq.Show(); } else { mq.Activate(); mq.WindowState = FormWindowState.Normal; } }
private void Dcheck_Load(object sender, EventArgs e) { textBox1.Text = el.id.ToString(); dataGridView1.DataSource = EXtools.checkd(pp, el.id); }
private void button7_Click(object sender, EventArgs e) { int irow = -1; if (dataGridView1.CurrentCell != null) { irow = dataGridView1.CurrentCell.RowIndex; } DialogResult result = MessageBox.Show("确定删除吗?", "删除", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes && irow >= 0) { helpsimilar ths = hsl[irow]; if (ths.sim != -1) { if (ths.type1 == 0) { var q1 = from o in pp.context.mchoiceQues where o.id == ths.qid select o; mchoiceQues m1 = q1.First(); pp.context.DeleteObject(m1); var q2 = from o in pp.context.exerDetail where o.qid == ths.qid && o.typeq == 0 select o; List <exerDetail> tl = null; if (q2.Count() > 0) { tl = q2.ToList(); foreach (exerDetail ed in tl) { ed.qid = ths.sim; pp.context.UpdateObject(ed); MessageBox.Show("updata:" + ed.id); EXtools.checkd(pp, ed.lid); } } } try { if (ths.type1 == 1) { var q1 = from o in pp.context.TFQues where o.id == ths.qid select o; TFQues m1 = q1.First(); pp.context.DeleteObject(m1); var q2 = from o in pp.context.exerDetail where o.qid == ths.qid && o.typeq == 1 select o; List <exerDetail> tl = null; if (q2.Count() > 0) { tl = q2.ToList(); foreach (exerDetail ed in tl) { ed.qid = ths.sim; pp.context.UpdateObject(ed); MessageBox.Show("updata:" + ed.id); EXtools.checkd(pp, ed.lid); } } } } catch (InvalidOperationException e1) { MessageBox.Show(e1.Message.ToString()); } catch (ArgumentNullException e1) { MessageBox.Show(e1.Message.ToString()); } catch (Exception e1) { MessageBox.Show(e1.Message.ToString()); } if (ths.type1 == 2) { var q1 = from o in pp.context.eQues where o.id == ths.qid select o; eQues m1 = q1.First(); pp.context.DeleteObject(m1); var q2 = from o in pp.context.exerDetail where o.qid == ths.qid && o.typeq == 2 select o; List <exerDetail> tl = null; if (q2.Count() > 0) { tl = q2.ToList(); foreach (exerDetail ed in tl) { ed.qid = ths.sim; pp.context.UpdateObject(ed); MessageBox.Show("updata:" + ed.id); EXtools.checkd(pp, ed.lid); } } } if (ths.type1 == 3) { var q1 = from o in pp.context.SQues where o.id == ths.qid select o; SQues m1 = q1.First(); pp.context.DeleteObject(m1); var q2 = from o in pp.context.exerDetail where o.qid == ths.qid && o.typeq == 3 select o; List <exerDetail> tl = null; if (q2.Count() > 0) { tl = q2.ToList(); foreach (exerDetail ed in tl) { ed.qid = ths.sim; pp.context.UpdateObject(ed); MessageBox.Show("updata:" + ed.id); EXtools.checkd(pp, ed.lid); } } } if (ths.type1 == 4) { var q1 = from o in pp.context.AQues where o.id == ths.qid select o; AQues m1 = q1.First(); pp.context.DeleteObject(m1); var q2 = from o in pp.context.exerDetail where o.qid == ths.qid && o.typeq == 4 select o; List <exerDetail> tl = null; if (q2.Count() > 0) { tl = q2.ToList(); foreach (exerDetail ed in tl) { ed.qid = ths.sim; pp.context.UpdateObject(ed); MessageBox.Show("updata:" + ed.id); EXtools.checkd(pp, ed.lid); } } } //del question over updata over //del theinformation try { var q3 = from o in pp.context.featurehelp where o.id == ths.id select o; featurehelp fp2 = q3.First(); pp.context.DeleteObject(fp2); pp.context.SaveChanges(); dataGridView1.DataSource = null; hsl.Remove(ths); dataGridView1.DataSource = hsl; } catch (Exception e1) { MessageBox.Show(e1.ToString()); } } else { MessageBox.Show("Can not be deleted"); } } }