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

87 lines
2.0 KiB
C#

using System;
using System.Data;
using System.Data.SqlClient;
using Csla;
using Csla.Data;
namespace Volian.CSLA.Library
{
public partial class SectionInfo : ReadOnlyBase<SectionInfo>, IVEReadOnlyItem
{
#region Business Methods
private string _PPath = string.Empty;
/// <summary>
/// Required to build tree PPath is the Parent Path calculated with a recursive query
/// </summary>
public string PPath
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _PPath;
}
}
private string _Path = string.Empty;
/// <summary>
/// Required to build tree Path is the Current Path calculated with a recursive query
/// </summary>
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
/// <summary>
/// This loads the SectionInfo Record and adds the Path and PPath fields
/// </summary>
/// <param name="dr"></param>
/// <returns></returns>
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
}
}