104 lines
2.0 KiB
C#
104 lines
2.0 KiB
C#
///////////////////////////////////////////////////////////
|
|
// Bool.cs
|
|
// Implementation of Class ReportExistanceChecker
|
|
// CSLA type: Read-only object
|
|
// Created on: 29-Nov-2005
|
|
// Object design: John
|
|
// Coded: John 29-Nov-2005
|
|
///////////////////////////////////////////////////////////
|
|
|
|
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>
|
|
/// Used internally to confirm the existance of a
|
|
/// Report before importation
|
|
/// </summary>
|
|
[Serializable,EditorBrowsable(EditorBrowsableState.Never)]
|
|
public class ReportExistanceChecker : ReadOnlyBase
|
|
{
|
|
|
|
#region Attributes
|
|
private bool mExists;
|
|
#endregion
|
|
|
|
#region Constructor
|
|
|
|
/// <summary>
|
|
/// Private constructor to prevent direct instantiation
|
|
/// </summary>
|
|
private ReportExistanceChecker()
|
|
{
|
|
|
|
}
|
|
#endregion
|
|
|
|
|
|
#region Static methods
|
|
|
|
|
|
|
|
|
|
internal static bool ReportExists(Guid ReportID)
|
|
{
|
|
|
|
return ((ReportExistanceChecker)DataPortal.Fetch(new Criteria(ReportID ))).mExists;
|
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
#region DAL DATA ACCESS
|
|
///
|
|
/// <param Bool="Criteria"></param>
|
|
protected override void DataPortal_Fetch(object Criteria)
|
|
{
|
|
Criteria crit = (Criteria)Criteria;
|
|
if(DBUtil.ToGuid(DBUtil.GetScalarFromSQLString(
|
|
"SELECT aID FROM aReport WHERE " +
|
|
"(aID = @ID)",crit.ReportID
|
|
))==Guid.Empty)
|
|
this.mExists=false;
|
|
else
|
|
this.mExists=true;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
#region criteria
|
|
/// <summary>
|
|
/// Criteria for identifying existing object
|
|
/// </summary>
|
|
[Serializable]
|
|
private class Criteria
|
|
{
|
|
|
|
public Guid ReportID;
|
|
|
|
public Criteria( Guid _ReportID)
|
|
{
|
|
ReportID=_ReportID;
|
|
|
|
|
|
}
|
|
|
|
}
|
|
#endregion
|
|
|
|
}//end class
|
|
|
|
}//end namespace GZTW.AyaNova.BLL |