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 { #region Factory Methods protected HLStepInfoList() { /* require use of factory methods */ } #endregion #region Item Specific Data Access /// /// This is the SQL Command Definition /// /// SQL Command /// Criteria for this object protected override void SetupSelect(SqlCommand cm, Criteria criteria) { cm.CommandType = CommandType.StoredProcedure; cm.CommandText = "vesp_ListHLSteps"; cm.Parameters.AddWithValue("@StructID", criteria.Id); } /// /// This saves each item to the list from the Database /// /// SafeDataReader used to load items 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 } }