//根据学号查询
        private void btnQueryById_Click(object sender, EventArgs e)
        {
            if (this.txtStudentId.Text.Trim().Length == 0)
            {
                MessageBox.Show("请输入学号!", "提示信息");
                this.txtStudentId.Focus();
                return;
            }
            //进一步验证学号必须是数字(请使用正则表达式...)
            if (!Common.DataValidate.IsInteger(this.txtStudentId.Text.ToString()))
            {
                MessageBox.Show("输入的学号必须为数字!", "提示信息");
                this.txtStudentId.Focus();
                return;
            }

            //执行查询
            StudentExt objStudent = objStuService.GetStudentById(this.txtStudentId.Text.Trim());

            if (objStudent == null)
            {
                MessageBox.Show("学员信息不存在!", "提示信息");
                this.txtStudentId.Focus();
            }
            else
            {
                //在学员详细信息窗体显示
                FrmStudentInfo objFrmStuInfo = new FrmStudentInfo(objStudent);
                objFrmStuInfo.Show();
            }
        }
Пример #2
0
        //根据学号查询
        private void btnQueryById_Click(object sender, EventArgs e)
        {
            //数据验证
            if (this.txtStudentId.Text.Trim().Length == 0)
            {
                MessageBox.Show("请输入查询学号!", "提示信息");
                this.txtStudentId.Focus();
                return;
            }
            if (!Common.DataValidate.IsInteger(this.txtStudentId.Text.Trim()))
            {
                MessageBox.Show("学号必须是整数!", "提示信息");
                this.txtStudentId.SelectAll();
                this.txtStudentId.Focus();
                return;
            }
            Student objStudent = objStuService.GetStudentById(this.txtStudentId.Text.Trim());

            if (objStudent == null)
            {
                MessageBox.Show("学员信息不存在!", "查询提示");
                this.txtStudentId.Focus();
            }
            else
            {
                //显示学员详细信息
                FrmStudentInfo objFrm = new FrmStudentInfo(objStudent);
                objFrm.Show();
            }
        }
Пример #3
0
 //双击查看学员详情
 private void dgvStudentList_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     if (this.dgvStudentList.CurrentRow != null)
     {
         string         studentId  = this.dgvStudentList.CurrentRow.Cells["StudentId"].Value.ToString();
         Student        objStudent = objStuService.GetStudentById(studentId);
         FrmStudentInfo objFrm     = new FrmStudentInfo(objStudent);
         objFrm.Show();
     }
 }
        //双击选中的学员对象并显示详细信息
        private void dgvStudentList_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            StudentService studentService = new StudentService();
            int            stuId          = int.Parse(this.dgvStudentList.CurrentRow.Cells[0].Value.ToString());
            Student        student        = null;

            student = studentService.GetStudentById(stuId);
            FrmStudentInfo info = new FrmStudentInfo(student);

            info.Show();
        }
        //根据学号查询
        private void btnQueryById_Click(object sender, EventArgs e)
        {
            if (txtStudentId.Text.Trim().Length == 0)
            {
                MessageBox.Show("请输入要查询的学号!", "查询提示:");
                return;
            }
            StudentExt     objStudent  = objStudnetService.GetStudentByStuID(txtStudentId.Text.Trim());
            FrmStudentInfo studentInfo = new FrmStudentInfo(objStudent);

            studentInfo.Show();
        }
Пример #6
0
        //Ë«»÷Ñ¡ÖеÄѧԱ¶ÔÏó²¢ÏÔʾÏêϸÐÅÏ¢
        private void dgvStudentList_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            if (this.dgvStudentList.CurrentRow == null)
            {
                return;
            }

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

            try
            {
                Student objStudent = objStudentService.GetStudentByStudentId(studentId);

                FrmStudentInfo frmStudentInfo = new FrmStudentInfo(objStudent);
                frmStudentInfo.Show();
            }
            catch (Exception ex)
            {
                MessageBox.Show("数据库操作错误,错误信息:" + ex.Message, "提示信息");
            }
        }
        /// <summary>
        /// 根据学号精确查找学员
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BtnQueryById_Click(object sender, EventArgs e)
        {
            if (this.txtStudentId.Text.Trim().Length == 0)
            {
                MessageBox.Show("请输入您要查询的学号!", "提示信息");
                return;
            }
            var        studentId = Convert.ToInt32(this.txtStudentId.Text.Trim());
            StudentExt result    = studentService.QueryStudentByStudengtId(studentId);

            if (result == null)
            {
                MessageBox.Show($"没有学号为{studentId}的学生,请输入正确的学号!", "提示信息");
                return;
            }
            else
            {
                FrmStudentInfo frmStudentInfo = new FrmStudentInfo(result);
                frmStudentInfo.Show();
            }
        }
Пример #8
0
        //search by student Id
        private void btnQueryById_Click(object sender, EventArgs e)
        {
            if (this.txtStudentId.Text.Trim().Length == 0)
            {
                MessageBox.Show("The Student Id can not be null!", "Warning");
                this.txtStudentId.Focus();
                return;
            }

            Student objStu = objStuService.GetStudentById(this.txtStudentId.Text.Trim());

            if (objStu == null)
            {
                MessageBox.Show("The student is not exist!", "Warning");
            }
            else
            {
                FrmStudentInfo frmStuInfo = new FrmStudentInfo(objStu);
                frmStuInfo.Show();
            }
        }
Пример #9
0
        private void btnQueryById_Click(object sender, EventArgs e)
        {
            if (this.txtStudentId.Text.Length == 0)
            {
                MessageBox.Show("Please entry the StudentID");
                this.txtStudentId.Focus();
                return;
            }


            StudentExt objStudentExt = objStudentService.GetStudentByStudentId(Convert.ToInt32(this.txtStudentId.Text.Trim()));

            if (objStudentExt == null)
            {
                MessageBox.Show("This studentd not exist !");
                this.txtStudentId.Focus();
                return;
            }
            else
            {
                FrmStudentInfo objFrmStudentInfo = new FrmStudentInfo(objStudentExt);
                objFrmStudentInfo.Show();
            }
        }
Пример #10
0
        //根据学号查询
        private void btnQueryById_Click(object sender, EventArgs e)
        {
            if (this.txtStudentId.Text.Trim().Length == 0)
            {
                MessageBox.Show("请输入要查询的学号", "查询提示");
                this.txtStudentId.Focus();
                return;
            }
            //根据学号查询学员对象
            StudentExt objStudent = objStudentSerive.GetStudentByStuId(this.txtStudentId.Text.Trim());

            if (objStudent == null)
            {
                MessageBox.Show("您输入的学号不正确,未找到该学员信息", "查询提示");
                this.txtStudentId.Focus();
                this.txtStudentId.SelectAll();
            }
            else
            {
                //创建学员信息显示窗体
                FrmStudentInfo objStudentForm = new FrmStudentInfo(objStudent);
                objStudentForm.Show();
            }
        }
Пример #11
0
        //根据学号查询
        private void btnQueryById_Click(object sender, EventArgs e)
        {
            #region 数据验证
            //学号是否为空
            if (this.txtStudentId.Text.Trim().Length == 0)
            {
                MessageBox.Show("请输入学号!", "提示信息");
                this.txtStudentId.Focus();
                return;
            }
            //学号是否为整数
            if (!Common.DataValidate.IsInteger(this.txtStudentId.Text.Trim()))
            {
                MessageBox.Show("学号必须是正整数!", "提示信息");
                this.txtStudentId.SelectAll();
                this.txtStudentId.Focus();
                return;
            }
            //学号是否存在-查找数据是否存在学号
            Student objStudent = objStuService.GetStudentsById(this.txtStudentId.Text.Trim());
            //判断是否为空
            if (objStudent == null)
            {
                MessageBox.Show("学员信息不存在!", "提示信息");
                this.txtStudentId.Focus();
                return;
            }
            #endregion



            #region 数据交互
            FrmStudentInfo frmStudentInfo = new FrmStudentInfo(objStudent);
            frmStudentInfo.Show();
            #endregion
        }
Пример #12
0
 //¸ù¾ÝѧºÅ²éѯ
 private void btnQueryById_Click(object sender, EventArgs e)
 {
     if (txtStudentId.Text.Trim().Length == 0)
     {
         MessageBox.Show("请输入学号", "提示信息");
         return;
     }
     if (!Common.DataValidate.IsInteger(txtStudentId.Text.Trim()))
     {
         MessageBox.Show("请输入数字学号", "提示信息");
         txtStudentId.SelectAll();
         txtStudentId.Focus();
         return;
     }
     try
     {
         Student objStudent = objStudentService.GetStudentByStudentId(txtStudentId.Text.Trim());
         stuList = new List <Student>();
         if (objStudent == null)
         {
             MessageBox.Show("学员信息不存在", "查询提示");
             this.txtStudentId.Focus();
             this.txtStudentId.SelectAll();
             return;
         }
         else
         {
             FrmStudentInfo frmStudentInfo = new FrmStudentInfo(objStudent);
             frmStudentInfo.Show();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("数据库操作错误,错误信息:" + ex.Message, "提示信息");
     }
 }