Esempio n. 1
0
        public List <Searchinfo> getAllSearchInfo()
        {
            MySqlConnection conn   = connect();
            MySqlCommand    cmd    = new MySqlCommand("select * from search where deleted =  " + 0, conn);
            MySqlDataReader reader = null;


            try
            {
                if (conn.State == ConnectionState.Closed)
                {
                    conn.Open();
                }
                reader = cmd.ExecuteReader();
                List <Searchinfo> temp = new List <Searchinfo>();

                while (reader.Read())
                {
                    String inc = reader["include"] as String;
                    String exc = reader["exclude"] as String;

                    List <String> includeL = new List <string>();
                    List <String> excludeL = new List <string>();
                    if (inc != null)
                    {
                        includeL = inc.Split('\n').ToList();
                    }
                    if (exc != null)
                    {
                        excludeL = exc.Split('\n').ToList();
                    }
                    Searchinfo dd = new Searchinfo((int)reader["searchId"], (String)reader["searchTitle"], (bool)reader["deleted"], (int)reader["searchStatus"], includeL, excludeL, (DateTime)(reader["startDate"] as DateTime?), reader["endDate"] as DateTime?, reader["firstTwitterDate"] as DateTime?, reader["tempLastTwitterDate"] as DateTime?, (long)reader["tempLastTwitterId"], reader["finishedLastTwitterDate"] as DateTime?, (long)reader["finishedLastTwitterId"]);
                    temp.Add(dd);
                }
                return(temp);
            }
            catch (Exception ex)
            {
                if (config.debug)
                {
                    throw ex;
                }
                else
                {
                    throw ex;
                }
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                }
                conn.Close();
            }
        }
Esempio n. 2
0
 public TwitterSearch(Searchinfo si) // for resume
 {
     this.dataBase   = new MysqlHelper();
     this.searchInfo = si;
     onResume();
 }