/// <summary>
 /// Executes the stored procedure
 /// </summary>
 /// <param name="statement"></param>
 public void ExecuteStoredProcedWithoutScalar(ShoeTrackerSqlStatment statement)
 {
     using (SqlConnection connection = new SqlConnection(this.ConnectionString))
     {
         connection.Open();
         SqlCommand command = connection.CreateCommand();
         command.CommandType = CommandType.StoredProcedure;
         this.PrepareSql(command, statement.sql, statement.GetParameters());
         command.ExecuteNonQuery();
     }
 }
        /// <summary>
        /// Executes the stored procedure
        /// </summary>
        /// <param name="statement"></param>
        public int ExecuteStoredProced(ShoeTrackerSqlStatment statement)
        {
            int scope;

            using (SqlConnection connection = new SqlConnection(this.ConnectionString))
            {
                connection.Open();
                SqlCommand command = connection.CreateCommand();
                command.CommandType = CommandType.StoredProcedure;
                this.PrepareSql(command, statement.sql, statement.GetParameters());
                scope = int.Parse(command.ExecuteScalar().ToString());
            }

            return(scope);
        }
 /// <summary>
 /// Executes with mapper
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="statement"></param>
 /// <param name="mapper"></param>
 /// <returns></returns>
 public IEnumerable <T> ExecuteStoredProc <T>(ShoeTrackerSqlStatment statement, ShoeTrackerDatabaseRepo.MapRecord <T> mapper)
 {
     using (SqlConnection sqlConnection = new SqlConnection(this.ConnectionString))
     {
         sqlConnection.Open();
         SqlCommand cmd = sqlConnection.CreateCommand();
         cmd.CommandType = CommandType.StoredProcedure;
         this.PrepareSql(cmd, statement.sql, statement.GetParameters());
         SqlDataReader reader = cmd.ExecuteReader();
         int           count  = 0;
         while (reader.Read())
         {
             yield return(mapper(new SqlReaderWrapper((IDataReader)reader), count++));
         }
     }
 }