public void Initialize() { tran = new TransactionScope(); weatherSqlDAL = new WeatherSqlDAL(connectionString); using (SqlConnection connection = new SqlConnection(connectionString)) { connection.Open(); SqlCommand cmd; //make a test park cmd = new SqlCommand( "INSERT INTO park (parkCode, parkName, state, acreage, elevationInFeet, milesOfTrail, numberOfCampsites, " + "climate, yearFounded, annualVisitorCount, inspirationalQuote, inspirationalQuoteSource, " + "parkDescription, entryFee, numberOfAnimalSpecies) VALUES ('TEST', 'test park', 'TT', 1000, 1000, 1, 3, " + "'hot', 1985, 2, 'so wow', 'doge', 'very big park', 3, 10);", connection); cmd.ExecuteNonQuery(); //make 5 test weathers for (int i = 1; i <= 5; i++) { cmd = new SqlCommand( $"INSERT INTO weather (parkCode, fiveDayForecastValue, low, high, forecast) VALUES ('TEST', ${i}, 0, 32, 'cloudy');", connection); cmd.ExecuteNonQuery(); } //make a test vote cmd = new SqlCommand( "INSERT INTO survey_result (parkCode, emailAddress, state, activityLevel) " + "VALUES ('TEST', '*****@*****.**', 'TT', 'sedentary');", connection); cmd.ExecuteNonQuery(); } }
public ParkController(IParkSqlDAL parkSqlDAL, IWeatherSqlDAL weatherSqlDAL) { this.parkSqlDAL = parkSqlDAL; this.weatherSqlDAL = weatherSqlDAL; }
public WeatherController(IWeatherSqlDAL dal) { this.dal = dal; }
public WeatherController() { weatherDAL = new WeatherSQLDAL(ConfigurationManager.ConnectionStrings["NPGeekConnectionString"].ConnectionString); }
// create with DALs for convenience public HomeController(IParkSqlDAL dal, IWeatherSqlDAL weatherDal) { this.dal = dal; this.weatherDal = weatherDal; }
public HomeController(IParkSqlDAL parkDAL, ISurvey_ResultSqlDAL survey_ResultDAL, IWeatherSqlDAL weatherDAL) { this.parkDAL = parkDAL; this.survey_ResultDAL = survey_ResultDAL; this.weatherDAL = weatherDAL; }