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;
 }
예제 #3
0
 public ParkController(IParkSqlDAL parkSqlDAL, IWeatherSqlDAL weatherSqlDAL)
 {
     this.parkSqlDAL    = parkSqlDAL;
     this.weatherSqlDAL = weatherSqlDAL;
 }
예제 #4
0
 public SurveyController(ISurveySqlDAL surveySqlDAL, IParkSqlDAL parkSqlDAL)
 {
     this.surveySqlDAL = surveySqlDAL;
     this.parkSqlDAL   = parkSqlDAL;
 }
예제 #5
0
 public ParkController()
 {
     parkDAL = new ParkSQLDAL(ConfigurationManager.ConnectionStrings["NPGeekConnectionString"].ConnectionString);
 }
예제 #6
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;
 }