Added ability to get RO usage list by DocVersion and Procedure
This commit is contained in:
parent
a0402016df
commit
600dcc0121
@ -97,6 +97,44 @@ namespace VEPROMS.CSLA.Library
|
||||
throw new DbCslaException("Error on RoUsageInfoList.Get", ex);
|
||||
}
|
||||
}
|
||||
//public static RoUsageInfoList GetByFolder(FolderInfo fi)
|
||||
//{
|
||||
//}
|
||||
public static RoUsageInfoList GetByDocVersion(DocVersionInfo dvi)
|
||||
{
|
||||
try
|
||||
{
|
||||
//if (_RoUsageInfoList != null)
|
||||
// return _RoUsageInfoList;
|
||||
RoUsageInfoList tmp = DataPortal.Fetch<RoUsageInfoList>(new VersionIDCriteria(dvi.VersionID));
|
||||
RoUsageInfo.AddList(tmp);
|
||||
tmp.AddEvents();
|
||||
_RoUsageInfoList = tmp;
|
||||
return tmp;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new DbCslaException("Error on RoUsageInfoList.Get", ex);
|
||||
}
|
||||
}
|
||||
public static RoUsageInfoList GetByProcedure(ProcedureInfo pi)
|
||||
{
|
||||
try
|
||||
{
|
||||
//if (_RoUsageInfoList != null)
|
||||
// return _RoUsageInfoList;
|
||||
RoUsageInfoList tmp = DataPortal.Fetch<RoUsageInfoList>(new ItemIDCriteria(pi.ItemID));
|
||||
RoUsageInfo.AddList(tmp);
|
||||
tmp.AddEvents();
|
||||
_RoUsageInfoList = tmp;
|
||||
return tmp;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new DbCslaException("Error on RoUsageInfoList.Get", ex);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reset the list of all RoUsageInfo.
|
||||
/// </summary>
|
||||
@ -148,6 +186,94 @@ namespace VEPROMS.CSLA.Library
|
||||
{ /* require use of factory methods */ }
|
||||
#endregion
|
||||
#region Data Access Portal
|
||||
[Serializable()]
|
||||
private class VersionIDCriteria
|
||||
{
|
||||
public VersionIDCriteria(int versionID)
|
||||
{
|
||||
_VersionID = versionID;
|
||||
}
|
||||
private int _VersionID;
|
||||
public int VersionID
|
||||
{
|
||||
get { return _VersionID; }
|
||||
set { _VersionID = value; }
|
||||
}
|
||||
}
|
||||
private void DataPortal_Fetch(VersionIDCriteria criteria)
|
||||
{
|
||||
this.RaiseListChangedEvents = false;
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] RoUsageInfoList.DataPortal_Fetch", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
{
|
||||
using (SqlCommand cm = cn.CreateCommand())
|
||||
{
|
||||
cm.CommandType = CommandType.StoredProcedure;
|
||||
cm.CommandText = "getRoUsagesForDocVersion";
|
||||
cm.Parameters.AddWithValue("@VersionID", criteria.VersionID);
|
||||
cm.CommandTimeout = Database.DefaultTimeout;
|
||||
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
|
||||
{
|
||||
IsReadOnly = false;
|
||||
while (dr.Read()) this.Add(new RoUsageInfo(dr));
|
||||
IsReadOnly = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("RoUsageInfoList.DataPortal_Fetch", ex);
|
||||
throw new DbCslaException("RoUsageInfoList.DataPortal_Fetch", ex);
|
||||
}
|
||||
this.RaiseListChangedEvents = true;
|
||||
}
|
||||
[Serializable()]
|
||||
private class ItemIDCriteria
|
||||
{
|
||||
public ItemIDCriteria(int itemID)
|
||||
{
|
||||
_ItemID = itemID;
|
||||
}
|
||||
private int _ItemID;
|
||||
public int ItemID
|
||||
{
|
||||
get { return _ItemID; }
|
||||
set { _ItemID = value; }
|
||||
}
|
||||
}
|
||||
private void DataPortal_Fetch(ItemIDCriteria criteria)
|
||||
{
|
||||
this.RaiseListChangedEvents = false;
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] RoUsageInfoList.DataPortal_Fetch", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
{
|
||||
using (SqlCommand cm = cn.CreateCommand())
|
||||
{
|
||||
cm.CommandType = CommandType.StoredProcedure;
|
||||
cm.CommandText = "getRoUsagesForProc";
|
||||
cm.Parameters.AddWithValue("@ItemID", criteria.ItemID);
|
||||
cm.CommandTimeout = Database.DefaultTimeout;
|
||||
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
|
||||
{
|
||||
IsReadOnly = false;
|
||||
while (dr.Read()) this.Add(new RoUsageInfo(dr));
|
||||
IsReadOnly = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("RoUsageInfoList.DataPortal_Fetch", ex);
|
||||
throw new DbCslaException("RoUsageInfoList.DataPortal_Fetch", ex);
|
||||
}
|
||||
this.RaiseListChangedEvents = true;
|
||||
}
|
||||
private void DataPortal_Fetch()
|
||||
{
|
||||
this.RaiseListChangedEvents = false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user