/////////////////////////////////////////////////////////// // Bool.cs // Implementation of Class WorkorderItemScheduledUserDescriptionFetcher // CSLA type: Read-only object // Created on: 24-Oct-2005 // Object design: John // Coded: John 24-Oct-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 { #pragma warning disable 1591 /// /// Used to quickly fetch descriptive information /// for a workorderitemscheduleduser notification /// during notification Processing /// [Serializable] public class WorkorderItemScheduledUserDescriptionFetcher : ReadOnlyBase { #region Attributes private string mWorkorderNumber=""; private string mClientName=""; private string mSummary=""; private string mTechNotes=""; private SmartDate mStartDate=new SmartDate(); private SmartDate mStopDate=new SmartDate(); private decimal mEstimatedQuantity=0; private string mRateName=""; #endregion #region Constructor /// /// Private constructor to prevent direct instantiation /// private WorkorderItemScheduledUserDescriptionFetcher() { } #endregion #region Business properties public string WorkorderNumber { get { return mWorkorderNumber; } } public string ClientName { get { return mClientName; } } public string Summary { get { return mSummary; } } public string TechNotes { get { return mTechNotes; } } public SmartDate StartDate { get { return mStartDate; } } public SmartDate StopDate { get { return mStopDate; } } public decimal EstimatedQuantity { get { return this.mEstimatedQuantity; } } public string RateName { get { return this.mRateName; } } #endregion #region Static methods public static WorkorderItemScheduledUserDescriptionFetcher GetItemFromWorkorderItemScheduledUserID(Guid WorkorderItemScheduledUserID) { return (WorkorderItemScheduledUserDescriptionFetcher)DataPortal.Fetch(new Criteria(WorkorderItemScheduledUserID )); } #endregion #region DAL DATA ACCESS /// /// protected override void DataPortal_Fetch(object Criteria) { Criteria crit = (Criteria)Criteria; SafeDataReader dr = DBUtil.GetReaderFromSQLString( "SELECT aWorkorderItemScheduledUser.aID, " + "aWorkorderItemScheduledUser.aEstimatedQuantity, " + " aWorkorderItemScheduledUser.aStartDate, " + " aWorkorderItemScheduledUser.aStopDate, " + " aWorkorderService.aServiceNumber, " + " aClient.aName AS CLIENTNAME, " + " aWorkorderItem.aTechNotes, aWorkorderItem.aSummary, " + " aRate.aName AS RATENAME " + "FROM " + " AWORKORDERITEMSCHEDULEDUSER " + " LEFT OUTER JOIN AWORKORDERITEM ON (AWORKORDERITEMSCHEDULEDUSER.AWORKORDERITEMID=AWORKORDERITEM.AID) " + " LEFT OUTER JOIN AWORKORDER ON (AWORKORDERITEM.AWORKORDERID=AWORKORDER.AID) " + " LEFT OUTER JOIN AWORKORDERSERVICE ON (AWORKORDER.AID=AWORKORDERSERVICE.AWORKORDERID) " + " LEFT OUTER JOIN ACLIENT ON (AWORKORDER.ACLIENTID=ACLIENT.AID) " + " LEFT OUTER JOIN ARATE ON (AWORKORDERITEMSCHEDULEDUSER.ASERVICERATEID=ARATE.AID) " + "WHERE (aWorkorderItemScheduledUser.aID " + "= @ID)", crit.WorkorderItemScheduledUserID ); if(dr.Read()) { this.mClientName=dr.GetString("CLIENTNAME"); this.mWorkorderNumber=dr.GetInt32("aServiceNumber").ToString(); this.mEstimatedQuantity=dr.GetDecimal("aEstimatedQuantity"); this.mRateName=dr.GetString("RATENAME"); this.mStartDate=DBUtil.ToLocal(dr.GetSmartDate("aStartDate")); this.mStopDate=DBUtil.ToLocal(dr.GetSmartDate("aStopDate")); this.mSummary=dr.GetString("aSummary"); this.mTechNotes=dr.GetString("aTechNotes"); } //Changed: 09-June-2006 this was missing! if (dr != null) dr.Close(); } #endregion #region criteria /// /// Criteria for identifying existing object /// [Serializable] private class Criteria { //public Guid WorkorderItemID; public Guid WorkorderItemScheduledUserID; public Criteria(/*Guid _WorkorderItemID,*/ Guid _WorkorderItemScheduledUserID) { //WorkorderItemID=_WorkorderItemID; WorkorderItemScheduledUserID=_WorkorderItemScheduledUserID; } } #endregion }//end class #pragma warning restore 1591 }//end namespace GZTW.AyaNova.BLL