//修改学员对象
        private void btnEidt_Click(object sender, EventArgs e)
        {
            if (this.dgvStudentList.RowCount == 0)
            {
                MessageBox.Show("没有任何要修改的学信息!", "提示信息");
                return;
            }
            if (this.dgvStudentList.CurrentRow == null)
            {
                MessageBox.Show("请选中要修改的学员信息!", "提示信息");
                return;
            }
            //获取学号
            //string studentId = this.dgvStudentList.CurrentRow.Cells["StudentId"].Value.ToString();
            string studentId = this.dgvStudentList.CurrentRow.Cells["StudentId"].Value.ToString();
            //获取要修改的学员详细信息
            StudentExt objStudent = objStuService.GetStudentById(studentId);
            //显示要修改的学员信息窗口
            FrmEditStudent objEditStudent = new FrmEditStudent(objStudent);
            DialogResult   result         = objEditStudent.ShowDialog();

            //判断修改是否成
            if (result == DialogResult.OK)
            {
                btnQuery_Click(null, null);//同步刷新修改的信息(适合查询数据量小的情况)
            }
        }
Пример #2
0
        private void btnEidt_Click_1(object sender, EventArgs e)
        {
            if (this.dgvStudentList.RowCount == 0)
            {
                MessageBox.Show("Nothing should be edit");
                return;
            }
            if (this.dgvStudentList.CurrentRow == null)
            {
                MessageBox.Show("Please select a setudnet to edit");
                return;
            }
            //get StudentId
            string studentId = this.dgvStudentList.CurrentRow.Cells["StudentId"].Value.ToString();
            //GET Info of the student
            StudentExt objStudentExt = objStudentService.GetStudentByStudentId(Convert.ToInt32(studentId));
            //call editfrom
            FrmEditStudent objEditStudent = new FrmEditStudent(objStudentExt);
            DialogResult   result         = objEditStudent.ShowDialog();

            if (result == DialogResult.OK)
            {
                btnQuery_Click_1(null, null);
            }
        }
Пример #3
0
        //修改学员对象
        private void btnEidt_Click(object sender, EventArgs e)
        {
            #region 验证数据
            //是否有学员需要修改
            if (this.dgvStudentList.RowCount == 0)
            {
                MessageBox.Show("没有任何需要修改的学员信息!", "提示");
                return;
            }
            //是否有选中
            if (this.dgvStudentList.CurrentRow == null)
            {
                MessageBox.Show("请选中需要修改的学员信息!", "提示");
                return;
            }
            #endregion

            //获取学号
            string studentId = this.dgvStudentList.CurrentRow.Cells["StudentId"].Value.ToString();

            //学号是否存在-查找数据是否存在学号
            Student objStudent = objStuService.GetStudentsById(studentId);

            //显示窗体
            //显示修改学员信息窗口
            FrmEditStudent objEditStudent = new FrmEditStudent(objStudent);
            objEditStudent.ShowDialog();
            //同步刷新
            btnQuery_Click(null, null);
        }
Пример #4
0
        //modify student
        private void btnEidt_Click(object sender, EventArgs e)
        {
            if (this.dgvStudentList.RowCount == 0)
            {
                MessageBox.Show("There is not student", "Warning");
                this.cboClass.Focus();
                return;
            }

            if (this.dgvStudentList.CurrentRow == null)
            {
                MessageBox.Show("The Student is not selected", "Warning");
                return;
            }

            // get student id
            string studentId = this.dgvStudentList.CurrentRow.Cells["StudentId"].Value.ToString();

            Student objStu = objStuService.GetStudentById(studentId);

            FrmEditStudent frmEditStu = new FrmEditStudent(objStu);

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

            //frmEditStu.Show();
        }
        //修改学员对象
        private void btnEidt_Click(object sender, EventArgs e)
        {
            if (this.dgvStudentList.Rows.Count == 0)
            {
                return;
            }
            int stuId = int.Parse(this.dgvStudentList.CurrentRow.Cells[0].Value.ToString());

            Student        student        = _studentService.GetStudentById(stuId);
            FrmEditStudent frmEditStudent = new FrmEditStudent(student, dgvStudentList.CurrentRow);

            frmEditStudent.Show();
        }
        /// <summary>
        /// 修改学员信息
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BtnEdit_Click(object sender, EventArgs e)
        {
            if (this.dgvStudentList.CurrentRow == null)
            {
                MessageBox.Show("请选择需要修改的学员!", "提示信息");
                return;
            }
            int            studentId      = Convert.ToInt32(this.dgvStudentList.CurrentRow.Cells["StudentId"].Value);
            StudentExt     result         = studentService.QueryStudentByStudengtId(studentId);
            FrmEditStudent frmEditStudent = new FrmEditStudent(result);

            frmEditStudent.ShowDialog();
            if (frmEditStudent.DialogResult == DialogResult.OK)
            {
                BtnQuery_Click(null, null);//同步刷新
            }
        }
Пример #7
0
        //修改学员对象
        private void btnEidt_Click(object sender, EventArgs e)
        {
            if (this.dgvStudentList.RowCount == 0)
            {
                MessageBox.Show("没有任何需要修改的学员信息!", "提示");
                return;
            }
            if (this.dgvStudentList.CurrentRow == null)
            {
                MessageBox.Show("请选中需要修改的学员信息!", "提示");
                return;
            }
            //获取学号
            string     studentId  = this.dgvStudentList.CurrentRow.Cells["StudentId"].Value.ToString();
            StudentExt objStudent = objStuService.GetStudentById(studentId); //根据学号获取学员对象
            //显示修改学员信息窗口
            FrmEditStudent objEditStudent = new FrmEditStudent(objStudent);

            objEditStudent.ShowDialog();
            btnQuery_Click(null, null);   //同步刷新显示
        }
        //修改学员对象
        private void btnEidt_Click(object sender, EventArgs e)
        {
            if (dgvStudentList.RowCount == 0 || dgvStudentList.CurrentRow == null)
            {
                MessageBox.Show("没有要修改的学员信息!", "打印提示:");
                return;
            }
            //修改学员信息
            string     stuid         = dgvStudentList.CurrentRow.Cells["StudentId"].Value.ToString();
            StudentExt objStudentExt = objStudnetService.GetStudentByStuID(stuid);

            objStudentExt.StudentId = Convert.ToInt32(stuid);
            //显示修改窗体
            FrmEditStudent frmEditStudent = new FrmEditStudent(objStudentExt);
            DialogResult   result         = frmEditStudent.ShowDialog();

            if (result == DialogResult.Cancel)
            {
                btnQuery_Click(null, null);
            }
        }
Пример #9
0
        //修改学员对象
        private void btnEidt_Click(object sender, EventArgs e)
        {
            //判断是否有修改的信息
            if (this.dgvStudentList.RowCount == 0 || this.dgvStudentList.CurrentRow == null)
            {
                MessageBox.Show("没有要修改的信息", "修改提示");
                return;
            }
            //获取要修改的学员学号
            string     studentId  = this.dgvStudentList.CurrentRow.Cells["StudentId"].Value.ToString();
            StudentExt objStudent = objStudentSerive.GetStudentByStuId(studentId);
            //显示修改窗体
            FrmEditStudent objEditForm = new FrmEditStudent(objStudent);
            DialogResult   result      = objEditForm.ShowDialog();

            //判断是否修改成功
            if (result == DialogResult.OK)
            {
                btnQuery_Click(null, null);
            }
        }
Пример #10
0
        //修改学员对象
        private void btnEidt_Click(object sender, EventArgs e)
        {
            if (this.dgvStudentList.RowCount == 0)
            {
                MessageBox.Show("没有任何要修改的信息", "提示信息");
                return;
            }
            if (this.dgvStudentList.CurrentRow == null)
            {
                MessageBox.Show("请选中要修改的学员的信息", "提示信息");
                return;
            }
            //获取学号
            string  studentId  = this.dgvStudentList.CurrentRow.Cells["StudentId"].Value.ToString();
            Student objStudent = objStuService.GetStudentById(studentId);
            //显示要修改的学员信息窗口
            FrmEditStudent objFrm = new FrmEditStudent(objStudent);

            if (objFrm.ShowDialog() == DialogResult.OK)
            {
                //同步刷新
                btnQuery_Click(null, null);
            }
        }