Files
ayanova7/source/bizobjects/AyaLib/GZTW.AyaNova.BLL/PartHasSerialNumbers.cs
2018-06-29 19:47:36 +00:00

129 lines
2.5 KiB
C#

///////////////////////////////////////////////////////////
// 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
{
/// <summary>
/// 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
/// </summary>
[Serializable,EditorBrowsable(EditorBrowsableState.Never)]
public class PartHasSerialNumbers : ReadOnlyBase
{
#region Attributes
private bool mBoolValue;
#endregion
#region Constructor
/// <summary>
/// Private constructor to prevent direct instantiation
/// </summary>
private PartHasSerialNumbers()
{
}
#endregion
#region Static methods
/// <summary>
/// Returns True if the given part ID represents a part that has serial numbers entered for it
/// </summary>
/// <param name="ID"></param>
/// <returns></returns>
public static bool GetItem(Guid ID)
{
return ((PartHasSerialNumbers)DataPortal.Fetch(new Criteria( ID))).mBoolValue;
}
#endregion
#region DAL DATA ACCESS
///
/// <param Bool="Criteria"></param>
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
/// <summary>
/// Criteria for identifying existing object
/// </summary>
[Serializable]
private class Criteria
{
public Guid ID;
public Criteria( Guid _ID)
{
ID=_ID;
}
}
#endregion
}//end Bool
}//end Boolspace GZTW.AyaNova.BLL