Added methods to support transition report functionality
This commit is contained in:
parent
9fd18c177d
commit
688c286296
@ -324,6 +324,61 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
public partial class FormatInfo : IFormatOrFormatInfo
|
public partial class FormatInfo : IFormatOrFormatInfo
|
||||||
{
|
{
|
||||||
|
//transition report stuff
|
||||||
|
private static Dictionary<int, string> _TransitionTypes;
|
||||||
|
public static Dictionary<int, string> GetTransitionTypesByFormatID(int formatID)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
DataPortal.Fetch(new FormatIDCriteria(formatID));
|
||||||
|
return _TransitionTypes;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new DbCslaException("Error on FormatInfo.GetTransitionTypesByFormatID", ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
[Serializable()]
|
||||||
|
private class FormatIDCriteria
|
||||||
|
{
|
||||||
|
private int _FormatID;
|
||||||
|
public int FormatID { get { return _FormatID; } }
|
||||||
|
public FormatIDCriteria(int formatID)
|
||||||
|
{
|
||||||
|
_FormatID = formatID;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void DataPortal_Fetch(FormatIDCriteria criteria)
|
||||||
|
{
|
||||||
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] TransitionInfoList.DataPortal_Fetch", GetHashCode());
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||||
|
{
|
||||||
|
using (SqlCommand cm = cn.CreateCommand())
|
||||||
|
{
|
||||||
|
cm.CommandType = CommandType.StoredProcedure;
|
||||||
|
cm.CommandText = "vesp_GetTranTypesByFormatID";
|
||||||
|
cm.Parameters.AddWithValue("@FormatID", criteria.FormatID);
|
||||||
|
cm.CommandTimeout = Database.DefaultTimeout;
|
||||||
|
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
|
||||||
|
{
|
||||||
|
_TransitionTypes = new Dictionary<int, string>();
|
||||||
|
while (dr.Read())
|
||||||
|
{
|
||||||
|
_TransitionTypes.Add(dr.GetInt32(0), dr.GetString(1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("FormatInfo.DataPortal_Fetch", ex);
|
||||||
|
throw new DbCslaException("FormatInfo.DataPortal_Fetch", ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//end transition report stuff
|
||||||
public virtual Format GetJustFormat()
|
public virtual Format GetJustFormat()
|
||||||
{
|
{
|
||||||
return _Editable = Format.GetJustFormat(_FormatID);
|
return _Editable = Format.GetJustFormat(_FormatID);
|
||||||
@ -480,4 +535,61 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public class FormatVersion
|
||||||
|
{
|
||||||
|
private string _Title;
|
||||||
|
public string Title { get { return _Title; } }
|
||||||
|
private int _FormatID;
|
||||||
|
public int FormatID { get { return _FormatID; } }
|
||||||
|
private int _VersionID;
|
||||||
|
public int VersionID { get { return _VersionID; } }
|
||||||
|
public FormatVersion(string title, int formatID, int versionID)
|
||||||
|
{
|
||||||
|
_Title = title;
|
||||||
|
_FormatID = formatID;
|
||||||
|
_VersionID = versionID;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public class FormatVersionList : List<FormatVersion>
|
||||||
|
{
|
||||||
|
public static FormatVersionList GetFormatVersions()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
FormatVersionList fvl = DataPortal.Fetch<FormatVersionList>();
|
||||||
|
return fvl;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new DbCslaException("FormatVersionList.DataPortal_Fetch GetFormatVersions", ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void DataPortal_Fetch()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||||
|
{
|
||||||
|
using (SqlCommand cm = cn.CreateCommand())
|
||||||
|
{
|
||||||
|
cm.CommandType = CommandType.StoredProcedure;
|
||||||
|
cm.CommandText = "vesp_GetFormatVersions";
|
||||||
|
cm.CommandTimeout = Database.DefaultTimeout;
|
||||||
|
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
|
||||||
|
{
|
||||||
|
while (dr.Read())
|
||||||
|
{
|
||||||
|
this.Add(new FormatVersion(dr.GetString(0), dr.GetInt32(1), dr.GetInt32(2)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Database.LogException("FormatVersionList.DataPortal_Fetch", ex);
|
||||||
|
throw new DbCslaException("FormatVersionList.DataPortal_Fetch", ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -549,6 +549,109 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
public static void ResetTranCounters()
|
||||||
|
{
|
||||||
|
TranCheckCount = 0;
|
||||||
|
TranFixCount = 0;
|
||||||
|
}
|
||||||
|
public static int TranCheckCount = 0;
|
||||||
|
public static int TranFixCount = 0;
|
||||||
|
internal static void MyRefreshTransitions(ItemInfo itemInfo, IVEDrillDownReadOnly itemParent, SectionInfo sectionInfo, ProcedureInfo procInfo, DocVersionInfo docVersionInfo, TransitionLookup tranLookup)
|
||||||
|
{
|
||||||
|
//TransitionInfoList til = TransitionInfoList.GetByFromID(itemInfo.ItemID);
|
||||||
|
//Console.WriteLine("Procedure: {0}, transitions: {1}", (itemInfo as ProcedureInfo).DisplayNumber, til.Count);
|
||||||
|
//foreach (TransitionInfo traninfo in til)
|
||||||
|
//{
|
||||||
|
// string oldText = itemInfo.MyContent.Text;
|
||||||
|
// itemInfo.MyContent.FixTransitionText(traninfo, tranLookup);
|
||||||
|
// string newText = itemInfo.MyContent.Text;
|
||||||
|
// if (newText != oldText)
|
||||||
|
// {
|
||||||
|
// Content content = Content.Get(itemInfo.MyContent.ContentID);
|
||||||
|
// content.FixTransitionText(traninfo);
|
||||||
|
// content.Save();
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
if (itemInfo.MyContent.ContentPartCount > 0)
|
||||||
|
foreach (PartInfo pi in itemInfo.MyContent.ContentParts)
|
||||||
|
foreach (ItemInfo ii in pi.MyItems)
|
||||||
|
MyRefreshTransitions(ii, itemInfo, (itemInfo as SectionInfo) ?? sectionInfo, procInfo, docVersionInfo, tranLookup);
|
||||||
|
if (itemInfo.MyContent.ContentTransitionCount > 0)
|
||||||
|
{
|
||||||
|
itemInfo.ResetOrdinal();
|
||||||
|
foreach (TransitionInfo traninfo in itemInfo.MyContent.ContentTransitions)
|
||||||
|
{
|
||||||
|
TranCheckCount++;
|
||||||
|
string oldText = itemInfo.MyContent.Text;
|
||||||
|
itemInfo.MyContent.FixTransitionText(traninfo, itemInfo);
|
||||||
|
string newText = itemInfo.MyContent.Text;
|
||||||
|
if (newText != oldText)
|
||||||
|
{
|
||||||
|
TranFixCount++;
|
||||||
|
Content content = Content.Get(itemInfo.MyContent.ContentID);
|
||||||
|
content.FixTransitionText(traninfo);
|
||||||
|
content.Save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static void ResetROCounters()
|
||||||
|
{
|
||||||
|
ROCheckCount = 0;
|
||||||
|
ROFixCount = 0;
|
||||||
|
}
|
||||||
|
public static int ROCheckCount = 0;
|
||||||
|
public static int ROFixCount = 0;
|
||||||
|
private static AnnotationType _VolianCommentType = null; // Using this to flag ro value issues with byron to braidwood
|
||||||
|
public static AnnotationType VolianCommentType
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_VolianCommentType == null)
|
||||||
|
_VolianCommentType = AnnotationType.GetByName("Volian Comment");
|
||||||
|
if (_VolianCommentType == null)
|
||||||
|
_VolianCommentType = AnnotationType.MakeAnnotationType("Volian Comment", null);
|
||||||
|
return _VolianCommentType;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
internal static void MyRefreshReferenceObjects(ItemInfo itemInfo, IVEDrillDownReadOnly itemParent, SectionInfo sectionInfo, DocVersionInfo docVersionInfo)
|
||||||
|
{
|
||||||
|
if (itemInfo.MyContent.ContentPartCount > 0)
|
||||||
|
foreach (PartInfo pi in itemInfo.MyContent.ContentParts)
|
||||||
|
foreach (ItemInfo ii in pi.MyItems)
|
||||||
|
MyRefreshReferenceObjects(ii, itemInfo, (itemInfo as SectionInfo) ?? sectionInfo, docVersionInfo);
|
||||||
|
ROFstInfo rofstinfo = docVersionInfo.DocVersionAssociations[0].MyROFst;
|
||||||
|
ROFSTLookup lookup = rofstinfo.GetROFSTLookup(docVersionInfo);
|
||||||
|
lookup.MyDocVersionInfo = docVersionInfo;
|
||||||
|
if (itemInfo.MyContent.ContentRoUsageCount > 0)
|
||||||
|
{
|
||||||
|
foreach (RoUsageInfo rousage in itemInfo.MyContent.ContentRoUsages)
|
||||||
|
{
|
||||||
|
if (sectionInfo != null)
|
||||||
|
{
|
||||||
|
ROCheckCount++;
|
||||||
|
string oldText = itemInfo.MyContent.Text;
|
||||||
|
string roval = lookup.GetTranslatedRoValue(rousage.ROID, sectionInfo.ActiveFormat.PlantFormat.FormatData.SectData.ConvertCaretToDelta);
|
||||||
|
ROFSTLookup.rochild roch = lookup.GetRoChild(rousage.ROID);
|
||||||
|
itemInfo.MyContent.FixContentText(rousage, roval, roch.type, rofstinfo, itemInfo);
|
||||||
|
string newText = itemInfo.MyContent.Text;
|
||||||
|
if (newText != oldText)
|
||||||
|
{
|
||||||
|
ROFixCount++;
|
||||||
|
Content content = Content.Get(itemInfo.MyContent.ContentID);
|
||||||
|
if (roval == "?")
|
||||||
|
{
|
||||||
|
oldText = content.ConvertROToText(rousage, roval, roch.type, rofstinfo);
|
||||||
|
//Annotation.MakeAnnotation(content.ContentItems[0].MyItem, VolianCommentType, "", string.Format("RO value ({0}) converted to text" + sameMsg, ItemInfo.ConvertToDisplayText(oldText)), null);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
content.FixContentText(rousage, roval, roch.type, rofstinfo);
|
||||||
|
content.Save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
internal static void SetParentSectionAndDocVersionPageNum(ItemInfo itemInfo, IVEDrillDownReadOnly itemParent, SectionInfo sectionInfo, ProcedureInfo procInfo, DocVersionInfo docVersionInfo, TransitionLookup tranLookup)
|
internal static void SetParentSectionAndDocVersionPageNum(ItemInfo itemInfo, IVEDrillDownReadOnly itemParent, SectionInfo sectionInfo, ProcedureInfo procInfo, DocVersionInfo docVersionInfo, TransitionLookup tranLookup)
|
||||||
{
|
{
|
||||||
if (itemInfo.MyContent.ContentPartCount > 0)
|
if (itemInfo.MyContent.ContentPartCount > 0)
|
||||||
@ -565,7 +668,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
foreach (TransitionInfo traninfo in itemInfo.MyContent.ContentTransitions)
|
foreach (TransitionInfo traninfo in itemInfo.MyContent.ContentTransitions)
|
||||||
{
|
{
|
||||||
itemInfo.MyContent.FixTransitionText(traninfo, tranLookup);
|
itemInfo.MyContent.FixTransitionText(traninfo, tranLookup, itemInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -630,7 +733,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
string roval = lookup.GetTranslatedRoValue(rousage.ROID, sectionInfo.ActiveFormat.PlantFormat.FormatData.SectData.ConvertCaretToDelta);
|
string roval = lookup.GetTranslatedRoValue(rousage.ROID, sectionInfo.ActiveFormat.PlantFormat.FormatData.SectData.ConvertCaretToDelta);
|
||||||
ROFSTLookup.rochild roch = lookup.GetRoChild(rousage.ROID);
|
ROFSTLookup.rochild roch = lookup.GetRoChild(rousage.ROID);
|
||||||
itemInfo.MyContent.FixContentText(rousage, roval, roch.type, rofstinfo);
|
itemInfo.MyContent.FixContentText(rousage, roval, roch.type, rofstinfo, itemInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -661,7 +764,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
foreach (TransitionInfo traninfo in itemInfo.MyContent.ContentTransitions)
|
foreach (TransitionInfo traninfo in itemInfo.MyContent.ContentTransitions)
|
||||||
{
|
{
|
||||||
//itemInfo.UpdateTransitionText();
|
//itemInfo.UpdateTransitionText();
|
||||||
itemInfo.MyContent.FixTransitionText(traninfo, tranLookup);
|
itemInfo.MyContent.FixTransitionText(traninfo, tranLookup, itemInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//ts = DateTime.Now.Subtract(dts);
|
//ts = DateTime.Now.Subtract(dts);
|
||||||
@ -4189,6 +4292,10 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
AddItem(itemInfo);
|
AddItem(itemInfo);
|
||||||
}
|
}
|
||||||
|
public void AddItemInfo(ItemInfo ii)
|
||||||
|
{
|
||||||
|
AddItem(ii);
|
||||||
|
}
|
||||||
public static ItemInfoList GetMoveItem(int? itemID, int index)
|
public static ItemInfoList GetMoveItem(int? itemID, int index)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@ -4944,6 +5051,89 @@ namespace VEPROMS.CSLA.Library
|
|||||||
this.RaiseListChangedEvents = true;
|
this.RaiseListChangedEvents = true;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
#region Transition Search
|
||||||
|
public static ItemInfoList GetListFromTransitionSearch(string docVersionList, int tranType, string tranCategory)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
ItemInfoList tmp = DataPortal.Fetch<ItemInfoList>(new ItemListTransitionSearchCriteria(docVersionList, tranType, tranCategory));
|
||||||
|
ItemInfo.AddList(tmp);
|
||||||
|
tmp.AddEvents();
|
||||||
|
return tmp;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new DbCslaException("Error on ItemInfoList.GetListFromTransitionSearch", ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
[Serializable()]
|
||||||
|
private class ItemListTransitionSearchCriteria
|
||||||
|
{
|
||||||
|
private string _DocVersionList;
|
||||||
|
public string DocVersionList { get { return _DocVersionList; } }
|
||||||
|
private int _TranType;
|
||||||
|
public int TranType { get { return _TranType; } }
|
||||||
|
private string _TranCategory;
|
||||||
|
public string TranCategory { get { return _TranCategory; } }
|
||||||
|
public ItemListTransitionSearchCriteria(string docVersionList, int tranType, string tranCategory)
|
||||||
|
{
|
||||||
|
_DocVersionList = docVersionList;
|
||||||
|
_TranType = tranType;
|
||||||
|
_TranCategory = tranCategory;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void DataPortal_Fetch(ItemListTransitionSearchCriteria criteria)
|
||||||
|
{
|
||||||
|
this.RaiseListChangedEvents = false;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||||
|
{
|
||||||
|
using (SqlCommand cm = cn.CreateCommand())
|
||||||
|
{
|
||||||
|
cm.CommandType = CommandType.StoredProcedure;
|
||||||
|
cm.CommandText = "vesp_SearchTransitions";
|
||||||
|
cm.Parameters.AddWithValue("@DocVersionList", criteria.DocVersionList);
|
||||||
|
cm.Parameters.AddWithValue("@TranType", criteria.TranType);
|
||||||
|
cm.Parameters.AddWithValue("@TranCategory", criteria.TranCategory);
|
||||||
|
cm.CommandTimeout = Database.DefaultTimeout;
|
||||||
|
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
|
||||||
|
{
|
||||||
|
while (dr.Read())
|
||||||
|
{
|
||||||
|
ItemInfo itemInfo = null;
|
||||||
|
int itemType = dr.GetInt32("Type") / 10000;
|
||||||
|
switch (itemType)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
itemInfo = new ProcedureInfo(dr);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
itemInfo = new SectionInfo(dr);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
itemInfo = new StepInfo(dr);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
itemInfo.AddContent(dr);
|
||||||
|
itemInfo._SearchDVPath = dr.GetString("DVPath");
|
||||||
|
//itemInfo._SearchPath = dr.GetString("Path");
|
||||||
|
IsReadOnly = false;
|
||||||
|
this.Add(itemInfo);
|
||||||
|
IsReadOnly = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Database.LogException("ItemInfoList.DataPortal_Fetch", ex);
|
||||||
|
throw new DbCslaException("ItemInfoList.DataPortal_Fetch", ex);
|
||||||
|
}
|
||||||
|
this.RaiseListChangedEvents = true;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
#region RO Reports
|
#region RO Reports
|
||||||
public static ItemInfoList GetListFromROReport(string docVersionList, string stepTypeList, string roSearchString, string unitPrefix)
|
public static ItemInfoList GetListFromROReport(string docVersionList, string stepTypeList, string roSearchString, string unitPrefix)
|
||||||
{
|
{
|
||||||
@ -5227,6 +5417,19 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
return (Procedure)(_Editable = Procedure.Get(ItemID));
|
return (Procedure)(_Editable = Procedure.Get(ItemID));
|
||||||
}
|
}
|
||||||
|
public static void RefreshTransitions(ProcedureInfo tmp)
|
||||||
|
{
|
||||||
|
TransitionLookup tranLookup = new TransitionLookup(0, tmp.ItemID, tmp.MyLookup);
|
||||||
|
tranLookup.ApplicabilityUnit = tmp.MyDocVersion.DocVersionConfig.SelectedSlave;
|
||||||
|
tranLookup.NewLookupNeeded += new TransitionLookupEvent(GetNewLookup);
|
||||||
|
if (tmp.MyDocVersion.DocVersionConfig.SelectedSlave <= 0)
|
||||||
|
MyRefreshTransitions(tmp, tmp.MyDocVersion, null, tmp, tmp.MyDocVersion, tranLookup);
|
||||||
|
}
|
||||||
|
public static void RefreshReferenceObjects(ProcedureInfo tmp)
|
||||||
|
{
|
||||||
|
if (tmp.MyDocVersion.DocVersionConfig.SelectedSlave <= 0)
|
||||||
|
MyRefreshReferenceObjects(tmp, tmp.MyDocVersion, null, tmp.MyDocVersion);
|
||||||
|
}
|
||||||
public static void RefreshPageNumTransitions(ProcedureInfo tmp)
|
public static void RefreshPageNumTransitions(ProcedureInfo tmp)
|
||||||
{
|
{
|
||||||
TransitionLookup tranLookup = new TransitionLookup(0, tmp.ItemID, tmp.MyLookup);
|
TransitionLookup tranLookup = new TransitionLookup(0, tmp.ItemID, tmp.MyLookup);
|
||||||
@ -5513,8 +5716,59 @@ namespace VEPROMS.CSLA.Library
|
|||||||
Database.LogException("ItemInfoList.DataPortal_Fetch", ex);
|
Database.LogException("ItemInfoList.DataPortal_Fetch", ex);
|
||||||
throw new DbCslaException("ItemInfoList.DataPortal_Fetch", ex);
|
throw new DbCslaException("ItemInfoList.DataPortal_Fetch", ex);
|
||||||
}
|
}
|
||||||
|
MyLookup = lookup;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
[Serializable()]
|
||||||
|
public class ProcedureTransitionsCountCommand : CommandBase
|
||||||
|
{
|
||||||
|
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
private int _ProcedureTransitionsCount;
|
||||||
|
public int ProcedureTransitionsCount
|
||||||
|
{
|
||||||
|
get { return _ProcedureTransitionsCount; }
|
||||||
|
}
|
||||||
|
private int _ItemID;
|
||||||
|
public int ItemID
|
||||||
|
{
|
||||||
|
get { return _ItemID; }
|
||||||
|
set { _ItemID = value; }
|
||||||
|
}
|
||||||
|
#region Factory Methods
|
||||||
|
public static int Execute(int itemID)
|
||||||
|
{
|
||||||
|
ProcedureTransitionsCountCommand cmd = new ProcedureTransitionsCountCommand();
|
||||||
|
cmd.ItemID = itemID;
|
||||||
|
cmd = DataPortal.Execute<ProcedureTransitionsCountCommand>(cmd);
|
||||||
|
return cmd.ProcedureTransitionsCount;
|
||||||
|
}
|
||||||
|
private ProcedureTransitionsCountCommand()
|
||||||
|
{ /* require use of factory methods */ }
|
||||||
|
#endregion
|
||||||
|
#region Server-Side code
|
||||||
|
protected override void DataPortal_Execute()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||||
|
{
|
||||||
|
using (SqlCommand cmd = new SqlCommand("vesp_ProcedureTransitionsCount", cn))
|
||||||
|
{
|
||||||
|
cmd.CommandType = CommandType.StoredProcedure;
|
||||||
|
cmd.Parameters.AddWithValue("ItemID", _ItemID);
|
||||||
|
_ProcedureTransitionsCount = (int)cmd.ExecuteScalar();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("ProcedureTransitionsCountCommand Error", ex);
|
||||||
|
throw new ApplicationException("Failure on ProcedureTransitionsCountCommand", ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
#region Procedure
|
#region Procedure
|
||||||
[Serializable()]
|
[Serializable()]
|
||||||
|
@ -11,6 +11,14 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
public partial class TransitionInfo
|
public partial class TransitionInfo
|
||||||
{
|
{
|
||||||
|
//for transition search
|
||||||
|
private int _Level = 0;
|
||||||
|
public int Level
|
||||||
|
{
|
||||||
|
get { return _Level; }
|
||||||
|
set { _Level = value; }
|
||||||
|
}
|
||||||
|
//end for transition search
|
||||||
private bool _NewTransToUnNumberedItem = false;
|
private bool _NewTransToUnNumberedItem = false;
|
||||||
public bool NewTransToUnNumberedItem
|
public bool NewTransToUnNumberedItem
|
||||||
{
|
{
|
||||||
@ -144,6 +152,75 @@ namespace VEPROMS.CSLA.Library
|
|||||||
#region AffectedTransitons
|
#region AffectedTransitons
|
||||||
public partial class TransitionInfoList
|
public partial class TransitionInfoList
|
||||||
{
|
{
|
||||||
|
//transition report stuff
|
||||||
|
public static TransitionInfoList GetTransitionReportData(int versionID, int procedureID)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
TransitionInfoList tmp = DataPortal.Fetch<TransitionInfoList>(new TransitionReportDataCriteria(versionID, procedureID));
|
||||||
|
return tmp;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new DbCslaException("Error on TransitionInfoList.GetTransitionReportData", ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
[Serializable()]
|
||||||
|
protected class TransitionReportDataCriteria
|
||||||
|
{
|
||||||
|
private int _VersionID;
|
||||||
|
public int VersionID
|
||||||
|
{
|
||||||
|
get { return _VersionID; }
|
||||||
|
}
|
||||||
|
private int _ProcedureID;
|
||||||
|
public int ProcedureID
|
||||||
|
{
|
||||||
|
get { return _ProcedureID; }
|
||||||
|
}
|
||||||
|
public TransitionReportDataCriteria(int versionID, int procedureID)
|
||||||
|
{
|
||||||
|
_VersionID = versionID;
|
||||||
|
_ProcedureID = procedureID;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void DataPortal_Fetch(TransitionReportDataCriteria criteria)
|
||||||
|
{
|
||||||
|
this.RaiseListChangedEvents = false;
|
||||||
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] TransitionInfoList.DataPortal_Fetch", GetHashCode());
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||||
|
{
|
||||||
|
using (SqlCommand cm = cn.CreateCommand())
|
||||||
|
{
|
||||||
|
cm.CommandType = CommandType.StoredProcedure;
|
||||||
|
cm.CommandText = "vesp_GetTransitionReportData";
|
||||||
|
cm.Parameters.AddWithValue("@VersionID", criteria.VersionID);
|
||||||
|
cm.Parameters.AddWithValue("@ProcedureID", criteria.ProcedureID);
|
||||||
|
cm.CommandTimeout = Database.DefaultTimeout;
|
||||||
|
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
|
||||||
|
{
|
||||||
|
IsReadOnly = false;
|
||||||
|
while (dr.Read())
|
||||||
|
{
|
||||||
|
TransitionInfo ti = new TransitionInfo(dr);
|
||||||
|
ti.Level = dr.GetInt32("level");
|
||||||
|
this.Add(ti);
|
||||||
|
}
|
||||||
|
IsReadOnly = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("TransitionInfoList.DataPortal_Fetch", ex);
|
||||||
|
throw new DbCslaException("TransitionInfoList.DataPortal_Fetch", ex);
|
||||||
|
}
|
||||||
|
this.RaiseListChangedEvents = true;
|
||||||
|
}
|
||||||
|
//end transition report stuff
|
||||||
[Serializable()]
|
[Serializable()]
|
||||||
private class AffectedTransitonsCriteria
|
private class AffectedTransitonsCriteria
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user