예제 #1
0
        //requete rowset
        public void requestSqlRowset(String request, NpgsqlConnection conn)
        {
            // Define a query
            NpgsqlCommand command = new NpgsqlCommand(request, conn);
            // Execute the query and obtain a result set
            NpgsqlDataReader dr = command.ExecuteReader();

            // liste des tweets
            while (dr.Read())
            {
                Tweet temp = new Tweet();
                temp.setTweetText((String)dr[1]);
                temp.setSentiment((int)dr[2]);
                temp.setTweetDate((DateTime)dr[3]);
                temp.setTweetType((String)dr[4]);
                tweetRowset.Add(temp);
            }
        }
        //methodes
        public int checkDateTweet(Tweet tw, List<TweetCountDate> listCountDate)
        {
            int rt = 0;
            //boucle sur la liste pour checker si date existe deja ou pas
            if (listCountDate.Count > 0)
            {
                foreach (TweetCountDate dateCount in listCountDate)
                {
                    DateTime twDate = tw.getTweetDate();
                    DateTime datCountDate = dateCount.getTweetCountDateDate();

                    //check
                    if (twDate == datCountDate)
                    {
                        rt = 1;
                    }
                }
            }

            return rt;
        }