using System; using System.Data; using System.Data.SqlClient; using Csla; using Csla.Data; namespace Volian.CSLA.Library { public partial class SectionInfo : ReadOnlyBase, IVEReadOnlyItem { #region Business Methods private string _PPath = string.Empty; /// /// Required to build tree PPath is the Parent Path calculated with a recursive query /// public string PPath { [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)] get { CanReadProperty(true); return _PPath; } } private string _Path = string.Empty; /// /// Required to build tree Path is the Current Path calculated with a recursive query /// public string Path { [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)] get { CanReadProperty(true); return _Path; } } #endregion #region IVEReadOnlyItem HLStepInfoList _hlsil = null; public System.Collections.IList GetChildren() { if (_hlsil == null) { if(ContentType==1) _hlsil = HLStepInfoList.Get(ContentID); } return _hlsil; } public bool GetChildrenLoaded() { return _hlsil == null; } public bool HasChildren() { return ContentType==1 && ContentID != 0; } public override string ToString() { return string.Format("{0} - {1}", this.Number, this.Title); } #endregion #region Data Access Portal /// /// This loads the SectionInfo Record and adds the Path and PPath fields /// /// /// internal static SectionInfo ExtendedGet(SafeDataReader dr) { try { SectionInfo si = new SectionInfo(dr); si._Path = dr.GetString("Path"); si._PPath = dr.GetString("PPath"); return si; } catch (Exception ex) { Database.LogException("SectionInfo.Constructor", ex); throw new DbCslaException("SectionInfo.Constructor", ex); } } #endregion } }