113 lines
2.7 KiB
C#
113 lines
2.7 KiB
C#
///////////////////////////////////////////////////////////
|
|
// Bool.cs
|
|
// Implementation of Class ClientPopUpNotesFetcher
|
|
// CSLA type: Read-only object
|
|
// Created on: 1-Nov-2007
|
|
// Object design: John
|
|
// Coded: 1-Nov-2007
|
|
///////////////////////////////////////////////////////////
|
|
|
|
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>
|
|
///Lightweight method for quickly fetching a <see cref="Client"/> object's PopupNotes if present
|
|
///Used by UI when opening workorders
|
|
/// </summary>
|
|
[Serializable, EditorBrowsable(EditorBrowsableState.Never)]
|
|
public class ClientPopUpNotesFetcher : ReadOnlyBase
|
|
{
|
|
|
|
#region Attributes
|
|
private string mNotes;
|
|
|
|
#endregion
|
|
|
|
#region Constructor
|
|
|
|
/// <summary>
|
|
/// Private constructor to prevent direct instantiation
|
|
/// </summary>
|
|
private ClientPopUpNotesFetcher()
|
|
{
|
|
mNotes="";
|
|
}
|
|
#endregion
|
|
|
|
|
|
#region Static methods
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// Fetch the notes for the specified <see cref="Client"/>
|
|
/// </summary>
|
|
/// <param name="ID"></param>
|
|
/// <returns><see cref="Client"/> Popup notes</returns>
|
|
public static string GetNotes(Guid ID)
|
|
{
|
|
|
|
return ((ClientPopUpNotesFetcher)DataPortal.Fetch(new Criteria(ID))).mNotes;
|
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
#region DAL DATA ACCESS
|
|
///
|
|
/// <param Bool="Criteria"></param>
|
|
protected override void DataPortal_Fetch(object Criteria)
|
|
{
|
|
Criteria crit = (Criteria)Criteria;
|
|
SafeDataReader dr = null;
|
|
try
|
|
{
|
|
dr = DBUtil.GetReaderFromSQLString(
|
|
"SELECT ACLIENT.APOPUPNOTES " +
|
|
"FROM ACLIENT " +
|
|
"WHERE ACLIENT.AID= @ID", crit.ID);
|
|
if (dr.Read())
|
|
{
|
|
mNotes = dr.GetString("APOPUPNOTES");
|
|
}
|
|
}
|
|
finally
|
|
{
|
|
if (dr != null) 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 class
|
|
|
|
}//end namespace GZTW.AyaNova.BLL |