RetrieveRequest() public method

public RetrieveRequest ( System.Guid uniqueRequestID ) : RequestForm
uniqueRequestID System.Guid
return CoyoteMoves.Models.RequestItems.RequestForm
Ejemplo n.º 1
0
        public Collection <RequestForm> GetApprovedRequestsBetweenDates(SqlDateTime begin, SqlDateTime end)
        {
            Collection <RequestForm> requestCollection = new Collection <RequestForm>();
            SqlConnection            connection        = new SqlConnection(_connectionString);
            string     commandString = "SELECT [UniqueRequestID] FROM [Intern_CoyoteMoves].[dbo].[RequestData] WHERE [CreateDate] <= @end AND [CreateDate] >= @begin AND [Pending] = 0";
            SqlCommand command       = new SqlCommand(commandString);

            command.Parameters.AddWithValue("@begin", begin);
            command.Parameters.AddWithValue("@end", end);
            command.Connection = connection;
            connection.Open();
            SqlDataReader         reader         = command.ExecuteReader();
            SqlToFormModelFactory RequestFactory = new SqlToFormModelFactory(reader);

            while (reader.Read())
            {
                requestCollection.Add(_requester.RetrieveRequest(reader.GetGuid(reader.GetOrdinal("UniqueRequestID"))));
            }
            connection.Close();
            return(requestCollection);
        }