public bool AddClassCheckInfo(string time, string name, string percentage)
 {
     try
     {
         int result = int.Parse(CsharpSQLiteHelper.ExecuteNonQuery(
                                    sqlInsert_AddClassCheckInfo
                                    , new object[3]
         {
             time
             , name
             , percentage
         }).ToString());
         //int result = int.Parse(SQLiteHelper.ExecuteNonQuery(SQLiteHelper.connectString,
         //                             sqlInsert_AddClassCheckInfo
         //                             , new object[3]
         //                                    {
         //                                        time
         //                                        ,name
         //                                        ,percentage
         //                                    }).ToString());
         if (result > 0)
         {
             return(true);
         }
     }
     catch (System.Exception ex)
     {
         MessageBox.Show("添加数据时出现错误:" + ex.Message);
     }
     return(false);
 }
예제 #2
0
        public bool DeleteNotExistedGroup(List <int> groups)
        {
            string str_not_in = string.Empty;

            for (int i = 0; i < groups.Count; i++)
            {
                if (str_not_in == string.Empty)
                {
                    str_not_in = groups[i].ToString();
                }
                else
                {
                    str_not_in = str_not_in + "," + groups[i].ToString();
                }
            }

            try
            {
                int result = int.Parse(CsharpSQLiteHelper.ExecuteNonQuery(
                                           sqlDelete_allNotExistedGroups
                                           , new object[1]
                {
                    str_not_in
                }).ToString());
                if (result > 0)
                {
                    return(true);
                }
            }
            catch (System.Exception ex)
            {
                MessageBox.Show("更新数据时出现错误:" + ex.Message);
            }
            return(false);
        }
        /// <summary>
        /// 将学号和epc相关联
        /// </summary>
        /// <param name="xh"></param>
        /// <param name="epc"></param>
        /// <returns></returns>
        public static bool BindPersonEPC(string xh, string epc)
        {
            bool bR = false;

            try
            {
                int      result = 0;
                object[] pars   = new object[2] {
                    xh, epc
                };
                result = int.Parse(CsharpSQLiteHelper.ExecuteNonQuery(SqlBindPerson2EPC, pars).ToString());
                if (result >= 1)
                {
                    bR = true;
                }
                else
                {
                    bR = false;
                }
            }
            catch (System.Exception ex)
            {
                MessageBox.Show("更新记录出现错误:" + ex.Message);
            }
            return(bR);
        }
 public static bool AddQuestion(string question_id, string caption, string answer, string question_index)
 {
     try
     {
         int result = int.Parse(CsharpSQLiteHelper.ExecuteNonQuery(
                                    sqlInsert_addQuestion
                                    , new object[4]
         {
             question_id
             , caption
             , answer
             , question_index
         }).ToString());
         //int result = int.Parse(SQLiteHelper.ExecuteNonQuery(SQLiteHelper.connectString,
         //                             sqlInsert_addQuestion
         //                             , new object[4]
         //                                    {
         //                                        question_id
         //                                        ,caption
         //                                        ,answer
         //                                        ,question_index
         //                                    }).ToString());
         if (result > 0)
         {
             return(true);
         }
     }
     catch (System.Exception ex)
     {
         MessageBox.Show("更新数据时出现错误:" + ex.Message);
     }
     return(false);
 }
 public bool AddMapConfig(string equipID, int group, int row, int column)
 {
     try
     {
         int result = int.Parse(CsharpSQLiteHelper.ExecuteNonQuery(
                                    sqlInsert_SaveConfig
                                    , new object[4]
         {
             equipID
             , group
             , row
             , column
         }).ToString());
         //int result = int.Parse(SQLiteHelper.ExecuteNonQuery(SQLiteHelper.connectString,
         //                             sqlInsert_SaveConfig
         //                             , new object[4]
         //                                    {
         //                                        equipID
         //                                        ,group
         //                                        ,row
         //                                        ,column
         //                                    }).ToString());
         if (result > 0)
         {
             return(true);
         }
     }
     catch (System.Exception ex)
     {
         MessageBox.Show("添加数据时出现错误:" + ex.Message);
     }
     return(false);
 }
        public static bool add_question_record(string question_id, string student_id, string answer)
        {
            string sql = sql_Insert_question_answer_info;

            try
            {
                int result = 0;
                result = CsharpSQLiteHelper.ExecuteNonQuery(
                    sql
                    , new object[3]
                {
                    question_id
                    , student_id
                    , answer
                });

                if (result > 0)
                {
                    return(true);
                }
            }
            catch (System.Exception ex)
            {
                MessageBox.Show("更新数据时出现错误:" + ex.Message);
            }
            return(false);
        }
        public static bool deleteQuestion(string question_id)
        {
            string sql = sqlDelete_delete_specified_question;

            try
            {
                int result = 0;
                result = int.Parse(CsharpSQLiteHelper.ExecuteNonQuery(
                                       sql
                                       , new object[1]
                {
                    question_id
                }).ToString());
                //result = int.Parse(SQLiteHelper.ExecuteNonQuery(SQLiteHelper.connectString,
                //                            sql
                //                            , new object[1]
                //                                    {
                //                                       question_id
                //                                    }).ToString());

                if (result > 0)
                {
                    return(true);
                }
            }
            catch (System.Exception ex)
            {
                MessageBox.Show("更新数据时出现错误:" + ex.Message);
            }
            return(false);
        }
        public static bool insert_record(string id, string info, string create_time)
        {
            bool bR = false;

            try
            {
                int      result = 0;
                object[] pars   = new object[]
                {
                    id, info, create_time
                };

                result = int.Parse(CsharpSQLiteHelper.ExecuteNonQuery(sql_insert_record, pars).ToString());
                if (result >= 1)
                {
                    bR = true;
                }
                else
                {
                    bR = false;
                }
            }
            catch
            {
                //MessageBox.Show("出现错误:" + ex.Message);
            }
            return(bR);
        }
예제 #9
0
        public static bool PersonAdd(Person p)
        {
            bool bR = false;

            try
            {
                if (InitialDB())
                {
                    int      result = 0;
                    object[] pars   = new object[7];
                    pars[0] = p.id_num;
                    pars[1] = p.name;
                    pars[2] = p.sex;
                    pars[3] = p.age;
                    pars[4] = p.bj;
                    pars[5] = p.email;
                    pars[6] = p.deviceID;

                    result = int.Parse(CsharpSQLiteHelper.ExecuteNonQuery(SqlInsertPerson, pars).ToString());
                    if (result >= 1)
                    {
                        bR = true;
                    }
                    else
                    {
                        bR = false;
                    }
                }

                /*
                 * DataSet myDataSet = GetPersonDataSet();
                 * DataTable dt = myDataSet.Tables["student"];
                 * if (dt == null)
                 * {
                 *  rfidCheck_CheckOn.AddStudentTableToPersonDS(ref myDataSet);
                 *  dt = myDataSet.Tables["student"];
                 * }
                 * if (null != dt)
                 * {
                 *  DataRow myRow = dt.NewRow();
                 *  myRow["id_no"] = p.id_num;
                 *  myRow["name"] = p.name;
                 *  myRow["tel"] = p.telephone;
                 *  myRow["mail"] = p.email;
                 *  dt.Rows.Add(myRow);
                 *  myDataSet.WriteXml(FilePersonName);
                 *  bR = true;
                 * }
                 */
            }
            catch (System.Exception ex)
            {
                MessageBox.Show("添加新记录出现错误:" + ex.Message);
            }
            return(bR);
        }
예제 #10
0
        public static bool PersonDelete(Person p)
        {
            bool bR = false;

            try
            {
                if (InitialDB())
                {
                    int      result = 0;
                    object[] pars   = new object[1]
                    {
                        p.id_num
                    };

                    result = int.Parse(CsharpSQLiteHelper.ExecuteNonQuery(SqlDeletePerson, pars).ToString());
                    if (result >= 1)
                    {
                        bR = true;
                    }
                    else
                    {
                        bR = false;
                    }
                }

                /*
                 *
                 * DataSet myDataSet = GetPersonDataSet();
                 * DataTable dt = myDataSet.Tables["student"];
                 * if (dt == null)
                 * {
                 *  rfidCheck_CheckOn.AddStudentTableToPersonDS(ref myDataSet);
                 *  dt = myDataSet.Tables["student"];
                 * }
                 * if (null != dt)
                 * {
                 *  for (int i = 0; i < dt.Rows.Count; i++)
                 *  {
                 *      if (dt.Rows[i]["id_no"].ToString() == p.id_num)
                 *      {
                 *          dt.Rows[i].Delete();
                 *          myDataSet.WriteXml(FilePersonName);
                 *          bR = true;
                 *          break;
                 *      }
                 *  }
                 * }
                 *
                 */
            }
            catch (System.Exception ex)
            {
                MessageBox.Show("删除记录出现错误:" + ex.Message);
            }
            return(bR);
        }
 public static void clearStudentInfo()
 {
     try
     {
         CsharpSQLiteHelper.ExecuteNonQuery(sqlDelete_clearStudentInfo, null);
         CsharpSQLiteHelper.ExecuteNonQuery(sqlDelete_clearStudentEpcLink, null);
     }
     catch (System.Exception ex)
     {
         MessageBox.Show("更新数据时出现错误:" + ex.Message);
     }
 }
        public static bool AddCheckInfo(string record_id, string STUDENTID, string CHECK_TIME)
        {
            bool bR     = true;
            int  result = CsharpSQLiteHelper.ExecuteNonQuery(sqlInsert_AddCheckInfo, new object[3] {
                record_id, STUDENTID, CHECK_TIME
            });

            if (result <= 0)
            {
                bR = false;
            }
            return(bR);
        }
 public static bool clearRoomConfigOfDB()
 {
     try
     {
         int result = (int)CsharpSQLiteHelper.ExecuteNonQuery(sql_delete, null);
         if (result > 0)
         {
             return(true);
         }
     }
     catch (System.Exception ex)
     {
         MessageBox.Show("更新数据时出现错误:" + ex.Message);
     }
     return(false);
 }
예제 #14
0
        /// <summary>
        /// 更新配置信息
        /// </summary>
        /// <param name="group"></param>
        /// <param name="value"></param>
        /// <param name="type">0,row   1 column</param>
        /// <returns></returns>
        public bool updateRoomConfig(int group, int value, int type)
        {
            string sql = null;

            switch (type)
            {
            case 0:
                sql = sqlUpdate_updateRoomConfigRow;
                break;

            case 1:
                sql = sqlUpdate_updateRoomConfigColumn;
                break;
            }
            if (null == sql)
            {
                return(false);
            }
            try
            {
                int result = int.Parse(CsharpSQLiteHelper.ExecuteNonQuery(
                                           sql
                                           , new object[2]
                {
                    value
                    , group
                }).ToString());
                //int result = int.Parse(SQLiteHelper.ExecuteNonQuery(SQLiteHelper.connectString,
                //                             sql
                //                             , new object[2]
                //                                    {
                //                                        value
                //                                        ,group
                //                                    }).ToString());
                if (result > 0)
                {
                    return(true);
                }
            }
            catch (System.Exception ex)
            {
                MessageBox.Show("更新数据时出现错误:" + ex.Message);
            }
            return(false);
        }
예제 #15
0
 public bool DeleteAllConfig()
 {
     try
     {
         int result = int.Parse(CsharpSQLiteHelper.ExecuteNonQuery(
                                    sql_delete_all_config
                                    , null).ToString());
         if (result > 0)
         {
             return(true);
         }
     }
     catch (System.Exception ex)
     {
         MessageBox.Show("更新数据时出现错误:" + ex.Message);
     }
     return(false);
 }
예제 #16
0
        //public int getClassroomConfig(int type)
        //{
        //    string sql = null;
        //    switch (type)
        //    {
        //        case 0:
        //            sql = sqlSelect_GetConfigGroupNumber;
        //            break;
        //        case 1:
        //            sql = sqlSelect_GetConfigRowNumber;
        //            break;
        //        case 2:
        //            sql = sqlSelect_GetConfigColumnNumber;
        //            break;
        //    }
        //    if (null == sql)
        //    {
        //        return 0;
        //    }
        //    try
        //    {
        //        DataTable dt = CsharpSQLiteHelper.ExecuteTable(sql, null);
        //        if (dt.Rows.Count > 0)
        //        {
        //            DataRow dr = dt.Rows[0];
        //            return int.Parse(dr["VVALUE"].ToString());
        //        }
        //    }
        //    catch (System.Exception ex)
        //    {
        //        MessageBox.Show("查询数据库时出现错误:" + ex.Message);
        //    }
        //    return 0;
        //}

        /// <summary>
        /// 更新教师的座位配置
        /// </summary>
        /// <param name="number">数目</param>
        /// <param name="type">类型 0 group   1 row  2 column</param>
        /// <returns></returns>
        //public bool updateClassRoomConfig(int number, int type)
        //{
        //    string sql = null;
        //    switch (type)
        //    {
        //        case 0:
        //            sql = sqlUpdate_UpdateGroupNumber;
        //            break;
        //        case 1:
        //            sql = sqlUpdate_UpdaterowNumber;
        //            break;
        //        case 2:
        //            sql = sqlUpdate_UpdatecolumnNumber;
        //            break;
        //    }
        //    if (null == sql)
        //    {
        //        return false;
        //    }
        //    try
        //    {
        //        int result = int.Parse(CsharpSQLiteHelper.ExecuteNonQuery(sql, new object[1] { number }).ToString());
        //        if (result > 0)
        //        {
        //            return true;
        //        }
        //    }
        //    catch (System.Exception ex)
        //    {

        //        MessageBox.Show("更新数据时出现错误:" + ex.Message);
        //    }
        //    return false;
        //}

        public bool updateMapConfig(string equipID, int group, int row, int column)
        {
            try
            {
                int result = int.Parse(CsharpSQLiteHelper.ExecuteNonQuery(sqlUpdate_UpdateConfig
                                                                          , new object[4] {
                    equipID, group, row, column
                }).ToString());

                if (result > 0)
                {
                    return(true);
                }
            }
            catch (System.Exception ex)
            {
                MessageBox.Show("更新数据时出现错误:" + ex.Message);
            }
            return(false);
        }
 public static bool AddNewConfig(int group, int row, int column)
 {
     try
     {
         int result = int.Parse(CsharpSQLiteHelper.ExecuteNonQuery(
                                    sqlInsert_addConfig
                                    , new object[3] {
             group, row, column
         }).ToString());
         if (result > 0)
         {
             return(true);
         }
     }
     catch (System.Exception ex)
     {
         MessageBox.Show("更新数据时出现错误:" + ex.Message);
     }
     return(false);
 }
 public static bool addStudentInfo(string id, string name, string sex, int age, string class_name, string email, string epc)
 {
     try
     {
         int result1 = CsharpSQLiteHelper.ExecuteNonQuery(
             sqlInsert_addStudent
             , new object[] { id, name, sex, age, class_name, email });
         int result2 = CsharpSQLiteHelper.ExecuteNonQuery(
             sqlInsert_addStudentEpcLink
             , new object[] { id, epc });
         if (result1 > 0 && result2 > 0)
         {
             return(true);
         }
     }
     catch (System.Exception ex)
     {
         MessageBox.Show("添加数据时出现错误:" + ex.Message);
     }
     return(false);
 }
        public static bool updateQuestion(string question_id, string caption, string answer, string question_index)
        {
            string sql = sqlUpdate_updateQuestion;

            try
            {
                int result = 0;
                result = int.Parse(CsharpSQLiteHelper.ExecuteNonQuery(
                                       sql
                                       , new object[4]
                {
                    caption
                    , answer
                    , question_index
                    , question_id
                }).ToString());
                //result = int.Parse(SQLiteHelper.ExecuteNonQuery(SQLiteHelper.connectString,
                //                            sql
                //                            , new object[4]
                //                                    {
                //                                        caption
                //                                        ,answer
                //                                        ,question_index
                //                                        ,question_id
                //                                    }).ToString());

                if (result > 0)
                {
                    return(true);
                }
            }
            catch (System.Exception ex)
            {
                MessageBox.Show("更新数据时出现错误:" + ex.Message);
            }
            return(false);
        }
        public bool AddCheckInfo(List <CheckInfo> paraList)
        {
            bool bR = true;

            // List<CheckInfo>< object[]> ls = new List<CheckInfo><object[]>();
            //Hashtable SQLStringList = new Hashtable();
            foreach (CheckInfo ci in paraList)
            {
                //SQLStringList.Add(new object[4] { ci.STUDENTID, ci.CHECK_TIME, ci.SUBJECT_NAME, ci.STATUS }, sqlInsert_AddCheckInfo);

                int result = CsharpSQLiteHelper.ExecuteNonQuery(sqlInsert_AddCheckInfo, new object[3] {
                    ci.record_id, ci.STUDENTID, ci.CHECK_TIME
                });
                if (result <= 0)
                {
                    bR = false;
                }
                //SQLStringList.Add(sqlInsert_AddCheckInfo, new object[3] { ci.STUDENTID, ci.CHECK_TIME, ci.SUBJECT_NAME });
            }
            return(bR);
            //return SQLiteHelper.ExecuteSqlTran(
            //                        SQLiteHelper.connectString,
            //                        SQLStringList);
        }