예제 #1
0
        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();
            }
        }
예제 #2
0
 public ParkController(IParkSqlDAL parkSqlDAL, IWeatherSqlDAL weatherSqlDAL)
 {
     this.parkSqlDAL    = parkSqlDAL;
     this.weatherSqlDAL = weatherSqlDAL;
 }
예제 #3
0
 public WeatherController(IWeatherSqlDAL dal)
 {
     this.dal = dal;
 }
예제 #4
0
 public WeatherController()
 {
     weatherDAL = new WeatherSQLDAL(ConfigurationManager.ConnectionStrings["NPGeekConnectionString"].ConnectionString);
 }
예제 #5
0
 // 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;
 }