private void BtnQueryById_Click(object sender, EventArgs e) { if (this.txtStudentId.Text.Trim().Length == 0) { MessageBox.Show("请输入学员学号", "提示信息"); return; } if (!DataValidate.IsInteger(this.txtStudentId.Text.Trim())) { MessageBox.Show("学号必须为整数!", "提示信息"); this.txtStudentId.Focus(); this.txtStudentId.SelectAll(); return; } int studentId = Convert.ToInt32(this.txtStudentId.Text.Trim()); var studentInfo = studentService.GetStudebntByStudentId(studentId); if (studentInfo == null) { MessageBox.Show("学员学号错误,暂无此学员!", "提示信息"); return; } if (frmStudentInfo == null) { frmStudentInfo = new FrmStudentInfo(studentInfo); frmStudentInfo.ShowDialog(); } else { frmStudentInfo.Activate(); frmStudentInfo.WindowState = FormWindowState.Normal; } }
//双击显示学员信息 private void DgvStudentList_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (this.dgvStudentList.Rows.Count != 0) { int studentId = Convert.ToInt32(this.dgvStudentList.CurrentRow.Cells["StudentId"].Value); var studentInfo = studentService.GetStudebntByStudentId(studentId); if (frmStudentInfo == null) { frmStudentInfo = new FrmStudentInfo(studentInfo); frmStudentInfo.ShowDialog(); } else { frmStudentInfo.Activate(); frmStudentInfo.WindowState = FormWindowState.Normal; } } }
private void btnQueryById_Click(object sender, EventArgs e) { if (this.txtStudentId.Text.Trim().Length == 0) { MessageBox.Show("StudentId can't be empty !"); this.txtStudentId.Focus(); return; } StudentExt objStudent = objStudentService.GetStudentByStudentNo(this.txtStudentId.Text.Trim()); if (objStudent == null) { MessageBox.Show("Can't find the student !"); this.txtStudentId.Focus(); this.txtStudentId.SelectAll(); return; } else { //Create Studentinf form FrmStudentInfo objFrmStudentInfo = new FrmStudentInfo(objStudent); objFrmStudentInfo.Show(); } }