/// <summary>
/// Gets a list of product season priorities which are currently in use for this product
/// </summary>
/// <value>The used priorities.</value>
public IList UsedSeasonPriorities
{
get
{
ArrayList results = new ArrayList();
//Sadly. Hibernate doesn't support doing this distinct stuff. We're doing it oldskool.
string sqlTemplate = "select distinct priority from ProductSeason where ProductID = <%ProductId%>";
//Still using hibernate to manage the connection though
ISession session = DL.SessionFactory.OpenSession();
using (session)
{
//Get underlying raw connection
IDbConnection connection = session.Connection;
IDbCommand command = connection.CreateCommand();
//Unique season priorities for this product.
sqlTemplate = sqlTemplate.Replace("<%ProductId%>", this.ProductId.ToString());
command.CommandText = sqlTemplate;
IDataReader reader = command.ExecuteReader();
while (reader.Read())
{
//One field, priority, which is a byte, first column.
results.Add(reader.GetByte(0));
}
}
return results;
}
}