Ejemplo n.º 1
0
        private void 学生信息管理ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            //加载学生信息框
            frmStuinfoManage stu = new frmStuinfoManage();

            LoadForm(stu);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 提交按键功能
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            Stuinfo stu = new Stuinfo();

            #region 是否有修改

            stu.SNO     = txtSNO.Text;
            stu.Pwd     = txtPwd.Text;
            stu.StuName = txtStuName.Text;

            if (Convert.ToInt32(txtAge.Text) <= 35 && Convert.ToInt32(txtAge.Text) > 1)
            {
                stu.Age = Convert.ToInt32(txtAge.Text);
            }
            else
            {
                MessageBox.Show("你输入的年龄不符合规则,请重新输入");
                txtAge.Focus();
                return;
            }

            if (rboMan.Checked == true)
            {
                stu.Sex = "男";
            }
            else
            if (rboWoman.Checked == true)
            {
                stu.Sex = "女";
            }

            stu.Address = txtAddress.Text;

            #endregion

            bool result = bll.IsUpdateSucces(stu, out msg);

            if (msg != "")
            {
                MessageBox.Show(msg);
            }

            if (result)
            {
                MessageBox.Show("编辑成功");
                BindData();
                frmStuinfoManage frm = new frmStuinfoManage();
                frm.Show();
                this.Close();
            }
            else
            {
                MessageBox.Show("填入的数据有误,请核对过后重新输入");
            }
        }