2006-11-14 14:33:33 +00:00

58 lines
1.4 KiB
C#

using System;
using System.Collections.Generic;
using System.Text;
using System.Data.SqlClient;
using Csla;
using System.Data;
using Csla.Data;
namespace Volian.CSLA.Library
{
[Serializable()]
public class HLStepInfoList : VEReadOnlyListBase<HLStepInfoList, HLStepInfo>
{
#region Factory Methods
protected HLStepInfoList()
{ /* require use of factory methods */ }
#endregion
#region Item Specific Data Access
/// <summary>
/// This is the SQL Command Definition
/// </summary>
/// <param name="cm">SQL Command</param>
/// <param name="criteria">Criteria for this object</param>
protected override void SetupSelect(SqlCommand cm, Criteria criteria)
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "vesp_ListHLSteps";
cm.Parameters.AddWithValue("@StructID", criteria.Id);
}
/// <summary>
/// This saves each item to the list from the Database
/// </summary>
/// <param name="dr">SafeDataReader used to load items</param>
protected override void CreateItem(SafeDataReader dr)
{
try
{
HLStepInfo info = new HLStepInfo(
dr.GetInt32("StructureID"),
dr.GetString("TextM"),
dr.GetInt32("Item")
);
this.Add(info);
}
catch (Exception ex)
{
Console.WriteLine("{0} Exception: {1} Message: {2}\r\nInner Exception:{3}",
new System.Diagnostics.StackTrace().GetFrame(0).GetMethod().Name,
ex.GetType().ToString(), ex.Message, ex.InnerException);
}
}
#endregion
}
}