Пример #1
0
        private void BtnEidt_Click(object sender, EventArgs e)
        {
            if (this.dgvStudentList.CurrentRow == null)
            {
                MessageBox.Show("请选择您需要修改的学员对象!", "提示信息");
                return;
            }

            int studentId   = Convert.ToInt32(this.dgvStudentList.CurrentRow.Cells["StudentId"].Value);
            var studentInfo = studentService.GetStudebntByStudentId(studentId);

            if (frmEditStudent == null)
            {
                frmEditStudent = new FrmEditStudent(studentInfo);
                DialogResult result = frmEditStudent.ShowDialog();
                if (result == DialogResult.OK)
                {
                    //同步刷新
                    //方法一:
                    //BtnQuery_Click(null, null);
                    //更新studentList,刷新dgv
                    //方法二:
                    this.dgvStudentList.Refresh();
                }
            }
            else
            {
                frmEditStudent.Activate();
                frmEditStudent.WindowState = FormWindowState.Normal;
            }
        }
Пример #2
0
        private void btnEidt_Click(object sender, EventArgs e)
        {
            if (this.dgvStudentList.CurrentRow == null || this.dgvStudentList.RowCount == 0)
            {
                MessageBox.Show("Select  a Student");
                return;
            }
            string     studentNo     = this.dgvStudentList.CurrentRow.Cells["StudentIdNo"].Value.ToString();
            StudentExt objStudentExt = objStudentService.GetStudentByStudentNo(studentNo);
            //show edit from
            FrmEditStudent objFrmEditStudent = new FrmEditStudent(objStudentExt);
            DialogResult   result            = objFrmEditStudent.ShowDialog();

            if (result == DialogResult.OK)
            {
                btnQuery_Click(null, null);
            }
        }