private void btn_ok_Click(Object sender, EventArgs e) { if (tb_prefixname.Text == "" || tb_start.Text == "" || tb_end.Text == "") { MessageBox.Show("您还有内容未输入"); return; } foreach (var item in HHI_Module.listPrefixes) { if (item.Name == tb_prefixname.Text) { MessageBox.Show("已存在预设 " + item.Name); return; } } HHI_Prefix prefix = new HHI_Prefix(); prefix.ID = HHI_Module.listPrefixes.Count; prefix.Name = tb_prefixname.Text; prefix.Start = Convert.ToInt32(tb_start.Text); prefix.End = Convert.ToInt32(tb_end.Text); prefix.Include = tb_include.Text; prefix.Exclude = tb_exclude.Text; HHI_Module.listPrefixes.Add(prefix); this.Close(); }
private void btn_attach_Click(object sender, EventArgs e) { HHI_HandIn hi = GetCurrentHandIn(); HHI_Prefix prefix = GetCurrentHandInsPrefix(); string name; string studentIndex; string srcPath; if (hi.IsSubItemFolder) { folderBrowserDialog1.ShowDialog(); srcPath = folderBrowserDialog1.SelectedPath; name = folderBrowserDialog1.SelectedPath.Substring(folderBrowserDialog1.SelectedPath.LastIndexOf('\\') + 1); } else { openFileDialog1.ShowDialog(); srcPath = openFileDialog1.FileName; name = openFileDialog1.FileName.Substring(openFileDialog1.FileName.LastIndexOf('\\') + 1); } if (srcPath == "") { return; } if (!HHI_Module.IndexExist(name, prefix, out studentIndex)) { return; } if (!ListHelper.IsIn(HHI_Module.GetUnAttachedWorkIndexs(hi, prefix), Convert.ToInt32(studentIndex))) { if (MessageBox.Show("学号: " + studentIndex + " 已经提交,是否要覆盖?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) { // Yes CopyHelper.Copy(srcPath, hi.Path, hi.IsSubItemFolder); } else { // No return; } } else { CopyHelper.Copy(srcPath, hi.Path, hi.IsSubItemFolder); } ReloadList(); m_output += "\n" + "[" + System.DateTime.Now.ToString() + "]" + "学号为: " + studentIndex + " 的同学,已提交作业!\n"; MessageBox.Show(m_output); m_log += m_output; }
private void ProcessCheck() { HHI_Prefix tprefix = GetCurrentHandInsPrefix(); HHI_HandIn hi = GetCurrentHandIn(); if (!Directory.Exists(hi.Path)) { MessageBox.Show("错误:作业路径不存在\n" + "当前该方案的路径为" + hi.Path + "\n请检查错误"); return; } if (tprefix == null) { m_output += "错误:无该预设\n"; } List <int> digit = HHI_Module.GetUnAttachedWorkIndexs(hi, tprefix); m_output += "\n" + "[" + System.DateTime.Now.ToString() + "]" + "\n" + "作业名: " + hi.Name + "\n\n"; // !process file if (digit.Count == 0) { m_output += "已全部收齐!"; } else { m_output += "以下编号尚未交作业:" + "\n"; foreach (var d in digit) { m_output += d.ToString() + " "; } m_output += "\n" + "共" + digit.Count.ToString() + "人"; } MessageBox.Show(m_output); return; }