public Queue<MapTransaction> GetSessionTransactions(Guid sessionId)
{
Queue<MapTransaction> transactions = new Queue<MapTransaction>();
/// TODO: Get all the transactions persisted in SQL server.
/// TODO: Need to really turn this method and the following code into a factory. Need to dispose the objects but this could also be a little more encapsulated.
SqlConnection connection = new SqlConnection("Data Source=chris-ultrabook;Initial Catalog=MappingToolDatabase;Integrated Security=True");
SqlParameter sessionIdParameter = new SqlParameter("@SessionId", sessionId);
SqlCommand selectSessionTransactions = new SqlCommand(SelectSessionTransactionsSqlQuery, connection);
selectSessionTransactions.Parameters.Add(sessionId);
SqlDataReader sessions = selectSessionTransactions.ExecuteReader();
TransactionType transactionType = (TransactionType)sessions["OperationId"];
MapParameters mapParameters = new MapParameters(connection, sessionId);
while (sessions.Read())
{
MapTransaction mapTransaction = new MapTransaction(CreateTransactionOperation(transactionType, mapParameters));// = CreateTransaction((TransactionType)sessions["OperationId"]);
mapTransaction.LoadTransaction(sessions);
transactions.Enqueue(mapTransaction);
}
return transactions;
}
}