This commit is contained in:
parent
0c73a98273
commit
a3208ccff6
@ -499,14 +499,14 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
#endregion
|
||||
#region IsType
|
||||
public bool IsCautionStructure
|
||||
public bool IsFirstCautionPart
|
||||
{
|
||||
get
|
||||
{
|
||||
return ((ItemPartCount > 0) && (ItemParts[0].PartType == E_FromType.Caution));
|
||||
}
|
||||
}
|
||||
public bool IsNoteStructure
|
||||
public bool IsFirstNotePart
|
||||
{
|
||||
get
|
||||
{
|
||||
@ -514,14 +514,14 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsCautionStructureFirstSib
|
||||
public bool IsCautionPart
|
||||
{
|
||||
get
|
||||
{
|
||||
return ((FirstSibling.ItemPartCount > 0) && (FirstSibling.ItemParts[0].PartType == E_FromType.Caution));
|
||||
}
|
||||
}
|
||||
public bool IsNoteStructureFirstSib
|
||||
public bool IsNotePart
|
||||
{
|
||||
get
|
||||
{
|
||||
@ -657,7 +657,14 @@ namespace VEPROMS.CSLA.Library
|
||||
return false;
|
||||
}
|
||||
}
|
||||
public bool IsRNO
|
||||
public bool IsTablePart
|
||||
{
|
||||
get
|
||||
{
|
||||
return ((ItemPartCount > 0) && (ItemParts[0].PartType == E_FromType.Table));
|
||||
}
|
||||
}
|
||||
public bool IsRNOPart
|
||||
{
|
||||
get
|
||||
{
|
||||
@ -669,7 +676,7 @@ namespace VEPROMS.CSLA.Library
|
||||
get
|
||||
{
|
||||
if (IsHigh) return false;
|
||||
if (IsRNO) return true;
|
||||
if (IsRNOPart) return true;
|
||||
ItemInfo parent = ActiveParent as ItemInfo;
|
||||
if (parent == null) return false;
|
||||
return parent.IsInRNO;
|
||||
@ -681,7 +688,7 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
get
|
||||
{
|
||||
return ((IsProcedure || IsSection || IsHigh)?0:(IsRNO?1:0)+((ItemInfo)ActiveParent).RNOLevel);
|
||||
return ((IsProcedure || IsSection || IsHigh)?0:(IsRNOPart?1:0)+((ItemInfo)ActiveParent).RNOLevel);
|
||||
}
|
||||
}
|
||||
public int ColumnMode
|
||||
@ -756,12 +763,25 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
#endregion
|
||||
#region More IsType
|
||||
public bool IsSubStep
|
||||
public bool IsProcedurePart
|
||||
{
|
||||
get
|
||||
{
|
||||
ItemInfo temp = FirstSibling;
|
||||
return ((temp.ItemPartCount > 0) && (temp.ItemParts[0].PartType == E_FromType.Step));
|
||||
return ((FirstSibling.ItemPartCount > 0) && (FirstSibling.ItemParts[0].PartType == E_FromType.Procedure));
|
||||
}
|
||||
}
|
||||
public bool IsSectionPart
|
||||
{
|
||||
get
|
||||
{
|
||||
return ((FirstSibling.ItemPartCount > 0) && (FirstSibling.ItemParts[0].PartType == E_FromType.Section));
|
||||
}
|
||||
}
|
||||
public bool IsStepPart
|
||||
{
|
||||
get
|
||||
{
|
||||
return ((FirstSibling.ItemPartCount > 0) && (FirstSibling.ItemParts[0].PartType == E_FromType.Step));
|
||||
}
|
||||
}
|
||||
public bool IsInSubStep
|
||||
@ -769,7 +789,7 @@ namespace VEPROMS.CSLA.Library
|
||||
get
|
||||
{
|
||||
if (IsHigh) return false;
|
||||
if (IsSubStep) return true;
|
||||
if (IsStepPart) return true;
|
||||
ItemInfo parent = ActiveParent as ItemInfo;
|
||||
if (parent == null) return false;
|
||||
return parent.IsInSubStep;
|
||||
@ -781,8 +801,9 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
ItemInfo temp = FirstSibling;
|
||||
if(temp.ActiveParent.GetType() == typeof(VEPROMS.CSLA.Library.DocVersionInfo))return false;
|
||||
if (temp.MyParent.IsSection) return false; // already at hls
|
||||
while (((ItemInfo)temp.ActiveParent).IsHigh == false) temp = ((ItemInfo)temp.ActiveParent).FirstSibling;
|
||||
return temp.IsSubStep;
|
||||
return temp.IsStepPart;
|
||||
}
|
||||
}
|
||||
public bool IsStepSection
|
||||
@ -1532,7 +1553,7 @@ namespace VEPROMS.CSLA.Library
|
||||
int stepType = (int)(MyContent.Type % 10000);
|
||||
string tbformat = IsInRNO ? FormatStepData.TabData.RNOIdentPrint : FormatStepData.TabData.IdentPrint;
|
||||
// rno gets parent tab
|
||||
if (IsRNO)
|
||||
if (IsRNOPart)
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -1565,7 +1586,7 @@ namespace VEPROMS.CSLA.Library
|
||||
//if (par.IsRNO) // do I need to save 'lastrnoptr'
|
||||
//if (!IsRNO(ptr) && (IsSequential(ptr) ||
|
||||
// (!IsText(ptr) && CountAllSubLevels))) - Add this line of code for non-hlp
|
||||
if (!par.IsRNO && par.IsSequential) level++;
|
||||
if (!par.IsRNOPart && par.IsSequential) level++;
|
||||
par = par.MyParent;
|
||||
}
|
||||
SeqTabFmtList seqtabs = ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.SeqTabFmtList;
|
||||
|
@ -41,13 +41,13 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
ItemInfo parentItem = ActiveParent as ItemInfo;
|
||||
if (parentItem == null) return null;
|
||||
if (IsCautionStructureFirstSib) return parentItem.SearchNextSkip(SkipPartType.Caution);
|
||||
if (IsNoteStructureFirstSib) return parentItem.SearchNextSkip(SkipPartType.Note);
|
||||
if (IsRNO) return parentItem.SearchNextSkip(SkipPartType.RNO);
|
||||
if (IsTable) return parentItem.SearchNextSkip(SkipPartType.Table);
|
||||
if (IsProcedure) return parentItem.SearchNextSkip(SkipPartType.Procedures);
|
||||
if (IsSection) return parentItem.SearchNextSkip(SkipPartType.Sections);
|
||||
if (IsStep) return parentItem.SearchNextSkip(SkipPartType.Steps);
|
||||
if (IsCautionPart) return parentItem.SearchNextSkip(SkipPartType.Caution);
|
||||
if (IsNotePart) return parentItem.SearchNextSkip(SkipPartType.Note);
|
||||
if (IsRNOPart) return parentItem.SearchNextSkip(SkipPartType.RNO);
|
||||
if (IsTablePart) return parentItem.SearchNextSkip(SkipPartType.Table);
|
||||
if (IsProcedurePart) return parentItem.SearchNextSkip(SkipPartType.Procedures);
|
||||
if (IsSectionPart) return parentItem.SearchNextSkip(SkipPartType.Sections);
|
||||
if (IsStepPart) return parentItem.SearchNextSkip(SkipPartType.Steps);
|
||||
if (parentItem.NextItem != null) return parentItem.NextItem.SearchTop;
|
||||
return parentItem.UpOneNext;
|
||||
}
|
||||
@ -90,13 +90,13 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
ItemInfo parentItem = ActiveParent as ItemInfo;
|
||||
if (parentItem == null) return null;
|
||||
if (IsCautionStructureFirstSib) return parentItem.SearchPrevSkip(SkipPartType.Caution);
|
||||
if (IsNoteStructureFirstSib) return parentItem.SearchPrevSkip(SkipPartType.Note);
|
||||
if (IsRNO) return parentItem.SearchPrevSkip(SkipPartType.RNO);
|
||||
if (IsTable) return parentItem.SearchPrevSkip(SkipPartType.Table);
|
||||
if (IsProcedure) return parentItem.SearchPrevSkip(SkipPartType.Procedures);
|
||||
if (IsSection) return parentItem.SearchPrevSkip(SkipPartType.Sections);
|
||||
if (IsStep) return parentItem.SearchPrevSkip(SkipPartType.Steps);
|
||||
if (IsCautionPart) return parentItem.SearchPrevSkip(SkipPartType.Caution);
|
||||
if (IsNotePart) return parentItem.SearchPrevSkip(SkipPartType.Note);
|
||||
if (IsRNOPart) return parentItem.SearchPrevSkip(SkipPartType.RNO);
|
||||
if (IsTablePart) return parentItem.SearchPrevSkip(SkipPartType.Table);
|
||||
if (IsProcedurePart) return parentItem.SearchPrevSkip(SkipPartType.Procedures);
|
||||
if (IsSectionPart) return parentItem.SearchPrevSkip(SkipPartType.Sections);
|
||||
if (IsStepPart) return parentItem.SearchPrevSkip(SkipPartType.Steps);
|
||||
if (parentItem.MyPrevious != null) return parentItem.MyPrevious.SearchTop;
|
||||
return parentItem.UpOnePrev;
|
||||
}
|
||||
|
@ -268,6 +268,70 @@ namespace VEPROMS.CSLA.Library
|
||||
return tmp;
|
||||
}
|
||||
#endregion
|
||||
#region PasteSiblingBefore
|
||||
public ItemInfo PasteSiblingBefore(int copyStartID)
|
||||
{
|
||||
// To determine 'type' of pasted item, if it's a step (type >=20000), use the originating
|
||||
// item, i.e. item inserting after. If it's a section or procedure, use the copied item's type.
|
||||
ItemInfo cpItem = ItemInfo.Get(copyStartID);
|
||||
int? type = MyContent.Type >= 20000 ? MyContent.Type : cpItem.MyContent.Type;
|
||||
ItemInfo tmp = CopyPasteItemInfoFetch(copyStartID, this.ItemID, type, type, EAddpingPart.Before);
|
||||
using (Item item = Get()) ItemInfo.Refresh(item);
|
||||
tmp.UpdateTransitionText();
|
||||
tmp.UpdatePastedStepTransitionText();
|
||||
OnNewSiblingBefore(new ItemInfoInsertEventArgs(tmp, EAddpingPart.Before));
|
||||
return tmp;
|
||||
}
|
||||
public ItemInfo PasteSiblingAfter(int copyStartID)
|
||||
{
|
||||
// To determine 'type' of pasted item, if it's a step (type >=20000), use the originating
|
||||
// item, i.e. item inserting after. If it's a section or procedure, use the copied item's type.
|
||||
ItemInfo cpItem = ItemInfo.Get(copyStartID);
|
||||
int? type = MyContent.Type >= 20000 ? MyContent.Type : cpItem.MyContent.Type;
|
||||
ItemInfo tmp = CopyPasteItemInfoFetch(copyStartID, this.ItemID, type, type, EAddpingPart.After);
|
||||
using (Item item = Get()) ItemInfo.Refresh(item);
|
||||
if (tmp.NextItem != null) using (Item item = tmp.NextItem.Get()) ItemInfo.Refresh(item);
|
||||
RefreshNextItems();
|
||||
// if inserting after a caution or note, refreshes tabs. This will adjust bullets
|
||||
// of any previous cautions or notes.
|
||||
if (tmp.IsCaution || tmp.IsNote) ResetOrdinal();
|
||||
tmp.UpdateTransitionText();
|
||||
tmp.UpdatePastedStepTransitionText();
|
||||
OnNewSiblingAfter(new ItemInfoInsertEventArgs(tmp, EAddpingPart.After));
|
||||
return tmp;
|
||||
}
|
||||
private ItemInfo CopyPasteItemInfoFetch(int copyStartID, int itemID, int? type, int? fromType, EAddpingPart addType)
|
||||
{
|
||||
ItemInfo tmp=null;
|
||||
if (addType == EAddpingPart.Child) // has to add in child relationship - uses 'fromtype'
|
||||
{
|
||||
// adding children. Type is based on 'fromType'
|
||||
switch ((E_FromType)fromType)
|
||||
{
|
||||
case E_FromType.Procedure:
|
||||
tmp = DataPortal.Fetch<ProcedureInfo>(new PastingPartCriteria(copyStartID, itemID, addType, type, fromType, DateTime.Now, Environment.UserName));
|
||||
break;
|
||||
case E_FromType.Section:
|
||||
tmp = DataPortal.Fetch<SectionInfo>(new PastingPartCriteria(copyStartID, itemID, addType, type, fromType, DateTime.Now, Environment.UserName));
|
||||
break;
|
||||
default:
|
||||
tmp = DataPortal.Fetch<StepInfo>(new PastingPartCriteria(copyStartID, itemID, addType, type, fromType, DateTime.Now, Environment.UserName));
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (GetType() == typeof(ProcedureInfo))
|
||||
tmp = DataPortal.Fetch<ProcedureInfo>(new PastingPartCriteria(copyStartID, itemID, addType, type, fromType, DateTime.Now, Environment.UserName));
|
||||
else if (GetType() == typeof(SectionInfo))
|
||||
tmp = DataPortal.Fetch<SectionInfo>(new PastingPartCriteria(copyStartID, itemID, addType, type, fromType, DateTime.Now, Environment.UserName));
|
||||
else
|
||||
tmp = DataPortal.Fetch<StepInfo>(new PastingPartCriteria(copyStartID, itemID, addType, type, fromType, DateTime.Now, Environment.UserName));
|
||||
}
|
||||
return tmp;
|
||||
|
||||
}
|
||||
#endregion
|
||||
#region Insert After
|
||||
public ItemInfo InsertSiblingAfter(string text)
|
||||
{
|
||||
@ -293,6 +357,7 @@ namespace VEPROMS.CSLA.Library
|
||||
OnNewSiblingAfter(new ItemInfoInsertEventArgs(tmp, EAddpingPart.After));
|
||||
return tmp;
|
||||
}
|
||||
|
||||
private ItemInfo NewItemInfoFetch(int itemID, EAddpingPart addType, string number, string text, int? type, int? fromType, int? formatID, string config, DateTime dts, string userID)
|
||||
{
|
||||
ItemInfo tmp;
|
||||
@ -344,6 +409,25 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
}
|
||||
}
|
||||
public void UpdatePastedStepTransitionText()
|
||||
{
|
||||
// Get a list of all of the transitions included in this step & its children.
|
||||
// Their transition text may have been affected, i.e. depending on the format, etc
|
||||
using (TransitionInfoList trans = TransitionInfoList.GetPastedAffected(this.ItemID))
|
||||
{
|
||||
foreach (TransitionInfo tran in trans)
|
||||
{
|
||||
using (Content content = tran.MyContent.Get())
|
||||
{
|
||||
content.FixTransitionText(tran);
|
||||
if (content.IsDirty)
|
||||
content.Save();
|
||||
else // Update ContentInfo objects to reflect the change in the transition
|
||||
ContentInfo.Refresh(content);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
#region Insert Child
|
||||
public ItemInfo InsertChild(E_FromType fromType, int type, string text)
|
||||
@ -364,6 +448,64 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
#endregion
|
||||
#region DataPortal
|
||||
private void DataPortal_Fetch(PastingPartCriteria criteria)
|
||||
{
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ItemInfo.DataPortal_Fetch", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
{
|
||||
ApplicationContext.LocalContext["cn"] = cn;
|
||||
using (SqlCommand cm = cn.CreateCommand())
|
||||
{
|
||||
cm.CommandType = CommandType.StoredProcedure;
|
||||
cm.Parameters.AddWithValue("@StartItemID", criteria.StartItemID);
|
||||
cm.Parameters.AddWithValue("@ItemID", criteria.ItemID); //ABC After Before Child
|
||||
cm.Parameters.AddWithValue("@Type", criteria.Type); //ABC
|
||||
cm.Parameters.AddWithValue("@DTS", criteria.DTS); //ABC
|
||||
cm.Parameters.AddWithValue("@UserID", criteria.UserID); //ABC
|
||||
SqlParameter param_ContentID = new SqlParameter("@NewItemID", SqlDbType.Int);
|
||||
param_ContentID.Direction = ParameterDirection.Output;
|
||||
cm.Parameters.Add(param_ContentID);
|
||||
switch (criteria.AddType)
|
||||
{
|
||||
case EAddpingPart.Child:
|
||||
//cm.CommandText = "addItemChild";
|
||||
//cm.Parameters.AddWithValue("@FromType", criteria.FromType); //--C
|
||||
break;
|
||||
case EAddpingPart.Before:
|
||||
cm.CommandText = "PasteItemSiblingBefore";
|
||||
break;
|
||||
case EAddpingPart.After:
|
||||
cm.CommandText = "PasteItemSiblingAfter";
|
||||
break;
|
||||
case EAddpingPart.Replace:
|
||||
cm.CommandText = "PasteItemReplace";
|
||||
break;
|
||||
}
|
||||
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
|
||||
{
|
||||
//newItemID = (int)cm.Parameters["@newContentID"].Value;
|
||||
if (!dr.Read())
|
||||
{
|
||||
_ErrorMessage = "No Record Found";
|
||||
return;
|
||||
}
|
||||
ReadData(dr);
|
||||
}
|
||||
}
|
||||
// removing of item only needed for local data portal
|
||||
if (ApplicationContext.ExecutionLocation == ApplicationContext.ExecutionLocations.Client)
|
||||
ApplicationContext.LocalContext.Remove("cn");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("ItemInfo.DataPortal_Fetch", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("ItemInfo.DataPortal_Fetch", ex);
|
||||
}
|
||||
}
|
||||
private void DataPortal_Fetch(AddingPartCriteria criteria)
|
||||
{
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ItemInfo.DataPortal_Fetch", GetHashCode());
|
||||
@ -423,6 +565,74 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
#region PastingPartCriteria
|
||||
[Serializable()]
|
||||
public class PastingPartCriteria
|
||||
{
|
||||
#region Properties
|
||||
private int _StartItemID;
|
||||
public int StartItemID
|
||||
{
|
||||
get { return _StartItemID; }
|
||||
set { _StartItemID = value; }
|
||||
}
|
||||
//private int _CopyEndID;
|
||||
//public int CopyEndID
|
||||
//{
|
||||
// get { return _CopyEndID; }
|
||||
// set { _CopyEndID = value; }
|
||||
//}
|
||||
private int _ItemID; // paste relative to this itemid
|
||||
public int ItemID
|
||||
{
|
||||
get { return _ItemID; }
|
||||
set { _ItemID = value; }
|
||||
}
|
||||
private EAddpingPart _AddType;
|
||||
public EAddpingPart AddType
|
||||
{
|
||||
get { return _AddType; }
|
||||
set { _AddType = value; }
|
||||
}
|
||||
private int? _FromType = null;
|
||||
public int? FromType
|
||||
{
|
||||
get { return _FromType; }
|
||||
set { _FromType = value; }
|
||||
}
|
||||
private int? _Type = null;
|
||||
public int? Type
|
||||
{
|
||||
get { return _Type; }
|
||||
set { _Type = value; }
|
||||
}
|
||||
private DateTime _DTS;
|
||||
public DateTime DTS
|
||||
{
|
||||
get { return _DTS; }
|
||||
set { _DTS = value; }
|
||||
}
|
||||
private string _UserID;
|
||||
public string UserID
|
||||
{
|
||||
get { return _UserID; }
|
||||
set { _UserID = value; }
|
||||
}
|
||||
#endregion
|
||||
#region Constructor
|
||||
public PastingPartCriteria(int startItemid, int itemID, EAddpingPart addType, int? type, int? fromType, DateTime dts, string userID)
|
||||
{
|
||||
_StartItemID = startItemid;
|
||||
_ItemID = itemID;
|
||||
_AddType = addType;
|
||||
_Type = type;
|
||||
_FromType = fromType;
|
||||
_DTS = dts;
|
||||
_UserID = userID;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
[Serializable()]
|
||||
protected class AddingPartCriteria
|
||||
{
|
||||
@ -508,7 +718,8 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
Child=0,
|
||||
Before=1,
|
||||
After=2
|
||||
After=2,
|
||||
Replace=3
|
||||
}
|
||||
public ItemInfo NextItem
|
||||
{
|
||||
@ -731,5 +942,55 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
#region PasteReplace
|
||||
public static ItemInfo PasteReplace(ItemInfo itemInfo, int copyStartID)
|
||||
{
|
||||
if (!CanDeleteObject())
|
||||
throw new System.Security.SecurityException("User not authorized to remove a Item");
|
||||
ItemInfo newItemInfo = CopyPasteReplaceItemInfoFetch(copyStartID, itemInfo); //itemInfo.ItemID, itemInfo.MyContent.Type, itemInfo.MyContent.Type);
|
||||
// Delete business objects, including remove from tree
|
||||
ItemInfo.DeleteItemInfoAndChildren(itemInfo.ItemID); // Dispose ItemInfo and Children
|
||||
using (Item item = Get(newItemInfo.ItemID)) ItemInfo.Refresh(item);
|
||||
if (newItemInfo.NextItem != null) using (Item item = newItemInfo.NextItem.Get()) ItemInfo.Refresh(item);
|
||||
newItemInfo.RefreshNextItems();
|
||||
// if inserting after a caution or note, refreshes tabs. This will adjust bullets
|
||||
// of any previous cautions or notes.
|
||||
if (newItemInfo.IsCaution || newItemInfo.IsNote) newItemInfo.ResetOrdinal();
|
||||
newItemInfo.UpdateTransitionText();
|
||||
newItemInfo.UpdatePastedStepTransitionText();
|
||||
// Add to tree
|
||||
if (newItemInfo.NextItemCount > 0)
|
||||
{
|
||||
using (ItemInfo itm = ItemInfo.Get(newItemInfo.NextItem.ItemID))
|
||||
{
|
||||
itm.OnNewSiblingBefore(new ItemInfoInsertEventArgs(newItemInfo, ItemInfo.EAddpingPart.Before));
|
||||
}
|
||||
}
|
||||
else if (newItemInfo.PreviousID != null)
|
||||
{
|
||||
using (ItemInfo itm2 = ItemInfo.Get((int)newItemInfo.PreviousID))
|
||||
{
|
||||
itm2.OnNewSiblingAfter(new ItemInfoInsertEventArgs(newItemInfo, ItemInfo.EAddpingPart.After));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
newItemInfo.MyParent.OnNewChild(new ItemInfoInsertEventArgs(newItemInfo, ItemInfo.EAddpingPart.Child));
|
||||
}
|
||||
return newItemInfo;
|
||||
}
|
||||
private static ItemInfo CopyPasteReplaceItemInfoFetch(int copyStartID, ItemInfo itemInfo) // int itemID, int? type, int? fromType)
|
||||
{
|
||||
ItemInfo tmp = null;
|
||||
if (itemInfo.GetType() == typeof(ProcedureInfo))
|
||||
tmp = DataPortal.Fetch<ProcedureInfo>(new ItemInfo.PastingPartCriteria(copyStartID, itemInfo.ItemID, ItemInfo.EAddpingPart.Replace, itemInfo.MyContent.Type, itemInfo.MyContent.Type, DateTime.Now, Environment.UserName));
|
||||
else if (itemInfo.GetType() == typeof(SectionInfo))
|
||||
tmp = DataPortal.Fetch<SectionInfo>(new ItemInfo.PastingPartCriteria(copyStartID, itemInfo.ItemID, ItemInfo.EAddpingPart.Replace, itemInfo.MyContent.Type, itemInfo.MyContent.Type, DateTime.Now, Environment.UserName));
|
||||
else
|
||||
tmp = DataPortal.Fetch<StepInfo>(new ItemInfo.PastingPartCriteria(copyStartID, itemInfo.ItemID, ItemInfo.EAddpingPart.Replace, itemInfo.MyContent.Type, itemInfo.MyContent.Type, DateTime.Now, Environment.UserName));
|
||||
|
||||
return tmp;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
@ -218,6 +218,64 @@ namespace VEPROMS.CSLA.Library
|
||||
this.RaiseListChangedEvents = true;
|
||||
}
|
||||
#endregion
|
||||
#region PastedAffectedTransitions
|
||||
private class PastedAffectedTransitonsCriteria
|
||||
{
|
||||
public PastedAffectedTransitonsCriteria(int itemID)
|
||||
{
|
||||
_ItemID = itemID;
|
||||
}
|
||||
private int _ItemID;
|
||||
public int ItemID
|
||||
{
|
||||
get { return _ItemID; }
|
||||
set { _ItemID = value; }
|
||||
}
|
||||
}
|
||||
internal static TransitionInfoList GetPastedAffected(int itemID)
|
||||
{
|
||||
try
|
||||
{
|
||||
TransitionInfoList tmp = DataPortal.Fetch<TransitionInfoList>(new PastedAffectedTransitonsCriteria(itemID));
|
||||
TransitionInfo.AddList(tmp);
|
||||
tmp.AddEvents();
|
||||
return tmp;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new DbCslaException("Error on TransitionInfoList.GetPastedAffected", ex);
|
||||
}
|
||||
}
|
||||
private void DataPortal_Fetch(PastedAffectedTransitonsCriteria criteria)
|
||||
{
|
||||
this.RaiseListChangedEvents = false;
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] TransitionInfoList.DataPortal_FetchPastedAffected", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
{
|
||||
using (SqlCommand cm = cn.CreateCommand())
|
||||
{
|
||||
cm.CommandType = CommandType.StoredProcedure;
|
||||
cm.CommandText = "getPastedAffectedTransitions";
|
||||
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_FetchPastedAffected", ex);
|
||||
throw new DbCslaException("TransitionInfoList.DataPortal_Fetch", ex);
|
||||
}
|
||||
this.RaiseListChangedEvents = true;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
public static class TransitionText
|
||||
{
|
||||
@ -381,7 +439,7 @@ namespace VEPROMS.CSLA.Library
|
||||
sret = StepInfo.Get(item.ItemID).MyTab.CleanText;
|
||||
if (!item.IsHigh)
|
||||
{
|
||||
if (item.IsRNO)
|
||||
if (item.IsRNOPart)
|
||||
{
|
||||
string mytb = sret.Trim(" .)".ToCharArray());
|
||||
if (mytb == null || mytb == "")
|
||||
@ -430,7 +488,7 @@ namespace VEPROMS.CSLA.Library
|
||||
private static bool AddIncludedStepNumber(bool textAdded, TransitionBuilder tb, string token, string nonToken)
|
||||
{
|
||||
if (textAdded) Append(tb, nonToken, false);
|
||||
Append(tb, "#", true); // TODO: Intermediate Range.
|
||||
Append(tb, Tab(tb._ToItem), true); // TODO: Intermediate Range.
|
||||
textAdded = true;
|
||||
return textAdded;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user