public void Initialize() { tran = new TransactionScope(); parkSqlDAL = new ParkSqlDAL(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 SurveyController(ISurveySqlDAL dal, IParkSqlDAL parkDal) { this.dal = dal; this.parkDal = parkDal; }
public ParkController(IParkSqlDAL parkSqlDAL, IWeatherSqlDAL weatherSqlDAL) { this.parkSqlDAL = parkSqlDAL; this.weatherSqlDAL = weatherSqlDAL; }
public SurveyController(ISurveySqlDAL surveySqlDAL, IParkSqlDAL parkSqlDAL) { this.surveySqlDAL = surveySqlDAL; this.parkSqlDAL = parkSqlDAL; }
public ParkController() { parkDAL = new ParkSQLDAL(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; }