public static DataTable GetCheckedPersonDataSet(string dateStart, string dateEnd) { //DataSet ds = null; DataTable dt = null; try { if (InitialDB()) { dt = CsharpSQLiteHelper.ExecuteTable( SqlSelectCheckedPersonInPeriod , new object[2] { dateStart, dateEnd }); //ds = SQLiteHelper.ExecuteDataSet(dbPath, // SqlSelectCheckedPersonInPeriod // , new object[2] { dateStart, dateEnd }); } } catch (System.Exception ex) { MessageBox.Show("读取学生数据库时出现错误!" + ex.Message); return(null); } return(dt); }
public static DataTable GetClassCheckInfo(string className, string start, string end) { DataSet ds = null; try { DataTable dt = CsharpSQLiteHelper.ExecuteTable( sqlSelect_GetClassCheckInfo, new object[3] { className, start, end }); return(dt); //ds = SQLiteHelper.ExecuteDataSet( // SQLiteHelper.connectString, // sqlSelect_GetClassCheckInfo, new object[3] { className, start, end }); //if (ds != null) //{ // if (ds.Tables.Count > 0) // { // return ds.Tables[0]; // } //} } catch (System.Exception ex) { MessageBox.Show("查询数据库时出现错误:" + ex.Message); } return(null); }
public bool ConfigExists(int group) { //DataSet ds = null; try { DataTable dt = CsharpSQLiteHelper.ExecuteTable(sqlSelect_SpecifiedRoomConfig, new object[1] { group }); if (dt.Rows.Count > 0) { return(true); } //ds = SQLiteHelper.ExecuteDataSet( // SQLiteHelper.connectString, // sqlSelect_SpecifiedRoomConfig, new object[1] { group }); //if (ds != null) //{ // if (ds.Tables.Count > 0) // { // if (ds.Tables[0].Rows.Count > 0) // { // return true; // } // } //} } catch (System.Exception ex) { MessageBox.Show("查询数据库时出现错误:" + ex.Message); } return(false); }
public static bool PersonExist(Person p) { bool bR = false; if (InitialDB()) { int result = 0; DataTable dt = CsharpSQLiteHelper.ExecuteTable(SqlCheckSpecialPersonExist, new object[1] { p.id_num }); if (dt.Rows.Count >= 1) { bR = true; } } /* * List<Person> lp = rfidCheck_CheckOn.GetPersonList(); * if (lp != null) * { * * for (int i = 0; i < lp.Count; i++) * { * if (p.id_num == lp[i].id_num) * { * bR = true; * break; * } * } * } */ return(bR); }
public static DataTable GetCheckDataSet() { DataSet dsCheckRecords = null; DataTable dtCheckRecords = null; try { if (InitialDB()) { dtCheckRecords = CsharpSQLiteHelper.ExecuteTable(SqlSelectAllRecords, null); //dsCheckRecords = SQLiteHelper.ExecuteDataSet(dbPath, SqlSelectAllRecords, null); } /* * * if (!File.Exists(FileCheckName)) * { * rfidCheck_CheckOn.InitialCheckDB(); * } * dsCheckRecords = new DataSet(); * dsCheckRecords.ReadXml(FileCheckName); */ } catch (System.Exception ex) { MessageBox.Show("读取学生数据库时出现错误!" + ex.Message); return(null); } return(dtCheckRecords); }
public static List <string> GetnjList() { List <string> list = new List <string>(); DataSet ds = null; DataTable dt = null; try { if (InitialDB()) { dt = CsharpSQLiteHelper.ExecuteTable(SqlGetnj, null); for (int i = 0; i < dt.Rows.Count; i++) { list.Add(dt.Rows[i][0].ToString()); } //ds = SQLiteHelper.ExecuteDataSet(dbPath, SqlGetnj, null); } //if (ds != null && ds.Tables.Count > 0) //{ // DataTable dt = ds.Tables[0]; // for (int i = 0; i < dt.Rows.Count; i++) // { // list.Add(dt.Rows[i][0].ToString()); // } //} } catch (System.Exception ex) { MessageBox.Show("读取学生数据库时出现错误!" + ex.Message); return(list); } return(list); }
public static bool QuestionExists(string content) { try { DataTable dt = CsharpSQLiteHelper.ExecuteTable(sqlSelect_getSpecifiedQuestion, new object[1] { content }); if (dt.Rows.Count > 0) { return(true); } //ds = SQLiteHelper.ExecuteDataSet( // SQLiteHelper.connectString, // sqlSelect_getSpecifiedQuestion, new object[1] { content }); //if (ds != null) //{ // if (ds.Tables.Count > 0) // { // if (ds.Tables[0].Rows.Count > 0) // { // return true; // } // } //} } catch (System.Exception ex) { MessageBox.Show("查询数据库时出现错误:" + ex.Message); } return(false); }
public static DataTable getAllQuestion() { DataSet ds = null; try { DataTable dt = CsharpSQLiteHelper.ExecuteTable(sqlSelect_getAllQuestion, null); return(dt); //ds = SQLiteHelper.ExecuteDataSet( // SQLiteHelper.connectString, // sqlSelect_getAllQuestion, null); //if (ds != null) //{ // if (ds.Tables.Count > 0) // { // return ds.Tables[0]; // } //} } catch (System.Exception ex) { MessageBox.Show("查询数据库时出现错误:" + ex.Message); } return(null); }
public DataTable getStudentInfo(string id) { DataSet ds = null; try { DataTable dt = CsharpSQLiteHelper.ExecuteTable(sqlSelect_GetSpecifiedStudentInfo, new object[1] { id }); return(dt); //ds = SQLiteHelper.ExecuteDataSet( // SQLiteHelper.connectString, // sqlSelect_GetSpecifiedStudentInfo, new object[1] { id }); //if (ds != null) //{ // if (ds.Tables.Count > 0) // { // return ds.Tables[0]; // } //} } catch (System.Exception ex) { MessageBox.Show("查询数据库时出现错误:" + ex.Message); } return(null); }
/// <summary> /// 获取指定时间考勤过的人员列表 /// </summary> /// <param name="strCheckDate"></param> /// <returns></returns> //public static List<CheckPerson> GetCheckedPersonList(string strCheckDate) //{ // List<CheckPerson> personList = new List<CheckPerson>(); // ///* // //if (null == strCheckDate) // //{ // // return null; // //} // //DataSet myDataSetPerson = rfidCheck_CheckOn.GetPersonDataSet(); // //DataSet myDataSetRecords = rfidCheck_CheckOn.GetCheckDataSet(); // //DataTable tbPerson = myDataSetPerson.Tables["student"]; // //if (tbPerson == null) // //{ // // rfidCheck_CheckOn.AddStudentTableToPersonDS(ref myDataSetPerson); // // tbPerson = myDataSetPerson.Tables["student"]; // //} // //DataTable tbRecords = myDataSetRecords.Tables["CheckRecords"]; // //if (null == tbRecords) // //{ // // rfidCheck_CheckOn.AddCheckRecordTableToCheckDS(ref myDataSetRecords); // // tbRecords = myDataSetRecords.Tables["CheckRecords"]; // //} // //string strDate = null; // //strDate = rfidCheck_CheckOn.GetDateSubString(strCheckDate); // //if (null != strDate) // //{ // // for (int i = 0; i < tbRecords.Rows.Count; i++) // // { // // string strDateTemp = rfidCheck_CheckOn.GetDateSubString(tbRecords.Rows[i]["Date"].ToString()); ; // // if (null != strDateTemp && strDateTemp == strDate)// 保证获得的记录的时间和要求的时间一致 // // { // // string tempID = tbRecords.Rows[i]["id_no"].ToString(); // // string tempDate = tbRecords.Rows[i]["Date"].ToString(); // // for (int j = 0; j < tbPerson.Rows.Count; j++) // // { // // if (tbPerson.Rows[j]["id_no"].ToString() == tempID) // // { // // CheckRecord cr = new CheckRecord(tempID, tbPerson.Rows[j]["name"].ToString(), tbRecords.Rows[i]["Date"].ToString()); // // Person p = new Person(tbPerson.Rows[j]["id_no"].ToString(), tbPerson.Rows[j]["name"].ToString(), tbPerson.Rows[j]["tel"].ToString(), tbPerson.Rows[j]["mail"].ToString()); // // CheckPerson cp = new CheckPerson(tempDate, p); // // personList.Add(cp); // // break; // // } // // } // // } // // } // //} // return personList; //} //public static List<CheckRecord> GetCheckRecords(string startTime, string endTime) //{ // List<CheckRecord> records = new List<CheckRecord>(); // return records; //} /// <summary> /// 获取考勤记录 /// </summary> /// <param name="strCheckDate">需要获取的考勤记录的时间</param> /// <returns>考勤记录的集合</returns> //public static List<CheckRecord> GetCheckRecords(string strCheckDate) //{ // if (null == strCheckDate) // { // return null; // } // List<CheckRecord> records = new List<CheckRecord>(); // DataSet myDataSetRecords = rfidCheck_CheckOn.GetCheckDataSet(); // DataTable tbRecords = myDataSetRecords.Tables[0]; // if (null != tbRecords) // { // } // /* // if (null == tbRecords) // { // rfidCheck_CheckOn.AddCheckRecordTableToCheckDS(ref myDataSetRecords); // tbRecords = myDataSetRecords.Tables["CheckRecords"]; // } // string strDate = null; // strDate = rfidCheck_CheckOn.GetDateSubString(strCheckDate); // if (null!=strDate) // { // for (int i = 0; i < tbRecords.Rows.Count; i++) // { // string strDateTemp = rfidCheck_CheckOn.GetDateSubString(tbRecords.Rows[i]["Date"].ToString()); ; // if (null != strDateTemp && strDateTemp == strDate)// 保证获得的记录的时间和要求的时间一致 // { // string tempID = tbRecords.Rows[i]["id_no"].ToString(); // string tempDate=tbRecords.Rows[i]["Date"].ToString(); // CheckRecord cr = new CheckRecord(tempID, tempDate); // records.Add(cr); // } // } // } // */ // return records; //} public static bool CheckEPCUsed(string epc) { bool bR = false; try { if (InitialDB()) { int result = 0; object[] pars = new object[1] { epc }; DataTable dt = CsharpSQLiteHelper.ExecuteTable(SqlCheckEPCUsed, pars); if (dt.Rows.Count > 0) { bR = true; } //result = int.Parse(SQLiteHelper.ExecuteScalar(dbPath, SqlCheckEPCUsed, pars).ToString()); //if (result >= 1) //{ // bR = true; //} //else //{ // bR = false; //} } } catch (System.Exception ex) { MessageBox.Show("更新记录出现错误:" + ex.Message); } return(bR); }
public static DataTable GetStatisticCheckInfoDataSet(string startDate, string endDate , string nj, string bj) { DataSet ds = null; DataTable dt = null; if (null == startDate || null == endDate) { return(dt); } int paraCount = 2; string sql = SqlSelectCheckedPersonWithPara_head; if (null != nj) { paraCount++; sql += SqlSelectCheckedPersonWithPara_nj; } if (null != bj) { paraCount++; sql += SqlSelectCheckedPersonWithPara_bj; } sql += SqlSelectCheckedPersonWithPara_tail; Object[] paras = new Object[paraCount]; paras[0] = startDate; paras[1] = endDate; if (null != nj) { paras[2] = nj; } if (null != bj) { if (paras[2] == null) { paras[2] = bj; } else { paras[3] = bj; } } try { if (InitialDB()) { dt = CsharpSQLiteHelper.ExecuteTable(sql, paras); //ds = SQLiteHelper.ExecuteDataSet(dbPath, sql, paras); } } catch (System.Exception ex) { MessageBox.Show("读取学生数据库时出现错误!" + ex.Message); return(null); } return(dt); }
public DataTable DeleteRoomConfig(string name) { try { DataTable dt = CsharpSQLiteHelper.ExecuteTable(sql_delete_room_configs, new object[] { name }); return(dt); } catch (System.Exception ex) { MessageBox.Show("查询数据库时出现错误:" + ex.Message); } return(null); }
public static DataTable getAllRightAnswer(string question_id, string answer) { try { DataTable dt = CsharpSQLiteHelper.ExecuteTable(sql_select_right_answer, new object[] { question_id, answer }); return(dt); } catch (System.Exception ex) { MessageBox.Show("查询数据库时出现错误:" + ex.Message); } return(null); }
public DataTable getAllRoomConfigs() { try { DataTable dt = CsharpSQLiteHelper.ExecuteTable(sql_select_room_configs, null); return(dt); } catch (System.Exception ex) { MessageBox.Show("查询数据库时出现错误:" + ex.Message); } return(null); }
public static DataTable getAllStudentInfo() { try { DataTable dt = CsharpSQLiteHelper.ExecuteTable(sqlSelect_allGetStudentInfo, null); return(dt); } catch (System.Exception ex) { MessageBox.Show("查询数据库时出现错误:" + ex.Message); } return(null); }
public static DataTable getQuestion(string question_id) { try { DataTable dt = CsharpSQLiteHelper.ExecuteTable(sqlSelect_getQuestion, new object[] { question_id }); return(dt); } catch (System.Exception ex) { MessageBox.Show("查询数据库时出现错误:" + ex.Message); } return(null); }
public int GetGroupCount() { int count = 0; try { DataTable dt = CsharpSQLiteHelper.ExecuteTable(sqlSelect_allRoomConfig, null); count = dt.Rows.Count; } catch (System.Exception ex) { MessageBox.Show("查询数据库时出现错误:" + ex.Message); } return(count); }
public DataTable getStudentInfo(string id) { try { DataTable dt = CsharpSQLiteHelper.ExecuteTable(sqlSelect_GetSpecifiedStudentInfo, new object[1] { id }); return(dt); } catch (System.Exception ex) { MessageBox.Show("查询数据库时出现错误:" + ex.Message); } return(null); }
public static DataTable GetPersonDataTable() { DataTable myDataSetPerson = null; try { myDataSetPerson = CsharpSQLiteHelper.ExecuteTable(SqlSelectAllPerson, null); } catch (System.Exception ex) { MessageBox.Show("读取学生数据库时出现错误!" + ex.Message); return(null); } return(myDataSetPerson); }
public bool SetConfigsUsed(string config_name) { try { DataTable dt = CsharpSQLiteHelper.ExecuteTable( sql_update_room_configs, new object[] { "true", config_name }); if (dt.Rows.Count > 0) { return(true); } } catch (System.Exception ex) { MessageBox.Show("查询数据库时出现错误:" + ex.Message); } return(false); }
public bool AddConfigs(string config_name, int group, int row, int column) { try { DataTable dt = CsharpSQLiteHelper.ExecuteTable( sql_insert_room_configs, new object[] { config_name, group, row, column }); if (dt.Rows.Count > 0) { return(true); } } catch (System.Exception ex) { MessageBox.Show("查询数据库时出现错误:" + ex.Message); } return(false); }
public static bool ConfigExists(int group) { try { DataTable dt = CsharpSQLiteHelper.ExecuteTable(sqlSelect_SpecifiedRoomConfig, new object[1] { group }); if (dt.Rows.Count > 0) { return(true); } } catch (System.Exception ex) { MessageBox.Show("查询数据库时出现错误:" + ex.Message); } return(false); }
public bool CheckExists(int group, int row, int column) { try { DataTable dt = CsharpSQLiteHelper.ExecuteTable( sqlSelect_CheckConfigExist, new object[3] { group, row, column }); if (dt.Rows.Count > 0) { return(true); } } catch (System.Exception ex) { MessageBox.Show("查询数据库时出现错误:" + ex.Message); } return(false); }
public static bool question_record_exist(string question_id, string student_id) { try { DataTable dt = CsharpSQLiteHelper.ExecuteTable(sql_select_question_answer_info, new object[2] { question_id, student_id }); if (dt.Rows.Count > 0) { return(true); } } catch (System.Exception ex) { MessageBox.Show("查询数据库时出现错误:" + ex.Message); } return(false); }
public static bool CheckEPCUsed(string epc) { bool bR = false; try { object[] pars = new object[1] { epc }; DataTable dt = CsharpSQLiteHelper.ExecuteTable(SqlCheckEPCUsed, pars); if (dt.Rows.Count > 0) { bR = true; } } catch (System.Exception ex) { MessageBox.Show("更新记录出现错误:" + ex.Message); } return(bR); }
public static DataTable GetPersonDataSet() { DataTable myDataSetPerson = null; if (InitialDB()) { try { //if (!File.Exists(FilePersonName)) //{ // rfidCheck_CheckOn.InitialPersonDB(); //} myDataSetPerson = CsharpSQLiteHelper.ExecuteTable(SqlSelectAllPerson, null); } catch (System.Exception ex) { MessageBox.Show("读取学生数据库时出现错误!" + ex.Message); return(null); } } return(myDataSetPerson); }
public static DataTable getAllCheckRecord() { return(CsharpSQLiteHelper.ExecuteTable(sqlSelect_GetAllCheckInfo, null)); }
private void btnOk_Click(object sender, EventArgs e) { DateTime dtTime_start = this.dtpStart.Value; DateTime dtTime_end = this.dtpEnd.Value; if (DateTime.Compare(dtTime_end, dtTime_start) <= 0) { MessageBox.Show("时间段选择不正确!", "信息提示"); return; } string time_start = dtTime_start.ToString("yyyy-MM-dd HH:mm:ss"); string time_end = dtTime_end.ToString("yyyy-MM-dd HH:mm:ss"); string sqlSelect_check_record = "select record_id,create_time,info from check_record where create_time between '{0}' and '{1}'"; DataTable dtCheck_record = CsharpSQLiteHelper.ExecuteTable(sqlSelect_check_record, new object[2] { time_start, time_end }); int iStuden_count = 0; DataTable studentInfoTable = studentInfoCtl.getAllStudentInfo(); iStuden_count = studentInfoTable.Rows.Count; GraphPane myPane = this.zedGraphControl1.GraphPane; // Set the titles and axis labels myPane.Title.Text = "考勤率统计"; myPane.XAxis.Title.Text = "考勤时间"; myPane.YAxis.Title.Text = "出勤率"; // Make up some random data points double x, y; PointPairList list = new PointPairList(); if (dtCheck_record.Rows.Count > 0) { DataTable dt = new DataTable(); dt.Columns.Add("考勤时间"); dt.Columns.Add("出勤率(%)"); dt.Columns.Add("备注"); for (int i = 0; i < dtCheck_record.Rows.Count; i++) { string info = dtCheck_record.Rows[i]["info"].ToString(); string strCreate_time = dtCheck_record.Rows[i]["create_time"].ToString(); DateTime dtCreate_time = DateTime.Parse(strCreate_time); string record_id = dtCheck_record.Rows[i]["record_id"].ToString(); string sqlSelect_student_check_record = "select student_id from T_STUDENT_CHECK_INFO where record_id = '{0}'"; DataTable dtStudent_check_record = CsharpSQLiteHelper.ExecuteTable(sqlSelect_student_check_record, new object[1] { record_id }); int iChecked_count = dtStudent_check_record.Rows.Count; int check_percent = iChecked_count * 100 / iStuden_count; x = (double)new XDate(dtCreate_time); y = check_percent; list.Add(x, y); dt.Rows.Add(new object[3] { strCreate_time, check_percent.ToString(), info }); } // Generate a red curve with diamond // symbols, and "My Curve" in the legend myPane.RemoveAllCurve(); CurveItem myCurve = myPane.AddCurve("考勤率曲线", list, Color.Red, SymbolType.Diamond); // Set the XAxis to date type myPane.XAxis.Type = AxisType.Date; // Tell ZedGraph to refigure the axes since the data // have changed this.zedGraphControl1.AxisChange(); this.zedGraphControl1.Refresh(); this.dataGridView1.Columns.Clear(); this.dataGridView1.DataSource = dt; this.dataGridView1.Columns[0].Width = 150; this.dataGridView1.Columns[1].Width = 120; this.dataGridView1.Columns[2].Width = 400; Debug.WriteLine("zde"); } else { MessageBox.Show("该段时间内没有考勤记录!", "信息提示"); } }