예제 #1
0
        public List <SampleModel> GetSample(SampleModel condition, int pageSize, int pageIndex)
        {
            try
            {
                StringBuilder sbCondition = GetConditionString(condition);
                int           startindex  = (pageIndex - 1) * pageSize;
                string        searchSql   = string.Format(Select_SampleByConditionPage, sbCondition.ToString(), pageSize, startindex);



                sr = Sqlite.ExecuteReader(searchSql);
                List <SampleModel> SampleList = new List <SampleModel>();
                while (sr.Read())
                {
                    SampleList.Add(getSampleInner(sr));
                }
                return(SampleList);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                sr.Close();
            }
        }
예제 #2
0
        public List <AgentIPModel> GetAgentIPByOldDate(DateTime lastUp)
        {
            try
            {
                string condtion = string.Format("  [LastCheckData] <= '{0}' ", lastUp);

                string searchSql = string.Format(Select_AgentIPByCondition, condtion);

                sr = Sqlite.ExecuteReader(searchSql);
                List <AgentIPModel> AgentIPList = new List <AgentIPModel>();
                while (sr.Read())
                {
                    AgentIPList.Add(getAgentIPInner(sr));
                }
                return(AgentIPList);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                sr.Close();
            }
        }
예제 #3
0
        public RunningNumberObj select(int id)
        {
            string txtQuery = string.Format("SELECT * FROM {0} WHERE id = {1}", this.tableName, id);

            try
            {
                RunningNumberObj data = new RunningNumberObj();
                //SQLiteDataReader dr = sqlite.ExecuteReader(txtQuery);
                using (SQLiteDataReader dr = sqlite.ExecuteReader(txtQuery))
                {
                    if (dr.Read())
                    {
                        data.id     = Convert.ToInt32(dr["id"]);
                        data.prefix = dr["prefix"].ToString();
                        data.number = dr["number"].ToString();
                    }
                }
                sqlite.Close();
                return(data);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #4
0
        /// <summary>
        /// get event by condition
        /// </summary>
        /// <param name="condition"></param>
        /// <returns></returns>
        public List <SecuriteSiteModel> GetSecuriteSite(SecuriteSiteModel condition)
        {
            try
            {
                StringBuilder sbCondition = GetConditionString(condition);

                string searchSql = string.Format(Select_SecuriteSiteByCondition, sbCondition.ToString());

                sr = Sqlite.ExecuteReader(searchSql);
                List <SecuriteSiteModel> SecuriteSiteList = new List <SecuriteSiteModel>();
                while (sr.Read())
                {
                    SecuriteSiteList.Add(getSecuriteSiteInner(sr));
                }
                return(SecuriteSiteList);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                sr.Close();
            }
        }
예제 #5
0
        /// <summary>
        /// get event by condition
        /// </summary>
        /// <param name="condition"></param>
        /// <returns></returns>
        public List <AgentIPModel> GetAgentIP(AgentIPModel condition)
        {
            try
            {
                StringBuilder sbCondition = GetConditionString(condition);

                string searchSql = string.Format(Select_AgentIPByCondition, sbCondition.ToString());

                sr = Sqlite.ExecuteReader(searchSql);
                List <AgentIPModel> AgentIPList = new List <AgentIPModel>();
                while (sr.Read())
                {
                    AgentIPList.Add(getAgentIPInner(sr));
                }
                return(AgentIPList);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                sr.Close();
            }
        }
예제 #6
0
        public SQLiteDataReader drList()
        {
            string txtQuery = string.Format("SELECT * FROM {0}", this.tableName);

            try
            {
                return(sqlite.ExecuteReader(txtQuery));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #7
0
 /// <summary>
 /// get all event
 /// </summary>
 /// <returns></returns>
 public List <SampleModel> GetAllSample()
 {
     try
     {
         sr = Sqlite.ExecuteReader(Select_AllSample);
         List <SampleModel> list = new List <SampleModel>();
         while (sr.Read())
         {
             list.Add(getSampleInner(sr));
         }
         return(list);
     }
     catch (Exception ex)
     {
         throw ex;
     }
     finally
     {
         sr.Close();
     }
 }