- Added GetExternalTransitionsToChildren
- Added GetExternalTransitions
This commit is contained in:
parent
06c622b5eb
commit
cc86853f6f
@ -34,6 +34,7 @@ namespace VEPROMS.CSLA.Library
|
||||
return ResolvePathTo(item.ActiveFormat, item, TranType, MyItemToID, MyItemRangeID);
|
||||
}
|
||||
}
|
||||
#region AffectedTransitons
|
||||
public partial class TransitionInfoList
|
||||
{
|
||||
[Serializable()]
|
||||
@ -93,6 +94,123 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
this.RaiseListChangedEvents = true;
|
||||
}
|
||||
#endregion
|
||||
#region ExternalTransitionsToChildren
|
||||
private class ExternalTransitionsToChildrenCriteria
|
||||
{
|
||||
public ExternalTransitionsToChildrenCriteria(int itemID)
|
||||
{
|
||||
_ItemID = itemID;
|
||||
}
|
||||
private int _ItemID;
|
||||
public int ItemID
|
||||
{
|
||||
get { return _ItemID; }
|
||||
set { _ItemID = value; }
|
||||
}
|
||||
}
|
||||
public static TransitionInfoList GetExternalTransitionsToChildren(int itemID)
|
||||
{
|
||||
try
|
||||
{
|
||||
TransitionInfoList tmp = DataPortal.Fetch<TransitionInfoList>(new ExternalTransitionsToChildrenCriteria(itemID));
|
||||
TransitionInfo.AddList(tmp);
|
||||
tmp.AddEvents();
|
||||
return tmp;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new DbCslaException("Error on TransitionInfoList.GetExternalTransitionsToChildren", ex);
|
||||
}
|
||||
}
|
||||
private void DataPortal_Fetch(ExternalTransitionsToChildrenCriteria criteria)
|
||||
{
|
||||
this.RaiseListChangedEvents = false;
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] TransitionInfoList.DataPortal_FetchExternalTransitionsToChildren", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
{
|
||||
using (SqlCommand cm = cn.CreateCommand())
|
||||
{
|
||||
cm.CommandType = CommandType.StoredProcedure;
|
||||
cm.CommandText = "getExternalTransitionsToChildren";
|
||||
cm.Parameters.AddWithValue("@ItemID", criteria.ItemID);
|
||||
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
|
||||
{
|
||||
IsReadOnly = false;
|
||||
while (dr.Read()) this.Add(new TransitionInfo(dr));
|
||||
IsReadOnly = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("TransitionInfoList.DataPortal_FetchExternalTransitionsToChildren", ex);
|
||||
throw new DbCslaException("TransitionInfoList.DataPortal_Fetch", ex);
|
||||
}
|
||||
this.RaiseListChangedEvents = true;
|
||||
}
|
||||
#endregion
|
||||
#region ExternalTransitions
|
||||
private class ExternalTransitionsCriteria
|
||||
{
|
||||
public ExternalTransitionsCriteria(int itemID)
|
||||
{
|
||||
_ItemID = itemID;
|
||||
}
|
||||
private int _ItemID;
|
||||
public int ItemID
|
||||
{
|
||||
get { return _ItemID; }
|
||||
set { _ItemID = value; }
|
||||
}
|
||||
}
|
||||
public static TransitionInfoList GetExternalTransitions(int itemID)
|
||||
{
|
||||
try
|
||||
{
|
||||
TransitionInfoList tmp = DataPortal.Fetch<TransitionInfoList>(new ExternalTransitionsCriteria(itemID));
|
||||
TransitionInfo.AddList(tmp);
|
||||
tmp.AddEvents();
|
||||
return tmp;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new DbCslaException("Error on TransitionInfoList.GetExternalTransitions", ex);
|
||||
}
|
||||
}
|
||||
private void DataPortal_Fetch(ExternalTransitionsCriteria criteria)
|
||||
{
|
||||
this.RaiseListChangedEvents = false;
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] TransitionInfoList.DataPortal_FetchExternalTransitions", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
{
|
||||
using (SqlCommand cm = cn.CreateCommand())
|
||||
{
|
||||
cm.CommandType = CommandType.StoredProcedure;
|
||||
cm.CommandText = "getExternalTransitions";
|
||||
cm.Parameters.AddWithValue("@ItemID", criteria.ItemID);
|
||||
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
|
||||
{
|
||||
IsReadOnly = false;
|
||||
while (dr.Read()) this.Add(new TransitionInfo(dr));
|
||||
IsReadOnly = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("TransitionInfoList.DataPortal_FetchExternalTransitions", ex);
|
||||
throw new DbCslaException("TransitionInfoList.DataPortal_Fetch", ex);
|
||||
}
|
||||
this.RaiseListChangedEvents = true;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
public static class TransitionText
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user