Exemplo n.º 1
0
        public IEnumerable <Models.QuoteModel> GetQuotes()
        {
            IList <Models.QuoteModel> quotes = new List <Models.QuoteModel>();

            dbConnection.Open();
            IDbCommand cmd = dbConnection.CreateCommand();

            cmd.CommandText = @"SELECT Id, PostTime, PostText FROM Quote";
            IDataReader reader = cmd.ExecuteReader();

            while (reader.Read())
            {
                Models.QuoteModel quote = new Models.QuoteModel();
                quote.Id            = (int)reader.GetValue(0);
                quote.DateSubmitted = (DateTime)reader.GetValue(1);
                quote.Quote         = (string)reader.GetValue(2);
                quote.Quote         = REPLACETHEMOTHERFUCKERS(quote.Quote);
                quotes.Add(quote);
            }

            reader.Close();
            dbConnection.Close();

            return(quotes);
        }
Exemplo n.º 2
0
        public Models.QuoteModel GetQuote(int id)
        {
            Models.QuoteModel quote = new Models.QuoteModel();

            dbConnection.Open();
            IDbCommand cmd = dbConnection.CreateCommand();
            cmd.CommandText = @"SELECT Id, PostTime, PostText FROM Quote WHERE Id = " + id;
            IDataReader reader = cmd.ExecuteReader(CommandBehavior.SingleRow);

            reader.Read();

            quote.Id = id;
            quote.DateSubmitted = (DateTime)reader.GetValue(1);
            string str = (string)reader.GetValue(2);
            str = REPLACETHEMOTHERFUCKERS(str);
            quote.Quote = str;
            reader.Close();
            dbConnection.Close();

            return quote;
        }
Exemplo n.º 3
0
        public Models.QuoteModel GetQuote(int id)
        {
            Models.QuoteModel quote = new Models.QuoteModel();

            dbConnection.Open();
            IDbCommand cmd = dbConnection.CreateCommand();

            cmd.CommandText = @"SELECT Id, PostTime, PostText FROM Quote WHERE Id = " + id;
            IDataReader reader = cmd.ExecuteReader(CommandBehavior.SingleRow);

            reader.Read();

            quote.Id            = id;
            quote.DateSubmitted = (DateTime)reader.GetValue(1);
            string str = (string)reader.GetValue(2);

            str         = REPLACETHEMOTHERFUCKERS(str);
            quote.Quote = str;
            reader.Close();
            dbConnection.Close();

            return(quote);
        }
Exemplo n.º 4
0
        public IEnumerable<Models.QuoteModel> GetQuotes()
        {
            IList<Models.QuoteModel> quotes = new List<Models.QuoteModel>();

            dbConnection.Open();
            IDbCommand cmd = dbConnection.CreateCommand();
            cmd.CommandText = @"SELECT Id, PostTime, PostText FROM Quote";
            IDataReader reader = cmd.ExecuteReader();

            while (reader.Read())
            {
                Models.QuoteModel quote = new Models.QuoteModel();
                quote.Id = (int)reader.GetValue(0);
                quote.DateSubmitted = (DateTime)reader.GetValue(1);
                quote.Quote = (string)reader.GetValue(2);
                quote.Quote = REPLACETHEMOTHERFUCKERS(quote.Quote);
                quotes.Add(quote);
            }

            reader.Close();
            dbConnection.Close();

            return quotes;
        }