Example #1
0
        private void ShowPerson()
        {
            string select_all = "select p.xh \"学号\", p.xm \"姓名\","
                                + " case(f.print) when '' then '未登记' else '已登记' end \"登记状态\" "
                                + ", pe.nj_name \"年级\", pe.bj_name \"班级\", pe.tel \"电话\", pe.email \"邮箱\" "
                                + " from person_info_min as p,person_finger_print as f ,person_expand_info as pe"
                                + " where p.xh=f.xh  and p.xh=pe.xh  order  by p.xh;";
            DataTable dt = CsharpSQLiteHelper.ExecuteTable(select_all, null);

            dataGridView1.DataSource = dt;

            int iNumberofStudents = dt.Rows.Count;

            this.groupBox2.Text = "学生列表 共有学生" + iNumberofStudents.ToString() + "名";

            this.dataGridView1.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
            int headerW  = this.dataGridView1.RowHeadersWidth;
            int columnsW = 0;
            DataGridViewColumnCollection columns = this.dataGridView1.Columns;

            for (int i = 0; i < columns.Count; i++)
            {
                columnsW += columns[i].Width;
            }
            if (columnsW + headerW < this.dataGridView1.Width)
            {
                int leftTotalWidht       = this.dataGridView1.Width - columnsW - headerW;
                int eachColumnAddedWidth = leftTotalWidht / columns.Count;
                for (int i = 0; i < columns.Count; i++)
                {
                    columns[i].Width += eachColumnAddedWidth;
                }
            }
        }
Example #2
0
        public static serialPortConfig getDefaultConfig()
        {
            serialPortConfig config    = null;
            string           port_name = string.Empty;
            string           baut_rate = string.Empty;
            string           sql       = "select vvalue from sys_config where vkey = '{0}'";
            DataTable        dt_temp   = CsharpSQLiteHelper.ExecuteTable(sql, new object[1] {
                "port_name"
            });

            if (dt_temp.Rows.Count > 0)
            {
                port_name = dt_temp.Rows[0]["vvalue"].ToString();
            }
            sql     = "select vvalue from sys_config where vkey = '{0}'";
            dt_temp = CsharpSQLiteHelper.ExecuteTable(sql, new object[1] {
                "baut_rate"
            });
            if (dt_temp.Rows.Count > 0)
            {
                baut_rate = dt_temp.Rows[0]["vvalue"].ToString();
            }
            config = new serialPortConfig(port_name, baut_rate);

            return(config);
        }
        void HistoryCheckRecord_Shown(object sender, EventArgs e)
        {
            string    select = "SELECT record_id \"编号\",info \"备注\",create_time \"创建时间\" FROM check_record_info order by create_time desc;";
            DataTable dt     = CsharpSQLiteHelper.ExecuteTable(select, null);

            this.dataGridView1.DataSource = dt;

            this.format_dgv(this.dataGridView1);
        }
Example #4
0
        public static serialPortConfig getDefaultConfig()
        {
            serialPortConfig config    = null;
            string           port_name = string.Empty;
            string           baut_rate = string.Empty;
            string           sql       = "select vvalue from sys_config where vkey = '{0}'";
            DataTable        dt_temp   = CsharpSQLiteHelper.ExecuteTable(sql, new object[1] {
                "port_name"
            });

            if (dt_temp.Rows.Count > 0)
            {
                port_name = dt_temp.Rows[0]["vvalue"].ToString();
            }
            sql     = "select vvalue from sys_config where vkey = '{0}'";
            dt_temp = CsharpSQLiteHelper.ExecuteTable(sql, new object[1] {
                "baut_rate"
            });
            if (dt_temp.Rows.Count > 0)
            {
                baut_rate = dt_temp.Rows[0]["vvalue"].ToString();
            }
            config = new serialPortConfig(port_name, baut_rate);
            //IObjectContainer db = Db4oFactory.OpenFile(serialPortConfig.configFilePath);
            //try
            //{
            //    IList<serialPortConfig> list = db.Query<serialPortConfig>(delegate(serialPortConfig cf)
            //    {
            //        return cf.configName == "default";
            //    }
            //                                              );
            //    if (list.Count > 0)
            //    {
            //        config = list[0];
            //    }

            //}
            //finally
            //{
            //    db.Close();
            //}
            return(config);
        }
Example #5
0
        void frmUserIdentify_Shown(object sender, EventArgs e)
        {
            if (Program.g_zkfp_handle != -1)
            {
                Program.g_ZKFP.FreeFPCacheDB(Program.g_zkfp_handle);
                Program.g_zkfp_handle = -1;
            }
            Program.g_zkfp_handle = Program.g_ZKFP.CreateFPCacheDB();
            //加入保存的指纹模板
            index = 0;

            //List<object> keys = nsConfigDB.ConfigDB.getKeys();
            //foreach (object key in keys)
            //{
            //    string tmp = (string)nsConfigDB.ConfigDB.getConfig((string)key);
            //    index++;
            //    Program.g_ZKFP.AddRegTemplateStrToFPCacheDB(Program.g_zkfp_handle, index, tmp);
            //    index_user_list.Add(index, (string)key);
            //}

            string select_all = "select p.xh, p.xm,"
                                + " f.print "
                                + ", pe.nj \"年级\", pe.bj \"班级\", pe.tel \"电话\", pe.email \"邮箱\" "
                                + " from person_info_min as p,person_finger_print as f ,person_expand_info as pe"
                                + " where p.xh=f.xh  and p.xh=pe.xh  order  by p.xh;";

            this.person_list = CsharpSQLiteHelper.ExecuteTable(select_all, null);
            foreach (DataRow dr in this.person_list.Rows)
            {
                string id = dr["xh"].ToString();

                string tmp = dr["print"].ToString();
                index++;
                Program.g_ZKFP.AddRegTemplateStrToFPCacheDB(Program.g_zkfp_handle, index, tmp);
                index_user_list.Add(index, id);
            }
            this.refresh_check_list();

            //开始1:N识别

            Program.g_ZKFP.SetAutoIdentifyPara(true, Program.g_zkfp_handle, 8);
            this.matrixCircularProgressControl1.Start();
        }
Example #6
0
        void refresh_check_list()
        {
            // 初始化待考勤人员列表
            string select_not_checked = "select p.xh \"学号\", p.xm \"姓名\" "
                                        + "from person_info_min as p  where p.xh not in(select xh from CheckRecords where record_id = '{0}');";
            DataTable dt_not_checked = CsharpSQLiteHelper.ExecuteTable(select_not_checked, new object[] { this.unique_check_id });

            this.dgvNotChecked.DataSource = dt_not_checked;
            this.gbNotChecked.Text        = string.Format("待考勤共{0}人", dt_not_checked.Rows.Count.ToString());
            //初始化已考勤人员
            string select_checked = "select p.xh \"学号\", p.xm \"姓名\" "
                                    + "from person_info_min as p  where p.xh in(select xh from CheckRecords where record_id = '{0}');";
            DataTable dt_checked = CsharpSQLiteHelper.ExecuteTable(select_checked, new object[] { this.unique_check_id });

            this.dgvChecked.DataSource = dt_checked;
            this.gbChecked.Text        = string.Format("已考勤共{0}人", dt_checked.Rows.Count.ToString());

            this.format_dgv(this.dgvChecked);
            this.format_dgv(this.dgvNotChecked);
        }
Example #7
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            string strID = txtId.Text;

            if (strID.Length < 0)
            {
                MessageBox.Show("请输入学号!");
                return;
            }
            //if (strID.Length < 0 || strID.Length > 6 || !Regex.IsMatch(strID, "[0-9]{6}"))
            //{
            //    MessageBox.Show("学号应为六位数字!");
            //    return;
            //}

            Func <string, bool> check_id_exists = id =>
            {
                string    select_id = "select xh from person_info_min where xh={0}";
                DataTable dt        = CsharpSQLiteHelper.ExecuteTable(select_id, new object[] { id });
                return(dt.Rows.Count > 0 ? true : false);
            };

            if (check_id_exists(strID))
            {
                MessageBox.Show
                    ("已存在学号为" + strID + "的学生!");
                return;
            }
            else
            {
                string name          = txtName.Text;
                string nj            = txtnj.Text;
                string bj            = txtbj.Text;
                string tel           = txtTel.Text;
                string email         = txtMail.Text;
                string insert_person = string.Format("insert into person_info_min values('{0}','{1}');", strID, name)
                                       + string.Format("insert into person_expand_info(xh,nj_name,bj_name,tel,email) values('{0}','{1}','{2}','{3}', '{4}');",
                                                       strID, nj, bj, tel, email)
                                       + string.Format("insert into person_finger_print values('{0}','');", strID);
                int r = CsharpSQLiteHelper.ExecuteNonQuery(insert_person, null);
                if (r > 0)
                {
                    MessageBox.Show("学号为" + txtId.Text +
                                    "的学生新增完成!");
                }
            }
            ShowPerson();
            SetLabelContent();

            //if (writeData)
            //{
            //    rfidCheck_CheckOn.PersonAdd(new Person(txtId.Text,
            //                                            txtName.Text,
            //                                            txtTel.Text,
            //                                            txtMail.Text,
            //                                            txtbj.Text,
            //                                            txtnj.Text,
            //                                            null));

            //    MessageBox.Show("学号为" + txtId.Text +
            //        "的学生新增完成!");

            //    this.bRefreshParentForm = true;
            //}
            //dataGridView1.DataSource = myDataSet.Tables["student"];
        }