This commit is contained in:
2009-01-27 15:45:38 +00:00
parent a95b610d3f
commit 258b503bed
21 changed files with 9137 additions and 14 deletions

View File

@@ -58,7 +58,7 @@ namespace VEPROMS.CSLA.Library
#region Factory Methods
public static RoUsageInfoList _RoUsageInfoList = null;
/// <summary>
/// Return a list of all projects.
/// Return a list of all RoUsageInfo.
/// </summary>
public static RoUsageInfoList Get()
{
@@ -77,6 +77,13 @@ namespace VEPROMS.CSLA.Library
throw new DbCslaException("Error on RoUsageInfoList.Get", ex);
}
}
/// <summary>
/// Reset the list of all RoUsageInfo.
/// </summary>
public static void Reset()
{
_RoUsageInfoList = null;
}
// TODO: Add alternative gets -
//public static RoUsageInfoList Get(<criteria>)
//{
@@ -103,6 +110,20 @@ namespace VEPROMS.CSLA.Library
throw new DbCslaException("Error on RoUsageInfoList.GetByContentID", ex);
}
}
public static RoUsageInfoList GetByRODbID(int rODbID)
{
try
{
RoUsageInfoList tmp = DataPortal.Fetch<RoUsageInfoList>(new RODbIDCriteria(rODbID));
RoUsageInfo.AddList(tmp);
tmp.AddEvents();
return tmp;
}
catch (Exception ex)
{
throw new DbCslaException("Error on RoUsageInfoList.GetByRODbID", ex);
}
}
private RoUsageInfoList()
{ /* require use of factory methods */ }
#endregion
@@ -178,6 +199,49 @@ namespace VEPROMS.CSLA.Library
}
this.RaiseListChangedEvents = true;
}
[Serializable()]
private class RODbIDCriteria
{
public RODbIDCriteria(int rODbID)
{
_RODbID = rODbID;
}
private int _RODbID;
public int RODbID
{
get { return _RODbID; }
set { _RODbID = value; }
}
}
private void DataPortal_Fetch(RODbIDCriteria criteria)
{
this.RaiseListChangedEvents = false;
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] RoUsageInfoList.DataPortal_FetchRODbID", GetHashCode());
try
{
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
{
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "getRoUsagesByRODbID";
cm.Parameters.AddWithValue("@RODbID", criteria.RODbID);
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_FetchRODbID", ex);
throw new DbCslaException("RoUsageInfoList.DataPortal_Fetch", ex);
}
this.RaiseListChangedEvents = true;
}
#endregion
#region ICustomTypeDescriptor impl
public String GetClassName()