示例#1
0
        private void 教师操作ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            //用自定义方法getcom()在对应数据表中查找是否有当前登陆用户
            SqlDataReader temDR = MyDataClass.getcom("select * from tb_Teacher where IDT='" + DataClass.MyMeans.Login_ID.ToString() + "'");
            bool          ifcom = temDR.Read();

            //当有记录时,表示用户名已经修改过用户信息,此时只需要更新
            if (ifcom)
            {
            }
            else
            {
                if (MessageBox.Show("您的个人信息还未完善请填写", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information) == DialogResult.OK)
                {
                    if (checkchildfrm("F_InfoT") == false)
                    {
                        F_InfoT F_ER = new F_InfoT();
                        F_ER.Text = "完善个人信息";
                        if (F_ER.ShowDialog() == DialogResult.OK)
                        {
                            MessageBox.Show("个人信息补充成功!欢迎进入操作系统教学实验平台!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);//行数为零警告
                        }
                    }
                }
            }
        }
示例#2
0
 private void 个人信息ToolStripMenuItem1_Click(object sender, EventArgs e)
 {
     if (DataClass.MyMeans.User_Pope == "S")
     {
         if (checkchildfrm("F_InfoS") == false)
         {
             F_InfoS F_ER = new F_InfoS();
             F_ER.MdiParent   = this;
             F_ER.WindowState = FormWindowState.Maximized;
             F_ER.Text        = "个人信息";
             F_ER.Show();
         }
     }
     else
     {
         if (checkchildfrm("F_InfoT") == false)
         {
             F_InfoT F_ER = new F_InfoT();
             F_ER.MdiParent   = this;
             F_ER.WindowState = FormWindowState.Maximized;
             F_ER.Text        = "个人信息";
             F_ER.Show();
         }
     }
 }
        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 == 0)
            {
                MessageBox.Show("请勾选操作项!");
            }
            else//当存在操作项时
            {
                if (radioButton_Class.Checked == true)
                {
                    #region 班级修改操作
                    this.Tag = 0;                                      //设置为修改操作
                    for (int i = 0; i < dataGridView1.Rows.Count; i++) //循环遍历DataGridView控件中的每一行
                    {
                        if (dataGridView1.Rows[i].Cells[1].Value.ToString() != id)
                        {
                            dataGridView1.Rows[i].Cells[0].Value = null;//取消勾选
                        }
                        else
                        {
                            dataGridView1.Rows[i].Cells[0].Value = true;//勾选目标项
                        }
                    }
                    if (MessageBox.Show("班级内容是重要信息,确定修改吗?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information) == DialogResult.OK)
                    {
                        //设置text控件取消只读
                        txt_ClassName.ReadOnly = false;
                        mtxt_Code.ReadOnly     = false;
                        butOK.Enabled          = true;//激活确认取消按钮
                        butCancel.Enabled      = true;
                        //屏蔽操作按钮
                        butAdd.Enabled    = false;
                        butAmend.Enabled  = false;
                        butDelete.Enabled = false;
                    }
                    #endregion
                }
                else
                {
                    if (radioButton_Stu.Checked == true)
                    {
                        #region 学生修改操作
                        for (int i = 0; i < dataGridView1.Rows.Count; i++)  //循环遍历DataGridView控件中的每一行
                        {
                            if (dataGridView1.Rows[i].Cells[1].Value.ToString() != id)
                            {
                                dataGridView1.Rows[i].Cells[0].Value = null;//取消勾选
                            }
                            else
                            {
                                dataGridView1.Rows[i].Cells[0].Value = true;//勾选目标项
                            }
                        }
                        Student.Student_ID          = id.ToString();
                        DataClass.MyMeans.User_Pope = "A";//用户权限设置为管理员
                        F_InfoS infoS = new F_InfoS();
                        infoS.Text = "修改学生信息";
                        if (infoS.ShowDialog() == DialogResult.OK) //模式化窗体
                        {
                            DataInit_Stu();                        //初始化学生列表
                        }
                        DataClass.MyMeans.User_Pope = "T";         //用户权限设置为普通教师
                        #endregion
                    }
                    else
                    {
                        if (radioButton_Tea.Checked == true)
                        {
                            #region 教师修改操作
                            for (int i = 0; i < dataGridView1.Rows.Count; i++)  //循环遍历DataGridView控件中的每一行
                            {
                                if (dataGridView1.Rows[i].Cells[1].Value.ToString() != id)
                                {
                                    dataGridView1.Rows[i].Cells[0].Value = null;//取消勾选
                                }
                                else
                                {
                                    dataGridView1.Rows[i].Cells[0].Value = true;//勾选目标项
                                }
                            }
                            Teacher.Teacher_ID          = id.ToString();
                            DataClass.MyMeans.User_Pope = "A";//用户权限设置为管理员
                            F_InfoT infoS = new F_InfoT();
                            infoS.Text = "修改教师信息";
                            if (infoS.ShowDialog() == DialogResult.OK) //模式化窗体
                            {
                                DataInit_Tea();                        //初始化教师列表
                            }
                            DataClass.MyMeans.User_Pope = "T";         //用户权限设置为普通教师
                            #endregion
                        }
                    }
                }
            }
        }
 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 == 0)
     {
         MessageBox.Show("请勾选操作项!");
     }
     else//当存在操作项时
     {
         if (radioButton_Class.Checked == true)
         {
             #region 班级修改操作
             this.Tag = 0;//设置为修改操作
             for (int i = 0; i < dataGridView1.Rows.Count; i++)  //循环遍历DataGridView控件中的每一行
             {
                 if (dataGridView1.Rows[i].Cells[1].Value.ToString() != id)
                 {
                     dataGridView1.Rows[i].Cells[0].Value = null;//取消勾选
                 }
                 else
                 {
                     dataGridView1.Rows[i].Cells[0].Value = true;//勾选目标项
                 }
             }
             if (MessageBox.Show("班级内容是重要信息,确定修改吗?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information) == DialogResult.OK)
             {
                 //设置text控件取消只读
                 txt_ClassName.ReadOnly = false;
                 mtxt_Code.ReadOnly = false;
                 butOK.Enabled = true;//激活确认取消按钮
                 butCancel.Enabled = true;
                 //屏蔽操作按钮
                 butAdd.Enabled = false;
                 butAmend.Enabled = false;
                 butDelete.Enabled = false;
             }
             #endregion
         }
         else
         {
             if (radioButton_Stu.Checked == true)
             {
                 #region 学生修改操作
                 for (int i = 0; i < dataGridView1.Rows.Count; i++)  //循环遍历DataGridView控件中的每一行
                 {
                     if (dataGridView1.Rows[i].Cells[1].Value.ToString() != id)
                     {
                         dataGridView1.Rows[i].Cells[0].Value = null;//取消勾选
                     }
                     else
                     {
                         dataGridView1.Rows[i].Cells[0].Value = true;//勾选目标项
                     }
                 }
                 Student.Student_ID = id.ToString();
                 DataClass.MyMeans.User_Pope = "A";//用户权限设置为管理员
                 F_InfoS infoS = new F_InfoS();
                 infoS.Text = "修改学生信息";
                 if (infoS.ShowDialog() == DialogResult.OK)//模式化窗体
                 {
                     DataInit_Stu();//初始化学生列表
                 }
                 DataClass.MyMeans.User_Pope = "T";//用户权限设置为普通教师
                 #endregion
             }
             else
             {
                 if (radioButton_Tea.Checked == true)
                 {
                     #region 教师修改操作
                     for (int i = 0; i < dataGridView1.Rows.Count; i++)  //循环遍历DataGridView控件中的每一行
                     {
                         if (dataGridView1.Rows[i].Cells[1].Value.ToString() != id)
                         {
                             dataGridView1.Rows[i].Cells[0].Value = null;//取消勾选
                         }
                         else
                         {
                             dataGridView1.Rows[i].Cells[0].Value = true;//勾选目标项
                         }
                     }
                     Teacher.Teacher_ID = id.ToString();
                     DataClass.MyMeans.User_Pope = "A";//用户权限设置为管理员
                     F_InfoT infoS = new F_InfoT();
                     infoS.Text = "修改教师信息";
                     if (infoS.ShowDialog() == DialogResult.OK)//模式化窗体
                     {
                         DataInit_Tea();//初始化教师列表
                     }
                     DataClass.MyMeans.User_Pope = "T";//用户权限设置为普通教师
                     #endregion
                 }
             }
         }
     }
 }
 private void 教师操作ToolStripMenuItem_Click(object sender, EventArgs e)
 {
     //用自定义方法getcom()在对应数据表中查找是否有当前登陆用户
     SqlDataReader temDR = MyDataClass.getcom("select * from tb_Teacher where IDT='" + DataClass.MyMeans.Login_ID.ToString() + "'");
     bool ifcom = temDR.Read();
     //当有记录时,表示用户名已经修改过用户信息,此时只需要更新
     if (ifcom)
     { }
     else
     {
         if (MessageBox.Show("您的个人信息还未完善请填写", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information) == DialogResult.OK)
         {
             if (checkchildfrm("F_InfoT") == false)
             {
                 F_InfoT F_ER = new F_InfoT();
                 F_ER.Text = "完善个人信息";
                 if (F_ER.ShowDialog() == DialogResult.OK)
                 {
                     MessageBox.Show("个人信息补充成功!欢迎进入操作系统教学实验平台!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);//行数为零警告
                 }
             }
         }
     }
 }
 private void 个人信息ToolStripMenuItem1_Click(object sender, EventArgs e)
 {
     if (DataClass.MyMeans.User_Pope == "S")
     {
         if (checkchildfrm("F_InfoS") == false)
         {
             F_InfoS F_ER = new F_InfoS();
             F_ER.MdiParent = this;
             F_ER.WindowState = FormWindowState.Maximized;
             F_ER.Text = "个人信息";
             F_ER.Show();
         }
     }
     else
     {
         if (checkchildfrm("F_InfoT") == false)
         {
             F_InfoT F_ER = new F_InfoT();
             F_ER.MdiParent = this;
             F_ER.WindowState = FormWindowState.Maximized;
             F_ER.Text = "个人信息";
             F_ER.Show();
         }
     }
 }