示例#1
0
        private void txtStuCardNo_KeyDown(object sender, KeyEventArgs e)
        {
            if (this.txtStuCardNo.Text.Trim().Length != 0 && e.KeyValue == 13)
            {
                //显示学员信息
                StudentExt objStu = new StudentService().GetStudentByCardNo
                                        (this.txtStuCardNo.Text.Trim());
                if (objStu == null)
                {
                    MessageBox.Show("Wrong card no!", "information");
                    this.txtStuCardNo.SelectAll();
                    return;
                }
                this.lblStuName.Text  = objStu.StudentName;
                this.lblStuClass.Text = objStu.ClassName;
                this.lblStuId.Text    = objStu.StudentId.ToString();


                //添加打卡信息
                string result = objAttendanceService.AddRecord(this.txtStuCardNo.Text.Trim());
                if (result != "success")
                {
                    this.lblInfo.Text = "Failed!";
                    MessageBox.Show(result, "Failed information");
                }
                else
                {
                    this.lblInfo.Text = "Success!";
                }
                this.txtStuCardNo.Text = "";
                this.txtStuCardNo.Focus();
            }
        }
示例#2
0
        //学员打卡
        private void txtStuCardNo_KeyDown(object sender, KeyEventArgs e)
        {
            if (this.txtStuCardNo.Text.Trim().Length != 0 && e.KeyValue == 13)
            {
                //显示学员信息
                Student objStudent = objStudentService.GetStudentByCardNo(this.txtStuCardNo.Text.Trim());
                if (objStudent == null)
                {
                    MessageBox.Show("卡号不正确!", "提示信息");
                    this.lblInfo.Text = "打卡失败!";
                    this.txtStuCardNo.SelectAll();
                    this.lblStuName.Text  = "";
                    this.lblStuClass.Text = "";
                    this.lblStuId.Text    = "";
                    this.pbStu.Image      = null;
                    return;
                }

                this.lblStuName.Text  = objStudent.StudentName;
                this.lblStuClass.Text = objStudent.ClassName;
                this.lblStuId.Text    = objStudent.StudentId.ToString();
                if (objStudent.StuImage != null && objStudent.StuImage.Length != 0)
                {
                    this.pbStu.Image = (Image) new Common.SerializeObjectToString().DeserializeObject(objStudent.StuImage);
                }
                else
                {
                    this.pbStu.Image = Image.FromFile("default.png");
                }

                //添加打开信息
                string result = objAttendanceService.AddRecord(this.txtStuCardNo.Text.Trim());
                if (result != "Success!")
                {
                    this.lblInfo.Text = "打卡失败!";
                    MessageBox.Show(result, "错误提示");
                }
                else
                {
                    this.lblInfo.Text = "打卡成功!";
                    //更新已经打卡的学员总数,缺勤总数
                    ShowStat();
                    objStudent.SignTime = Convert.ToDateTime(DateTime.Now.ToString());

                    //将学员信息同步显示在列表中
                    signedStudent.Add(objStudent);
                    this.dgvStudentList.DataSource = null;
                    this.dgvStudentList.DataSource = this.signedStudent;


                    //等待下一个输入
                    this.txtStuCardNo.Text = "";
                    this.txtStuCardNo.Focus();
                }
            }
        }
示例#3
0
        //学员打卡
        private void txtStuCardNo_KeyDown(object sender, KeyEventArgs e)
        {
            if (this.txtStuCardNo.Text.Trim().Length != 0 && e.KeyValue == 13)
            {
                //1.显示学员信息
                StudentExt objStu = objStudentService.GetStudentByCardNo(this.txtStuCardNo.Text.Trim());
                if (objStu == null)
                {
                    MessageBox.Show("输入的考勤卡号不正确!", "提示信息");
                    this.lblInfo.Text = "打卡失败!";
                    lblStuName.Text   = "";
                    lblStuClass.Text  = "";
                    lblStuId.Text     = "";
                    this.pbStu.Image  = null;
                    return;
                }
                else
                {
                    lblStuName.Text  = objStu.StudentName;
                    lblStuId.Text    = objStu.StudentId.ToString();
                    lblStuClass.Text = objStu.ClassName.ToString();
                    if (this.pbStu.Image != null && objStu.StuImage.Length != 0)
                    {
                        this.pbStu.Image = (Image) new SerializeObjectToString().DeserializeObject(objStu.StuImage);
                    }
                    else
                    {
                        this.pbStu.Image = Image.FromFile("default.png");
                    }
                }
                //2.添加打卡记录
                string result = objAttendanceService.AddRecord(this.txtStuCardNo.Text.Trim());
                if (result != "success")
                {
                    this.lblInfo.Text = "打卡失败!";
                    MessageBox.Show(result, "错误提示!");
                }
                else
                {
                    this.lblInfo.Text = "打卡成功!";
                    ShowStat();
                    objStu.DTime = DateTime.Now;
                    //将学员信息同步显示在列表中
                    SignedStudent.Add(objStu);
                    this.dgvStudentList.DataSource = null;
                    this.dgvStudentList.DataSource = this.SignedStudent;

                    this.txtStuCardNo.Text = " ";
                    this.txtStuCardNo.Focus();
                }
            }
        }
示例#4
0
        //学员打卡
        private void txtStuCardNo_KeyDown(object sender, KeyEventArgs e)
        {
            if (this.txtStuCardNo.Text.Trim().Length == 0 || e.KeyValue != 13)
            {
                return;
            }
            //显示学员信息
            StudentExt objStu = objStuService.GetStudentByCardNo(this.txtStuCardNo.Text.Trim());

            if (objStu == null)
            {
                MessageBox.Show("卡号不正确", "信息提示");
                this.lblInfo.Text = "打卡失败";
                this.txtStuCardNo.SelectAll();
                this.lblStuName.Text  = "";
                this.lblStuClass.Text = "";
                this.lblStuId.Text    = "";
                this.pbStu.Image      = null;
            }
            else
            {
                this.lblStuName.Text  = objStu.StudentName;
                this.lblStuClass.Text = objStu.ClassName;
                this.lblStuId.Text    = objStu.StudentId.ToString();
                if (objStu.StuImage != null && objStu.StuImage.Length != 0)
                {
                    this.pbStu.Image = (Image) new SerializeObjectToString().DeserializeObject(objStu.StuImage);
                }
                else
                {
                    this.pbStu.Image = Image.FromFile("default.png");
                }
                //添加打卡信息
                string result = objAttService.AddRecord(this.txtStuCardNo.Text.Trim());
                if (result != "success")
                {
                    this.lblInfo.Text = "打卡失败";
                    MessageBox.Show(result, "提示信息");
                }
                else
                {
                    this.lblInfo.Text = "打卡成功";
                    ShowStat();                //同时更新实到人数和缺勤人数
                    this.txtStuCardNo.Text = "";
                    this.txtStuCardNo.Focus(); //等待下一个学员打卡
                }
            }
        }
示例#5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void txtStuCardNo_KeyDown(object sender, KeyEventArgs e)
        {
            if (this.txtStuCardNo.Text.Trim().Length == 0 || e.KeyValue != 13)
            {
                return;
            }
            //show student info
            StudentExt objStudentExt = objStudentService.GetStudentByStudentNo(this.txtStuCardNo.Text.Trim());

            if (objStudentExt == null)
            {
                MessageBox.Show("Faile");
                this.txtStuCardNo.SelectAll();
                this.lblStuClass.Text = "";
                this.lblFName.Text    = "";
                this.lblLName.Text    = "";
                this.pbStu.Image      = null;
            }
            else
            {
                this.lblStuClass.Text = objStudentExt.ClassName;
                this.lblFName.Text    = objStudentExt.FirstName;
                this.lblLName.Text    = objStudentExt.LastName;
                if (objStudentExt.StuImage != null && objStudentExt.StuImage.Length != 0)
                {
                    this.pbStu.Image = (Image) new SerializeObjectToString().DeserializeObject(objStudentExt.StuImage);
                }
                else
                {
                    this.pbStu.Image = Image.FromFile("default.jpg");
                }
                string result = objAttendance.AddRecord(this.txtStuCardNo.Text.Trim());
                if (result != "success")
                {
                    this.lblInfo.Text = "Fale ! !";
                    MessageBox.Show(result);
                }
                else
                {
                    this.lblInfo.Text = "success!";
                    ShowStar();
                    this.txtStuCardNo.Text = "";
                    this.txtStuCardNo.Focus();//wait for next student
                }
            }
        }
        //学员打卡
        private void txtStuCardNo_KeyDown(object sender, KeyEventArgs e)
        {
            if (txtStuCardNo.Text.Trim().Length == 0 || e.KeyValue != 13)
            {
                return;
            }
            //显示学员信息
            StudentExt objStudent = objStudentService.GetStudentByCardNo(txtStuCardNo.Text.Trim());

            if (objStudent.StudentName == null)
            {
                MessageBox.Show("卡号不正确,请重新打卡!", "打卡提示:");
                lblInfo.Text = "打卡失败!";
                txtStuCardNo.SelectAll();
                lblStuName.Text  = "";
                lblStuClass.Text = "";
                lblStuId.Text    = "";
                pbStu.Image      = null;
            }
            else
            {
                lblInfo.Text     = "打卡成功!";
                lblStuName.Text  = objStudent.StudentName;
                lblStuClass.Text = objStudent.ClassName;
                lblStuId.Text    = objStudent.StudentId.ToString();
                pbStu.Image      = objStudent.StuImage.Trim().Length == 0?
                                   Image.FromFile("default.png")
                    : (Image) new SerializeObjectToString().DeserializeObject(objStudent.StuImage);
                //添加打卡信息
                string result = objAttendanceService.AddRecord(txtStuCardNo.Text.Trim());
                if (result != "Success")
                {
                    lblInfo.Text = "打卡失败!";
                    MessageBox.Show(result, "打卡提示:");
                }
                else
                {
                    lblInfo.Text = "打卡成功!";
                    ShowStat();//更新打卡人数
                    txtStuCardNo.Text = "";
                    txtStuCardNo.Focus();
                }
            }
        }
示例#7
0
        //学员打卡
        private void txtStuCardNo_KeyDown(object sender, KeyEventArgs e)
        {
            //判断是否有输入内容,是否按下回车键
            if (this.txtStuCardNo.Text.Trim().Length != 0 && e.KeyValue == 13)
            {
                //显示学员信息
                Student objStu = new StudentService().GetStudentByCardNo(this.txtStuCardNo.Text.Trim());
                //没有查找到的情况
                if (objStu == null)
                {
                    MessageBox.Show("卡号不正确!", "信息提示");
                    this.lblInfo.Text = "打卡失败!";
                    this.txtStuCardNo.SelectAll();
                    this.lblStuName.Text  = "";
                    this.lblStuClass.Text = "";
                    this.lblStuId.Text    = "";
                    this.pbStu.Image      = null;
                    return;
                }
                //查找到的显示学生姓名 班级  学生ID
                this.lblStuName.Text  = objStu.StudentName;
                this.lblStuClass.Text = objStu.ClassName;
                this.lblStuId.Text    = objStu.StudentId.ToString();
                this.pbStu.Image      = Image.FromFile("1.jpg");

                //添加打卡信息
                string result = objAttendanceService.AddRecord(this.txtStuCardNo.Text.Trim());
                if (result != "success")
                {
                    this.lblInfo.Text = "打卡失败!";
                    MessageBox.Show(result, "错误提示");
                }
                else
                {
                    this.lblInfo.Text = "打卡成功!";
                    ShowStat();
                    this.txtStuCardNo.Text = ""; //等待下一个打卡
                    this.txtStuCardNo.Focus();
                }
            }
        }
示例#8
0
 /// <summary>
 /// 回车键打卡
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void TxtStuCardNo_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyValue == 13 && this.txtStuCardNo.Text.Trim().Length != 0)
     {
         try
         {
             //展示学员信息
             StudentExt studentInfo = studentService.GetStudebntByCardNo(this.txtStuCardNo.Text.Trim());
             if (studentInfo == null)
             {
                 this.lblStuName.Text  = "";
                 this.lblStuId.Text    = "";
                 this.lblStuClass.Text = "";
                 this.pbStu.Image      = null;
                 this.lblInfo.Text     = "打卡失败!";
                 MessageBox.Show("考勤卡号错误!", "提示信息");
                 return;
             }
             else
             {
                 //学员信息展示
                 this.lblStuName.Text  = studentInfo.StudentName;
                 this.lblStuId.Text    = studentInfo.StudentId.ToString();
                 this.lblStuClass.Text = studentInfo.ClassName;
                 #region 判断照片是否为null或者""字符串
                 if (studentInfo.StuImage == null || studentInfo.StuImage.Length == 0)
                 {
                     this.pbStu.Image = Image.FromFile("default.png");
                 }
                 else
                 {
                     this.pbStu.Image = (Image)SerializeObjectToString.DeserializeObject(studentInfo.StuImage);
                 }
                 #endregion
                 //添加打卡信息
                 string result = attendanceService.AddRecord(this.txtStuCardNo.Text.Trim());
                 if (result != "success")
                 {
                     this.lblInfo.Text = "打卡失败!";
                     MessageBox.Show(result, "提示信息");
                 }
                 else
                 {
                     this.lblInfo.Text = "打卡成功!";
                     //更新打卡人员总数
                     SignStart();
                     //将学员信息同步展示到列表中
                     studentInfo.DTime = DateTime.Now;
                     studentList.Add(studentInfo);
                     this.dgvStudentList.DataSource = null;
                     this.dgvStudentList.DataSource = studentList;
                     //清空卡号,等待下一个打卡
                     this.txtStuCardNo.Text = "";
                     this.txtStuCardNo.Focus();
                 }
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message, "提示信息");
         }
     }
 }