コード例 #1
0
        public bool IsFriendly()
        {
            // the competition
            if (TweetText.Contains("onmilwaukee", StringComparison.OrdinalIgnoreCase) ||
                TweetText.Contains("shepherd express", StringComparison.OrdinalIgnoreCase) ||
                TweetText.Contains("expressmilwaukee.com", StringComparison.OrdinalIgnoreCase))
            {
                return(false);
            }

            // unwanted language
            if (TweetText.Contains("f**k", StringComparison.OrdinalIgnoreCase) ||
                TweetText.Contains("shit", StringComparison.OrdinalIgnoreCase) ||
                TweetText.Contains("c**t", StringComparison.OrdinalIgnoreCase))
            {
                return(false);
            }

            if (ScreenName.Contains("onmilwaukee", StringComparison.OrdinalIgnoreCase))
            {
                return(false);
            }

            return(true);
        }
        public override void Awake(NSObject context)
        {
            base.Awake(context);

            var id = ((NSNumber)context).NIntValue;

            var tweet = InterfaceController.Tweets [(int)id];

            TweetText.SetText(tweet.Text);
            TweetDate.SetText(tweet.Date);
        }
コード例 #3
0
        public static List <TweetText> GetTweets(string targetSQLConnectionString)
        {
            logger.Info("GetTweets start");

            List <TweetText> tweets = new List <TweetText>();

            SqlConnection connection = new SqlConnection(targetSQLConnectionString);
            SqlCommand    command    = new SqlCommand("[Internal].[sp_GetTweets]", connection);

            command.CommandType = System.Data.CommandType.StoredProcedure;

            try
            {
                connection.Open();
            }
            catch (Exception exc)
            {
                logger.Error(exc);
            }

            if (connection.State == ConnectionState.Open)
            {
                try
                {
                    SqlDataReader reader = command.ExecuteReader();

                    while (reader.Read())
                    {
                        TweetText test = new TweetText();
                        test.ID   = int.Parse(reader["TweetID"].ToString());
                        test.Text = reader["TweetText"].ToString();
                        tweets.Add(test);
                    }
                }
                catch (Exception exc)
                {
                    logger.Error(exc);
                }
            }

            logger.Info("GetTweets done");

            return(tweets);
        }
コード例 #4
0
        public static List <TweetText> GetTweets(string targetSQLConnectionString, string language)
        {
            logger.Info("GetTweets for language " + language + " start");

            List <TweetText> tweets = new List <TweetText>();

            SqlConnection connection = new SqlConnection(targetSQLConnectionString);
            SqlCommand    command    = new SqlCommand("Internal.sp_GetTweetsByLanguage", connection);

            command.CommandType = System.Data.CommandType.StoredProcedure;
            command.Parameters.Add("@Language", SqlDbType.VarChar, 500).Value = language;

            try
            {
                connection.Open();
            }
            catch (Exception exc)
            {
                logger.Error(exc);
            }

            if (connection.State == ConnectionState.Open)
            {
                SqlDataReader reader = command.ExecuteReader();

                while (reader.Read())
                {
                    TweetText test = new TweetText();
                    test.ID   = int.Parse(reader["TweetID"].ToString());
                    test.Text = reader["TweetText"].ToString();
                    tweets.Add(test);
                }
            }

            logger.Info("GetTweets for language " + language + " end");

            return(tweets);
        }