Example #1
0
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         if ((iRetCOM == 1) || (iRetUSB == 1))
         {
             int authenticate = CVRSDK.CVR_Authenticate();
             if (authenticate == 1)
             {
                 int readContent = CVRSDK.CVR_Read_Content(4);
                 if (readContent == 1)
                 {
                     this.label10.Text = "读卡操作成功!";
                     FillData();
                 }
                 else
                 {
                     this.label10.Text = "读卡操作失败!";
                 }
             }
             else
             {
                 MessageBox.Show("未放卡或卡片放置不正确");
             }
         }
         else
         {
             MessageBox.Show("初始化失败!");
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
Example #2
0
        public string printStuNo;       //打印准考证号

        #endregion

        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                if ((iRetCOM == 1) || (iRetUSB == 1))
                {
                    int authenticate = CVRSDK.CVR_Authenticate();
                    if (authenticate == 1)
                    {
                        int readContent = CVRSDK.CVR_Read_Content(4);
                        if (readContent == 1)
                        {
                            getFillIdCardData(false);

                            this.label10.Text = "读卡操作成功!";
                            //判断刷卡人是否已录入考试名单
                            string _sql         = "select kaochangName from db_exam where idcard='" + GetCVR_Idcard() + "' and examNameID='" + publicModel.examName + "'";
                            string kaochangName = Convert.ToString(DbHelperOleDb.GetSingle(_sql));
                            if (!string.IsNullOrEmpty(kaochangName))
                            {
                                DataTable dt       = DbHelperOleDb.Query("select * from db_students where IdCard='" + GetCVR_Idcard() + "' and examNameID='" + publicModel.examName + "'").Tables[0];
                                int       selCount = dt.Rows.Count;
                                if (selCount > 0)
                                {
                                    lblExamNo.Visible = true;
                                    lblExamNo.Text    = dt.Rows[0]["stuNo"].ToString();
                                    MessageBox.Show("此身份证已签到!");
                                    newflag = true;
                                }
                                else
                                {
                                    if (getStuExamRandomNum(kaochangName))
                                    {
                                        newflag = false;
                                        FillData(kaochangName);

                                        db_exam modelexam = new db_exam(GetCVR_Idcard(), publicModel.examName);
                                        //更改签到学生的签到状态
                                        modelexam.status = "已签到";
                                        modelexam.Update();
                                    }
                                }
                            }
                            else
                            {
                                MessageBox.Show("“" + publicModel.examName + "” 考试名单中无此人信息!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                                return;
                            }
                        }
                        else
                        {
                            this.label10.Text = "读卡操作失败!";
                        }
                    }
                    else
                    {
                        MessageBox.Show("未放卡或卡片放置不正确", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                }
                else
                {
                    MessageBox.Show("初始化失败!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }