private void butDoExperiment_Click(object sender, EventArgs e)
 {
     try
     {
         if (!MyClass.getcom("select * from tb_Report where IDE='" + DataClass.Experiment.Experiment_ID_forStudent + "' and IDS='" + DataClass.MyMeans.Login_ID + "'").Read())
         {
             SqlDataReader temDR = MyClass.getcom("select * from tb_Experiment where ID='" + DataClass.Experiment.Experiment_ID_forStudent + "'");
             if (temDR.Read())
                 DataClass.Experiment.ExperimentDone_Title = temDR.GetString(temDR.GetOrdinal("title"));
             F_DoExperiment Do = new F_DoExperiment();
             Do.MdiParent = this.MdiParent;
             Do.WindowState = FormWindowState.Maximized;
             Do.Tag = 0;
             Do.Text = "进行实验";
             Do.Show();
         }
         else
         {
             MessageBox.Show("您已经做过此实验,请去报告管理查看");
             this.butDoExperiment.Enabled = false;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
 private void butView_Click(object sender, EventArgs e)
 {
     if (this.Tag.Equals(0))//如果是教师浏览模式
     {
         int select_n = 0;
         for (int i = 0; i < dataGridView1.Rows.Count; i++)  //循环遍历DataGridView控件中的每一行
         {
             if (dataGridView1.Rows[i].Cells[0].Value != null) //当当前单元格的内容不为空时
             {
                 //当该行处于选定状态时
                 if (bool.Parse(dataGridView1.Rows[i].Cells[0].Value.ToString()) == true)
                 {
                     select_n++;
                     DataClass.Report.Report_ID_forTeacher = dataGridView1.Rows[i].Cells[1].Value.ToString();
                     /*F_GiveMark New = new F_GiveMark();
                     New.MdiParent = this.MdiParent;
                     New.WindowState = FormWindowState.Maximized;
                     New.Text = "显示实验报告";
                     New.Tag = 1;//设置新窗体的tag值为1表示教师浏览模式
                     New.Show();*/
                 }
             }
         }
     }
     else
     {
         if (this.Tag.Equals(1))//如果是学生浏览模式
         {
             int select_n = 0;
             for (int i = 0; i < dataGridView1.Rows.Count; i++)  //循环遍历DataGridView控件中的每一行
             {
                 if (dataGridView1.Rows[i].Cells[0].Value != null) //当当前单元格的内容不为空时
                 {
                     //当该行处于选定状态时
                     if (bool.Parse(dataGridView1.Rows[i].Cells[0].Value.ToString()) == true)
                     {
                         select_n++;
                         if (select_n < 2)
                         {
                             DataClass.Report.Report_ID_forStudent = dataGridView1.Rows[i].Cells[1].Value.ToString();
                             DataClass.Experiment.Experiment_ID_forStudent = dataGridView1.Rows[i].Cells[2].Value.ToString();
                             //如果批改状态为0,则查看实验报告.如果批改状态为1,则直接查看带有分数和评语的窗体
                             if (bool.Parse(dataGridView1.Rows[i].Cells[13].Value.ToString()) != true)
                             {
                                 F_DoExperiment New = new F_DoExperiment();
                                 New.MdiParent = this.MdiParent;
                                 New.WindowState = FormWindowState.Maximized;
                                 New.Text = "显示实验";
                                 New.Tag = 1;//设置新窗体的tag值为1表示学生浏览模式
                                 New.Show();
                             }
                             else
                             {
                                 F_GiveMark New = new F_GiveMark();
                                 New.MdiParent = this.MdiParent;
                                 New.WindowState = FormWindowState.Maximized;
                                 New.Text = "显示实验";
                                 New.Tag = 2;//设置新窗体的tag值为2表示学生浏览模式
                                 New.Show();
                             }
                         }
                         else
                         {
                             MessageBox.Show("多选显示将只显示您勾选的第一个", "提示");
                             break;
                         }
                     }
                 }
             }
         }
     }
 }
 private void butAmend_Click(object sender, EventArgs e)
 {
     int select_n = 0;
     for (int i = 0; i < dataGridView1.Rows.Count; i++)  //循环遍历DataGridView控件中的每一行
     {
         if (dataGridView1.Rows[i].Cells[0].Value != null) //当当前单元格的内容不为空时
         {
             //当该行处于选定状态时
             if (bool.Parse(dataGridView1.Rows[i].Cells[0].Value.ToString()) == true)
             {
                 select_n++;
                 if (select_n < 2)
                 {
                     //当批改状态为0,提交状态为0
                     if ((bool.Parse(dataGridView1.Rows[i].Cells[13].Value.ToString()) != true) && (bool.Parse(dataGridView1.Rows[i].Cells[12].Value.ToString()) != true))
                     {
                         DataClass.Report.Report_ID_forStudent = dataGridView1.Rows[i].Cells[1].Value.ToString();
                         DataClass.Experiment.Experiment_ID_forStudent = dataGridView1.Rows[i].Cells[2].Value.ToString();
                         F_DoExperiment New = new F_DoExperiment();
                         New.MdiParent = this.MdiParent;
                         New.WindowState = FormWindowState.Maximized;
                         New.Text = "修改实验报告";
                         New.Tag = 2;//设置为学生修改模式
                         New.Show();
                     }
                     else
                     {
                         MessageBox.Show("当前实验报告不能修改", "错误");
                     }
                 }
                 else
                 {
                     MessageBox.Show("多选修改将只能修改您勾选的第一个实验报告", "提示");
                     break;
                 }
             }
         }
     }
 }
 private void butView_Click(object sender, EventArgs e)
 {
     int select_n = 0;
     if (radioButtonESearch.Checked == true && (this.Tag.Equals(0) || this.Tag.Equals(1)))//教师浏览实验
     {
         for (int i = 0; i < dataGridView1.Rows.Count; i++)  //循环遍历DataGridView控件中的每一行
         {
             if (dataGridView1.Rows[i].Cells[0].Value != null) //当当前单元格的内容不为空时
             {
                 //当该行处于选定状态时
                 if (bool.Parse(dataGridView1.Rows[i].Cells[0].Value.ToString()) == true)
                 {
                     select_n++;
                     if (select_n < 2)
                     {
                         DataClass.Experiment.Experiment_ID_forTeahcer = dataGridView1.Rows[i].Cells[1].Value.ToString();
                         F_NewExperiment New = new F_NewExperiment();
                         New.MdiParent = this.MdiParent;
                         New.WindowState = FormWindowState.Maximized;
                         New.Text = "显示实验";
                         New.Tag = 1;//设置新窗体的tag值为1表示教师浏览实验模式
                         New.Show();
                     }
                     else
                     {
                         MessageBox.Show("多选查看时将只打开您勾选的第一个实验", "提示");
                         break;
                     }
                 }
             }
         }
     }
     else
     {
         if (radioButtonRSearch.Checked == true && (this.Tag.Equals(0) || this.Tag.Equals(1)))//教师浏览实验报告模式
         {
             select_n = 0;
             for (int i = 0; i < dataGridView1.Rows.Count; i++)  //循环遍历DataGridView控件中的每一行
             {
                 if (dataGridView1.Rows[i].Cells[0].Value != null) //当当前单元格的内容不为空时
                 {
                     //当该行处于选定状态时
                     if (bool.Parse(dataGridView1.Rows[i].Cells[0].Value.ToString()) == true)
                     {
                         select_n++;
                         if (select_n < 2)
                         {
                             DataClass.Report.Report_ID_forTeacher = dataGridView1.Rows[i].Cells[1].Value.ToString();
                             DataClass.Experiment.Experiment_ID_forTeahcer = dataGridView1.Rows[i].Cells[2].Value.ToString();
                             DataClass.Student.Student_ID = dataGridView1.Rows[i].Cells[3].Value.ToString();
                             F_DoExperiment New = new F_DoExperiment();
                             New.MdiParent = this.MdiParent;
                             New.WindowState = FormWindowState.Maximized;
                             New.Text = "显示实验报告";
                             New.Tag = 3;//设置新窗体的tag值为3表示教师浏览实验报告模式
                             New.Show();
                         }
                         else
                         {
                             MessageBox.Show("多选查看时将只打开您勾选的第一个实验", "提示");
                             break;
                         }
                     }
                 }
             }
         }
         else
         {
             if (radioButtonESearch.Checked == true && (this.Tag.Equals(2) || this.Tag.Equals(3)))//学生浏览实验模式
             {
                 select_n = 0;
                 for (int i = 0; i < dataGridView1.Rows.Count; i++)  //循环遍历DataGridView控件中的每一行
                 {
                     if (dataGridView1.Rows[i].Cells[0].Value != null) //当当前单元格的内容不为空时
                     {
                         //当该行处于选定状态时
                         if (bool.Parse(dataGridView1.Rows[i].Cells[0].Value.ToString()) == true)
                         {
                             select_n++;
                             if (select_n < 2)
                             {
                                 DataClass.Experiment.Experiment_ID_forStudent = dataGridView1.Rows[i].Cells[1].Value.ToString();
                                 F_NewExperiment New = new F_NewExperiment();
                                 New.MdiParent = this.MdiParent;
                                 New.WindowState = FormWindowState.Maximized;
                                 New.Text = "显示实验";
                                 New.Tag = 4;//设置新窗体的tag值为4表示学生浏览实验模式
                                 New.Show();
                             }
                             else
                             {
                                 MessageBox.Show("多选查看时将只打开您勾选的第一个实验", "提示");
                                 break;
                             }
                         }
                     }
                 }
             }
             else
             {
                 if (radioButtonRSearch.Checked == true && (this.Tag.Equals(2) || this.Tag.Equals(3)))//学生浏览实验报告模式
                 {
                     select_n = 0;
                     for (int i = 0; i < dataGridView1.Rows.Count; i++)  //循环遍历DataGridView控件中的每一行
                     {
                         if (dataGridView1.Rows[i].Cells[0].Value != null) //当当前单元格的内容不为空时
                         {
                             //当该行处于选定状态时
                             if (bool.Parse(dataGridView1.Rows[i].Cells[0].Value.ToString()) == true)
                             {
                                 select_n++;
                                 if (select_n < 2)
                                 {
                                     DataClass.Report.Report_ID_forStudent = dataGridView1.Rows[i].Cells[1].Value.ToString();
                                     DataClass.Experiment.Experiment_ID_forStudent = dataGridView1.Rows[i].Cells[2].Value.ToString();
                                     F_DoExperiment New = new F_DoExperiment();
                                     New.MdiParent = this.MdiParent;
                                     New.WindowState = FormWindowState.Maximized;
                                     New.Text = "显示实验报告";
                                     New.Tag = 1;//设置新窗体的tag值为1表示学生浏览实验报告模式
                                     New.Show();
                                 }
                                 else
                                 {
                                     MessageBox.Show("多选查看时将只打开您勾选的第一个实验", "提示");
                                     break;
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 }