public void Initialize()
        {
            tran = new TransactionScope();
            surveyResultSqlDAL = new SurveyResultSqlDAL(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 a test weather
                cmd = new SqlCommand(
                    "INSERT INTO weather (parkCode, fiveDayForecastValue, low, high, forecast) VALUES ('TEST', 1, 0, 32, 'cloudy');", connection);
                cmd.ExecuteNonQuery();

                //make 3 test votes
                cmd = new SqlCommand(
                    "INSERT INTO survey_result (parkCode, emailAddress, state, activityLevel) " +
                    "VALUES ('TEST', '*****@*****.**', 'TT', 'sedentary');", connection);
                cmd.ExecuteNonQuery();
                cmd.ExecuteNonQuery();
                cmd.ExecuteNonQuery();
            }
        }
コード例 #2
0
 public SurveyController(IParkSqlDAL parkSqlDAL, ISurveyResultSqlDAL surveyResultSqlDAL)
 {
     this.parkSqlDAL         = parkSqlDAL;
     this.surveyResultSqlDAL = surveyResultSqlDAL;
 }