public string SqlStatement()
        {
            string result = DatabaseChangesLast90Days.SqlStatement();

            return(result);
            // TODO: add assertions to method DatabaseChangesLast90DaysTest.SqlStatement()
        }
Beispiel #2
0
        /// <summary>
        /// Gets the database changes in the last 90 days.
        /// </summary>
        /// <param name="database">The database.</param>
        /// <returns>the database changes in the last 90 days</returns>
        public List <DatabaseChangesLast90Days> GetDatabaseChangesLast90Days(string database)
        {
            this.ExecuteUseDatabase(database);

            List <DatabaseChangesLast90Days> results = new List <DatabaseChangesLast90Days>();
            DatabaseChangesLast90Days        resultrow;
            string sqlString = DatabaseChangesLast90Days.SqlStatement();

            sqlString = string.Format("EXEC sp_executesql @statement = N'{0}'", sqlString.Replace("'", "''"));

            using (SqlConnection connection = new SqlConnection(this.ConnectionString))
                using (SqlCommand command = new SqlCommand(sqlString, connection))
                {
                    connection.Open();
                    using (SqlDataReader reader = command.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            resultrow = new DatabaseChangesLast90Days(
                                reader.GetString(reader.GetOrdinal("Object")),
                                reader.GetString(reader.GetOrdinal("Type")),
                                reader.GetString(reader.GetOrdinal("Action")),
                                reader.GetDateTime(reader.GetOrdinal("Created")),
                                reader.GetDateTime(reader.GetOrdinal("Modified")));

                            results.Add(resultrow);
                        }
                    }

                    connection.Close();
                }

            return(results);
        }
        public DatabaseChangesLast90Days Constructor(
            string obectjName,
            string type,
            string action,
            DateTime created,
            DateTime modified
            )
        {
            DatabaseChangesLast90Days target
                = new DatabaseChangesLast90Days(obectjName, type, action, created, modified);

            return(target);
            // TODO: add assertions to method DatabaseChangesLast90DaysTest.Constructor(String, String, String, DateTime, DateTime)
        }