Script changed to be able to run repeatedly

Add DROUsages to Concistency Check
This commit is contained in:
Rich
2012-01-24 20:35:13 +00:00
parent 3ba7971ece
commit f9fa4fa3c1
2 changed files with 107 additions and 0 deletions

View File

@@ -666,6 +666,10 @@ namespace VEPROMS.CSLA.Library
foreach (RoUsageInfo myRO in myList)
if (!myROIDs.Contains(myRO.ROID.ToUpper()))
myROIDs.Add(myRO.ROID.ToUpper());
using (DROUsageInfoList myList = DROUsageInfoList.GetAllForProcedure(proc))
foreach (DROUsageInfo myRO in myList)
if (!myROIDs.Contains(myRO.ROID.ToUpper()))
myROIDs.Add(myRO.ROID.ToUpper());
//create checkro record for each roid
//_MyTimer.ActiveProcess = "Get DocVersionInfo";
DocVersionInfo dbi = proc.ActiveParent as DocVersionInfo;
@@ -790,6 +794,68 @@ namespace VEPROMS.CSLA.Library
this.RaiseListChangedEvents = true;
}
}
public partial class DROUsageInfoList
{
[Serializable()]
private class AllForProcedureCriteria
{
public AllForProcedureCriteria(int itemID)
{
_ItemID = itemID;
}
private int _ItemID;
public int ItemID
{
get { return _ItemID; }
set { _ItemID = value; }
}
}
public static DROUsageInfoList GetAllForProcedure(ProcedureInfo proc)
{
try
{
DROUsageInfoList tmp = DataPortal.Fetch<DROUsageInfoList>(new AllForProcedureCriteria(proc.ItemID));
DROUsageInfo.AddList(tmp);
tmp.AddEvents();
return tmp;
}
catch (Exception ex)
{
throw new DbCslaException("Error on DROUsageInfoList.GetAllForProcedure", ex);
}
}
private void DataPortal_Fetch(AllForProcedureCriteria criteria)
{
this.RaiseListChangedEvents = false;
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] DROUsageInfoList.DataPortal_FetchAllForProc", GetHashCode());
try
{
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
{
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "getDROUsagesForProc";
cm.Parameters.AddWithValue("@ItemID", criteria.ItemID);
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
{
IsReadOnly = false;
while (dr.Read())
this.Add(new DROUsageInfo(dr));
IsReadOnly = true;
}
}
}
}
catch (Exception ex)
{
if (_MyLog.IsErrorEnabled) _MyLog.Error("DROUsageInfoList.DataPortal_FetchAllForProc", ex);
throw new DbCslaException("DROUsageInfoList.DataPortal_Fetch", ex);
}
this.RaiseListChangedEvents = true;
}
}
public partial class TransitionInfo
{
internal string _ContentText;