/////////////////////////////////////////////////////////// // Bool.cs // Implementation of Class PartHasSerialNumbers // CSLA type: Read-only object // Created on: 11-Jan-2006 // Object design: John // Coded: John 11-Jan-2006 /////////////////////////////////////////////////////////// using System; using System.Data; using CSLA.Data; using GZTW.Data; using CSLA; using System.Threading; using CSLA.Security; using System.ComponentModel; namespace GZTW.AyaNova.BLL { /// /// Checks to see if a part has serial numbers /// used internally to see if it's valid to /// set a part to not track serial numbers if it was previously /// set that way /// [Serializable,EditorBrowsable(EditorBrowsableState.Never)] public class PartHasSerialNumbers : ReadOnlyBase { #region Attributes private bool mBoolValue; #endregion #region Constructor /// /// Private constructor to prevent direct instantiation /// private PartHasSerialNumbers() { } #endregion #region Static methods /// /// Returns True if the given part ID represents a part that has serial numbers entered for it /// /// /// public static bool GetItem(Guid ID) { return ((PartHasSerialNumbers)DataPortal.Fetch(new Criteria( ID))).mBoolValue; } #endregion #region DAL DATA ACCESS /// /// protected override void DataPortal_Fetch(object Criteria) { Criteria crit = (Criteria)Criteria; SafeDataReader dr = null; this.mBoolValue=false; try { dr=DBUtil.GetReaderFromSQLString( //************************************************************ "SELECT TOP 1 APARTSERIAL.APARTID FROM APARTSERIAL " + "WHERE (APARTSERIAL.APARTID = @ID)" ,crit.ID //************************************************************ ); if(dr.Read()) { this.mBoolValue=true; } } finally { dr.Close(); } } #endregion #region criteria /// /// Criteria for identifying existing object /// [Serializable] private class Criteria { public Guid ID; public Criteria( Guid _ID) { ID=_ID; } } #endregion }//end Bool }//end Boolspace GZTW.AyaNova.BLL