178 lines
4.0 KiB
C#
178 lines
4.0 KiB
C#
///////////////////////////////////////////////////////////
|
|
// WorkorderItemPartRequestNotificationDescriptionFetcher.cs
|
|
// Implementation of Class WorkorderItemPartRequestNotificationDescriptionFetcher
|
|
// CSLA type: Read-only object
|
|
// Created on: 1-Nov-2005
|
|
// Object design: John
|
|
// Coded: John 1-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 to quickly fetch descriptive information
|
|
/// for identifying a work order item part request and service workorder to user
|
|
/// during notification Processing
|
|
/// </summary>
|
|
[Serializable,EditorBrowsable(EditorBrowsableState.Never)]
|
|
internal class WorkorderItemPartRequestNotificationDescriptionFetcher : ReadOnlyBase
|
|
{
|
|
|
|
#region Attributes
|
|
private string mWorkorderNumber="";
|
|
private string mClientName="";
|
|
private string mPartName="";
|
|
private decimal mRequested=0;
|
|
private decimal mReceived=0;
|
|
#endregion
|
|
|
|
#region Constructor
|
|
|
|
/// <summary>
|
|
/// Private constructor to prevent direct instantiation
|
|
/// </summary>
|
|
private WorkorderItemPartRequestNotificationDescriptionFetcher()
|
|
{
|
|
|
|
}
|
|
#endregion
|
|
|
|
|
|
#region Business properties
|
|
|
|
|
|
|
|
public string WorkorderNumber
|
|
{
|
|
get
|
|
{
|
|
return mWorkorderNumber;
|
|
}
|
|
|
|
}
|
|
|
|
public string ClientName
|
|
{
|
|
get
|
|
{
|
|
return mClientName;
|
|
}
|
|
|
|
}
|
|
|
|
public string PartName
|
|
{
|
|
get
|
|
{
|
|
return mPartName;
|
|
}
|
|
|
|
}
|
|
|
|
public decimal Requested{get{return this.mRequested;}}
|
|
public decimal Received{get{return this.mReceived;}}
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
#region Static methods
|
|
|
|
|
|
public static WorkorderItemPartRequestNotificationDescriptionFetcher GetItem(Guid WorkorderItemPartRequestID)
|
|
{
|
|
|
|
return (WorkorderItemPartRequestNotificationDescriptionFetcher)DataPortal.Fetch(new Criteria(WorkorderItemPartRequestID));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
#region DAL DATA ACCESS
|
|
///
|
|
/// <param Bool="Criteria"></param>
|
|
protected override void DataPortal_Fetch(object Criteria)
|
|
{
|
|
Criteria crit = (Criteria)Criteria;
|
|
SafeDataReader dr = null;
|
|
|
|
dr=DBUtil.GetReaderFromSQLString(
|
|
"SELECT aClient.aName AS CLIENTNAME, aWorkorderService.aServiceNumber, " +
|
|
" aPart.aID, " +
|
|
" aPart.aName AS PARTNAME, " +
|
|
" aWorkorderItemPartRequest.aQuantity, " +
|
|
" aWorkorderItemPartRequest.aReceived " +
|
|
|
|
"FROM " +
|
|
" AWORKORDERITEMPARTREQUEST " +
|
|
" LEFT OUTER JOIN AWORKORDERITEM ON (AWORKORDERITEMPARTREQUEST.AWORKORDERITEMID=AWORKORDERITEM.AID) " +
|
|
" LEFT OUTER JOIN APART ON (AWORKORDERITEMPARTREQUEST.APARTID=APART.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) " +
|
|
|
|
"WHERE (aWorkorderItemPartRequest.aID " +
|
|
"= @ID)", crit.WorkorderItemPartRequestID
|
|
);
|
|
|
|
if(dr.Read())
|
|
{
|
|
this.mClientName=dr.GetString("CLIENTNAME");
|
|
this.mWorkorderNumber=dr.GetInt32("aServiceNumber").ToString();
|
|
this.mPartName=dr.GetString("PARTNAME");
|
|
this.mReceived=dr.GetDecimal("aReceived");
|
|
this.mRequested=dr.GetDecimal("aQuantity");
|
|
|
|
|
|
}
|
|
|
|
|
|
//Changed: 09-June-2006 this was missing!
|
|
if (dr != null) dr.Close();
|
|
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
#region criteria
|
|
/// <summary>
|
|
/// Criteria for identifying existing object
|
|
/// </summary>
|
|
[Serializable]
|
|
private class Criteria
|
|
{
|
|
|
|
public Guid WorkorderItemPartRequestID;
|
|
|
|
public Criteria(Guid _WorkorderItemPartRequestID)
|
|
{
|
|
|
|
WorkorderItemPartRequestID=_WorkorderItemPartRequestID;
|
|
|
|
|
|
}
|
|
|
|
}
|
|
#endregion
|
|
|
|
}//end Bool
|
|
|
|
}//end Boolspace GZTW.AyaNova.BLL |