Exemple #1
0
 public bool SaveStudentInfo(CStudent student)
 {
     if (student != null)
     {
         //string sqlstr = "update ready set kscj=" + student.kscj.ToString() + ",ksy2='" + student.ksy2.Trim() + "',LKCS ="+ student.lkcs.ToString().Trim()+",LKKSRQ = '"+ student.ksrq.ToString()  +"' where ZKZMBH= '" + student.zkzmbh.Trim() + "'";
         string sqlstr;
         if (model.settings.lkrqORzkrq == 0)
         {
             sqlstr = "update ready set kscj=" + student.kscj.ToString() + ",ksy2='" + student.ksy2.Trim() + "',LKCS =" + student.lkcs.ToString().Trim() + ",KSRQ = '" + System.DateTime.Now.ToString() + "' where ZKZMBH= '" + student.zkzmbh.Trim() + "'";
         }
         else
         {
             sqlstr = "update ready set kscj=" + student.kscj.ToString() + ",ksy2='" + student.ksy2.Trim() + "',LKCS =" + student.lkcs.ToString().Trim() + ",LKKSRQ = '" + System.DateTime.Now.ToString() + "' where ZKZMBH= '" + student.zkzmbh.Trim() + "'";
         }
         if (msdbwrite.exeSql(sqlstr))
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
     else
     {
         return(false);
     }
 }
Exemple #2
0
 void TextInvoke_fun(CStudent student)
 {
     if (student != null)
     {
         pictureBox1.ImageLocation = ".\\photo.bmp";
         textBox1.Text             = student.zkzmbh;
         textBox2.Text             = student.sfzmhm;
         textBox3.Text             = student.xm;
         textBox4.Text             = student.kscx;
         textBox5.Text             = System.DateTime.Now.ToString();
         button1.Focus();
     }
     else
     {
         pictureBox1.ImageLocation = ".\\photonull.bmp";
         MessageBox.Show("没有考生信息!");
         ClearInputText();
         model.ClearDqStudentInfo();
     }
 }
Exemple #3
0
        private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
        {
            CStudent student = new CStudent(model);

            if (e.KeyChar == 13)
            {
                student = model.GetStudentInfo(textBox1.Text);
                if (student != null)
                {
                    textBox1.Text        = student.zkzmbh;
                    textBox2.Text        = student.sfzmhm;
                    textBox3.Text        = student.xm;
                    textBox4.Text        = student.kscx;
                    textBox5.Text        = System.DateTime.Now.ToString(); //student.zkrq.ToString();
                    model.djstudent.ksy2 = comboBox1.Text;
                    button1.Focus();
                }
                else
                {
                    MessageBox.Show("没有考生信息!");
                }
                pictureBox1.ImageLocation = ".\\photonull.bmp";
            }
        }
Exemple #4
0
 void model_OnIDCardReceived(object sender, CStudent student)
 {
     textBox1.Invoke(TextInvoke, student);
 }
Exemple #5
0
 public void RemoveStudent(CStudent student)
 {
     StudentList.Remove(student);
 }
Exemple #6
0
 public void AddStudent(CStudent student)
 {
     StudentList.Add(student);
 }
Exemple #7
0
        public CStudent  GetStudentInfo(string zkzmbhorsfzhm)
        {
            CStudent student = new CStudent(model);

            //       student.zkzmbh = zkzmbhorsfzhm.Trim();
            //            student.lsh = "12345678901";
            //            student.xm = "²âÊÔ";
            //            student.sfzmhm = "610104199922122345";
            //            student.kscx = "C1";
            //            student.ksrq = System.DateTime.Now;
            //return student;
            try
            {
                if (zkzmbhorsfzhm.Length == 12)
                {
                    string strsql = "select * from ready where ZKZMBH ='" + zkzmbhorsfzhm.Trim() + "'";

                    IDataReader dr = msdbread.executeReader(strsql);
                    if (dr.Read())
                    {
                        student.zkzmbh = zkzmbhorsfzhm.Trim();
                        student.lsh    = dr["LSH"].ToString().Trim();
                        student.xm     = dr["XM"].ToString().Trim();
                        student.sfzmhm = dr["SFZMHM"].ToString().Trim();
                        student.kscx   = dr["KSCX"].ToString().Trim();
                        student.ksrq   = System.DateTime.Now;
                        // student.zkrq = Convert.ToDateTime(dr["KSRQ"]);
                        string ksrqstr;
                        if (model.settings.lkrqORzkrq == 0)
                        {
                            ksrqstr = "KSRQ";
                        }
                        else
                        {
                            ksrqstr = "LKKSRQ";
                        }
                        if (Convert.ToDateTime(dr[ksrqstr]).Date != System.DateTime.Now.Date)
                        {
                            student.lkcs = 1;
                        }
                        else
                        {
                            if (dr["LKCS"] != null)
                            {
                                student.lkcs = Convert.ToInt16(dr["LKCS"]) + 1;
                            }
                            else
                            {
                                student.lkcs = 1;
                            }
                        }


                        dr.Close();
                        dr.Dispose();
                        return(student);
                    }

                    dr.Close();
                    dr.Dispose();
                    return(null);
                }
                else
                {
                    string      strsql = "select * from ready where SFZMHM ='" + zkzmbhorsfzhm.Trim() + "'";
                    IDataReader dr     = msdbread.executeReader(strsql);
                    if (dr.Read())
                    {
                        student.sfzmhm = zkzmbhorsfzhm.Trim();
                        student.lsh    = dr["LSH"].ToString().Trim();
                        student.xm     = dr["XM"].ToString().Trim();
                        student.zkzmbh = dr["ZKZMBH"].ToString().Trim();
                        student.kscx   = dr["KSCX"].ToString().Trim();
                        student.ksrq   = System.DateTime.Now;
                        // student.zkrq = Convert.ToDateTime(dr["LKKSRQ"]);
                        // student.ksy1 = dr["KSY1"].ToString().Trim();
                        string ksrqstr;
                        if (model.settings.lkrqORzkrq == 0)
                        {
                            ksrqstr = "KSRQ";
                        }
                        else
                        {
                            ksrqstr = "LKKSRQ";
                        }
                        if (Convert.ToDateTime(dr[ksrqstr]).Date != System.DateTime.Now.Date)
                        {
                            student.lkcs = 1;
                        }
                        else
                        {
                            if (dr["LKCS"] != null)
                            {
                                student.lkcs = Convert.ToInt16(dr["LKCS"]) + 1;
                            }
                            else
                            {
                                student.lkcs = 1;
                            }
                        }

                        dr.Close();
                        dr.Dispose();
                        return(student);
                    }
                    dr.Close();
                    dr.Dispose();
                    return(null);
                }
            }
            catch
            {
                return(null);
            }
        }
Exemple #8
0
 public void idcardinfo_OnIDCardReceived(string xm, string sfzhm)
 {
     djstudent = GetStudentInfo(sfzhm);
     OnIDCardReceived(this, djstudent);
 }
Exemple #9
0
 public bool SaveStudentInfo(CStudent student)
 {
     return(findandsavestudent.SaveStudentInfo(student));
 }
Exemple #10
0
 public CStudent  GetStudentInfo(string zkzmbhorsfzhm)
 {
     djstudent = findandsavestudent.GetStudentInfo(zkzmbhorsfzhm);
     return(djstudent);
 }
Exemple #11
0
        ////---------串口数据接收处理------------------------------
        //public void msg_OnUserDataReceived(object sender, byte[] e)
        //{
        //    this.OnUserDataReceived(this, e);
        //}

        //   public void initDataSet()
        //   {
        //       ds = new System.Data.DataSet();
        //       string connstr = "Data Source=" + settings.Ipaddress + ";Initial Catalog=zhuangkao;Persist Security Info=True;User ID=sa;Password=cgcsxb";//;Pooling=true;Max Pool Size=20;";
        //       conn = new SqlConnection(connstr);
        //       //SqlDataAdapter da = new SqlDataAdapter("select myorder as 序号,xm as 姓名,SFZMHM as 身份证号码,ZKZMBH as 准考证号码,KSCJ as 考试成绩,LKKSRQ as 考试日期,KSY2 as 考试员,ISPRINT as 已经打印 from ready where lkcs > 0", conn);
        //       SqlDataAdapter da = new SqlDataAdapter("select * from ready where lkcs > 0", conn);
        //       da.Fill(ds, "ready");
        //   }

        //   public void UpdateDataSet()
        //   {
        //       //ds.Dispose();
        //       //ds = msdb.exeSqlForDataSet("select xm as 姓名,SFZMHM as 身份证号码,ZKZMBH as 准考证号码,KSCJ as 考试成绩 from ready where lkcs > 0");
        //       //SqlDataAdapter da = new SqlDataAdapter("select myorder as 序号,xm as 姓名,SFZMHM as 身份证号码,ZKZMBH as 准考证号码,KSCJ as 考试成绩,LKKSRQ as 考试日期,KSY2 as 考试员,ISPRINT as 已经打印 from ready where lkcs > 0", conn);
        //       SqlDataAdapter da = new SqlDataAdapter("select * from ready where lkcs > 0", conn);
        //       //sqlCmdBuilder = new SqlCommandBuilder(da);
        //       //da.Update(ds, "ready");
        ////ds.Clear();
        ////da.Fill(ds, "ready");
        //     //  ds.AcceptChanges();

        //   }

        public void ClearDqStudentInfo()
        {
            djstudent = null;
        }