Enhanced Document support
Null check Move DisplayText.cs to CSLA Enhanced Documents – don’t allow ‘Save’ RO on enhanced step Enhanced Documents windowing Enhanced Documents remove unnecessary options Enhanced Documents – don’t allow ‘Save’ transition on enhanced step Enhanced Documents/Insert,Delete,Paste
This commit is contained in:
@@ -346,6 +346,23 @@ namespace VEPROMS.CSLA.Library
|
||||
if (this is ProcedureInfo) return this as ProcedureInfo;
|
||||
return ProcedureInfo.Get(ItemID);
|
||||
}
|
||||
private string _EnhType = null;
|
||||
public string EnhType
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_EnhType != null) return _EnhType;
|
||||
if (!IsSection)
|
||||
_EnhType = "";
|
||||
else
|
||||
{
|
||||
// get the section's enhtype from the config
|
||||
SectionConfig sc = MyConfig as SectionConfig;
|
||||
_EnhType = sc.Section_LnkEnh;
|
||||
}
|
||||
return _EnhType;
|
||||
}
|
||||
}
|
||||
public bool InList(params int[] IDs)
|
||||
{
|
||||
foreach (int id in IDs)
|
||||
@@ -356,6 +373,17 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
return _CacheByPrimaryKey.ContainsKey(itemID.ToString());
|
||||
}
|
||||
public static string ReplaceLinkWithNewID(string tmpForLink)
|
||||
{
|
||||
tmpForLink = Regex.Replace(tmpForLink, @"#Link:ReferencedObject:[0-9]+ ", @"#Link:ReferencedObject:<NewID> ");
|
||||
tmpForLink = Regex.Replace(tmpForLink, @"#Link:Transition:([0-9]+) [0-9]+ ", @"#Link:Transition:$1 <NewID> ");
|
||||
tmpForLink = Regex.Replace(tmpForLink, @"#Link:TransitionRange:([0-9]+) [0-9]+ ", @"#Link:TransitionRange:$1 <NewID> ");
|
||||
tmpForLink = tmpForLink.Replace(@"\u8212 \'96", @"-"); // Replace EM Dash with hyphen
|
||||
tmpForLink = tmpForLink.Replace(@"\u8211 \'96", @"-"); // Replace EN Dash with hyphen
|
||||
tmpForLink = tmpForLink.Replace(@"\u8212 ", @"-"); // Replace EM Dash with hyphen
|
||||
tmpForLink = tmpForLink.Replace(@"\u8211 ", @"-"); // Replace EN Dash with hyphen
|
||||
return tmpForLink;
|
||||
}
|
||||
public void SetHeader(VE_Font myFont, string myText)
|
||||
{
|
||||
_MyHeader = new MetaTag(myFont);
|
||||
@@ -552,36 +580,36 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public static void ResetTranCounters()
|
||||
{
|
||||
TranCheckCount = 0;
|
||||
TranFixCount = 0;
|
||||
}
|
||||
public static int TranCheckCount = 0;
|
||||
public static int TranFixCount = 0;
|
||||
}
|
||||
public static void ResetTranCounters()
|
||||
{
|
||||
TranCheckCount = 0;
|
||||
TranFixCount = 0;
|
||||
}
|
||||
public static int TranCheckCount = 0;
|
||||
public static int TranFixCount = 0;
|
||||
internal static TransitionInfoList TransitionsToDisconnected;
|
||||
internal static TransitionInfoList TransitionsToNonEditable;
|
||||
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);
|
||||
{
|
||||
//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();
|
||||
@@ -660,7 +688,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//private static bool IsTransitionToDisconnected(TransitionInfo ti)
|
||||
//{
|
||||
// foreach (TransitionInfo til in TransitionsToDisconnected)
|
||||
@@ -680,12 +708,12 @@ namespace VEPROMS.CSLA.Library
|
||||
return false;
|
||||
}
|
||||
public static void ResetROCounters()
|
||||
{
|
||||
ROCheckCount = 0;
|
||||
ROFixCount = 0;
|
||||
}
|
||||
public static int ROCheckCount = 0;
|
||||
public static int ROFixCount = 0;
|
||||
{
|
||||
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
|
||||
{
|
||||
@@ -732,30 +760,30 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
}
|
||||
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 (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);
|
||||
@@ -763,13 +791,13 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
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)
|
||||
content.Save();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
internal static void SetParentSectionAndDocVersionPageNum(ItemInfo itemInfo, IVEDrillDownReadOnly itemParent, SectionInfo sectionInfo, ProcedureInfo procInfo, DocVersionInfo docVersionInfo, TransitionLookup tranLookup)
|
||||
{
|
||||
if (itemInfo.MyContent.ContentPartCount > 0)
|
||||
{
|
||||
@@ -807,7 +835,7 @@ namespace VEPROMS.CSLA.Library
|
||||
internal static string GetCombinedTab(ItemInfo itemInfo, string parTab)
|
||||
{
|
||||
string pTab = parTab == null ? "" : parTab;
|
||||
int profileDepth = ProfileTimer.Push( ">>>> itemInfo.MyTab.CleanText.Trim");
|
||||
int profileDepth = ProfileTimer.Push(">>>> itemInfo.MyTab.CleanText.Trim");
|
||||
string thisTab = itemInfo.MyTab.CleanText.Trim();
|
||||
ProfileTimer.Pop(profileDepth);
|
||||
if (thisTab != null && thisTab != "" && !char.IsLetterOrDigit(thisTab[0])) return pTab;
|
||||
@@ -837,26 +865,26 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
if (docVersionInfo.DocVersionAssociationCount == 1)
|
||||
{
|
||||
ROFstInfo rofstinfo = docVersionInfo.DocVersionAssociations[0].MyROFst;
|
||||
//rofstinfo.docVer = docVersionInfo;
|
||||
ROFSTLookup lookup = rofstinfo.GetROFSTLookup(docVersionInfo);
|
||||
lookup.MyDocVersionInfo = docVersionInfo;
|
||||
//DateTime dts = DateTime.Now;
|
||||
if (itemInfo.MyContent.ContentGridCount > 0)
|
||||
itemInfo.MyContent.LoadNonCachedGrid();
|
||||
if (itemInfo.MyContent.ContentRoUsageCount > 0)
|
||||
{
|
||||
foreach (RoUsageInfo rousage in itemInfo.MyContent.ContentRoUsages)
|
||||
ROFstInfo rofstinfo = docVersionInfo.DocVersionAssociations[0].MyROFst;
|
||||
//rofstinfo.docVer = docVersionInfo;
|
||||
ROFSTLookup lookup = rofstinfo.GetROFSTLookup(docVersionInfo);
|
||||
lookup.MyDocVersionInfo = docVersionInfo;
|
||||
//DateTime dts = DateTime.Now;
|
||||
if (itemInfo.MyContent.ContentGridCount > 0)
|
||||
itemInfo.MyContent.LoadNonCachedGrid();
|
||||
if (itemInfo.MyContent.ContentRoUsageCount > 0)
|
||||
{
|
||||
if (sectionInfo != null)
|
||||
foreach (RoUsageInfo rousage in itemInfo.MyContent.ContentRoUsages)
|
||||
{
|
||||
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);
|
||||
if (sectionInfo != null)
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Force Error Message
|
||||
@@ -972,7 +1000,7 @@ namespace VEPROMS.CSLA.Library
|
||||
foreach (ItemInfo item in _CacheByPrimaryKey[key]) myCache.Add(item);
|
||||
foreach (ItemInfo item in myCache)
|
||||
item.OnOrdinalChange();
|
||||
}
|
||||
}
|
||||
}
|
||||
public bool IsFirstSubStep
|
||||
{
|
||||
@@ -1009,7 +1037,7 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
if (IsProcedure) return false;
|
||||
SectionConfig scfg = ActiveSection.MyConfig as SectionConfig;
|
||||
if (MyDocStyle.StructureStyle.Style == null || scfg == null) return false;
|
||||
if (MyDocStyle.StructureStyle.Style == null || scfg == null) return false;
|
||||
bool PlacekeepOption = ((ActiveFormat.PlantFormat.FormatData.PurchaseOptions & E_PurchaseOptions.AutoPlacekeeper) == E_PurchaseOptions.AutoPlacekeeper)
|
||||
&& scfg.Section_Placekeeper.Equals("Y");
|
||||
//return (PlacekeepOption && IsHigh);
|
||||
@@ -1170,7 +1198,7 @@ namespace VEPROMS.CSLA.Library
|
||||
else if (item.IsRNOPart)
|
||||
{
|
||||
level = (item.ActiveParent as ItemInfo).StepLevel + item.RNOLevel - item.ColumnMode;
|
||||
// RHM Change 20140522
|
||||
// RHM Change 20140522
|
||||
//level = (item.ActiveParent as ItemInfo).StepLevel;// +item.RNOLevel - item.ColumnMode;
|
||||
}
|
||||
return level;
|
||||
@@ -1434,11 +1462,11 @@ namespace VEPROMS.CSLA.Library
|
||||
private E_FromType? _FromType = null;
|
||||
public E_FromType? FromType
|
||||
{
|
||||
get
|
||||
get
|
||||
{
|
||||
if (ItemID == 95759 && _FromType == null)
|
||||
Console.WriteLine("\"Null FromType\",{0},{1},\"{2}\",{3}", ItemID, MyContent.Type,DisplayNumber,MyItemInfoUnique);
|
||||
return _FromType;
|
||||
Console.WriteLine("\"Null FromType\",{0},{1},\"{2}\",{3}", ItemID, MyContent.Type, DisplayNumber, MyItemInfoUnique);
|
||||
return _FromType;
|
||||
}
|
||||
set { _FromType = value; }
|
||||
}
|
||||
@@ -1447,7 +1475,7 @@ namespace VEPROMS.CSLA.Library
|
||||
get
|
||||
{
|
||||
if (FromType != null)
|
||||
return (MyPrevious == null && FromType == E_FromType.Caution);
|
||||
return (MyPrevious == null && FromType == E_FromType.Caution);
|
||||
return ((ItemPartCount > 0) && (ItemParts[0].PartType == E_FromType.Caution));
|
||||
}
|
||||
}
|
||||
@@ -1538,7 +1566,7 @@ namespace VEPROMS.CSLA.Library
|
||||
case 45: // Continuous Action AND sub-step
|
||||
case 46: // Continuous Action OR sub-step
|
||||
case 47: //Continuous Actoin Paragraph sub-step
|
||||
includeOnCAS = !sd.ExcludeFromContActSum; // if flag is not set then Automatically include this step/sub-step on the Continuous Action Summary
|
||||
includeOnCAS = !sd.ExcludeFromContActSum; // if flag is not set then Automatically include this step/sub-step on the Continuous Action Summary
|
||||
break;
|
||||
default:
|
||||
includeOnCAS = !sd.ExcludeFromContActSum; //false; // don't automatically include this step/sub-step on the Continuous Action Summary
|
||||
@@ -1684,10 +1712,10 @@ namespace VEPROMS.CSLA.Library
|
||||
if (MyContent.Type / 10000 != 2) _IsHigh = false;
|
||||
else
|
||||
{
|
||||
ItemInfo parent = ActiveParent as ItemInfo;
|
||||
ItemInfo parent = ActiveParent as ItemInfo;
|
||||
if (parent == null) _IsHigh = false;
|
||||
// IsHigh was returning true if this item is a caution or note off of a section..
|
||||
// from the (parent.MyContent.Type / 1000) == 1.
|
||||
// IsHigh was returning true if this item is a caution or note off of a section..
|
||||
// from the (parent.MyContent.Type / 1000) == 1.
|
||||
else if ((parent.MyContent.Type / 10000) != 1)
|
||||
_IsHigh = false;
|
||||
else if (IsCaution || IsNote) _IsHigh = false;
|
||||
@@ -1928,6 +1956,54 @@ namespace VEPROMS.CSLA.Library
|
||||
return ((FirstSibling.ItemPartCount > 0) && (FirstSibling.ItemParts[0].PartType == E_FromType.Step));
|
||||
}
|
||||
}
|
||||
public bool IsEnhancedStep
|
||||
{
|
||||
get
|
||||
{
|
||||
if (FormatStepData != null)
|
||||
{
|
||||
E_AccStep? actable = FormatStepData.StepEditData.AcTable;
|
||||
return (actable != null && MyActiveSection != null && MyActiveSection.IsEnhancedSection && ((actable & E_AccStep.EnhancedLinkedStep) != 0));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
public bool IsEnhancedSection
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!IsSection) return false;
|
||||
SectionConfig sc = MyConfig as SectionConfig;
|
||||
if (sc.MyEnhancedDocuments != null && sc.MyEnhancedDocuments.Count == 1 && sc.MyEnhancedDocuments[0].Type == 0) return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
public bool IsEnhancedSectionTitleOnly // this is an enhanced document (sectionitem) but only the title is linked.
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!IsSection) return false;
|
||||
SectionConfig sc = MyConfig as SectionConfig;
|
||||
// go back to source & see what type is:
|
||||
if (sc.MyEnhancedDocuments != null && sc.MyEnhancedDocuments.Count == 1 && sc.MyEnhancedDocuments[0].Type == 0)
|
||||
{
|
||||
SectionInfo siSource = SectionInfo.Get(sc.MyEnhancedDocuments[0].ItemID);
|
||||
SectionConfig scs = siSource.MyConfig as SectionConfig;
|
||||
if (scs.Section_LnkEnh == "T") return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
public bool IsEnhancedProcedure // this is NOT a source, it is enhanced, i.e. background or deviation
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!IsProcedure) return false;
|
||||
ProcedureConfig pc = MyConfig as ProcedureConfig;
|
||||
if (pc.MyEnhancedDocuments != null && pc.MyEnhancedDocuments.Count == 1 && pc.MyEnhancedDocuments[0].Type == 0) return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
public bool IsInSubStep
|
||||
{
|
||||
get
|
||||
@@ -2025,7 +2101,7 @@ namespace VEPROMS.CSLA.Library
|
||||
string myNumber = DisplayNumber;
|
||||
if (parNumber == null || myNumber == null) return false;
|
||||
ItemInfo par2 = par.ActiveParent as ItemInfo;
|
||||
if (par2 != null && par2.IsSection)
|
||||
if (par2 != null && par2.IsSection)
|
||||
{
|
||||
// check for 6.1 (parent) and 6.1.1.
|
||||
if (DisplayNumber.StartsWith((ActiveParent as SectionInfo).DisplayNumber.Trim())) return true;
|
||||
@@ -2072,7 +2148,7 @@ namespace VEPROMS.CSLA.Library
|
||||
return false;
|
||||
}
|
||||
}
|
||||
private E_FromType ItemType
|
||||
private E_FromType ItemType
|
||||
{
|
||||
get
|
||||
{
|
||||
@@ -2286,7 +2362,7 @@ namespace VEPROMS.CSLA.Library
|
||||
// str = str.Replace("<u>", MyDocVersion.DocVersionConfig.Unit_Number);
|
||||
//if (str.Contains("<U>"))
|
||||
// str = str.Replace("<U>", MyDocVersion.DocVersionConfig.Unit_Number);
|
||||
return ConvertToDisplayText(str,false);
|
||||
return ConvertToDisplayText(str, false);
|
||||
}
|
||||
}
|
||||
// Used in Comanche Peak EOP and Flex formats for step designators. Will allow a hard return to be used that that caution type.
|
||||
@@ -2406,7 +2482,7 @@ namespace VEPROMS.CSLA.Library
|
||||
public static string StripLinks(string rtf)
|
||||
{
|
||||
string retval = rtf;
|
||||
retval = Regex.Replace(retval, @"\\v.*?\\v0", "");
|
||||
retval = Regex.Replace(retval, @"\\v.*?\\v0 ?", "");
|
||||
retval = retval.Replace("\u252C", "");// Unicode 9516 Transition
|
||||
retval = retval.Replace("\u2566", "");// Unicode 9574 Transition
|
||||
retval = retval.Replace("\u0015", "");// Unicode 21 RO
|
||||
@@ -2851,7 +2927,7 @@ namespace VEPROMS.CSLA.Library
|
||||
return false; // No Change ID - No Change Bar
|
||||
if (sc.Step_CBOverride == null)
|
||||
return chg;
|
||||
return (sc.Step_CBOverride == "On");
|
||||
return (sc.Step_CBOverride == "On");
|
||||
}
|
||||
}
|
||||
public bool HasChanges
|
||||
@@ -3089,8 +3165,8 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_ActiveFormat == null || !PrintAllAtOnce) // jsj added check for NULL ActiveParent
|
||||
_ActiveFormat = (LocalFormat != null ? LocalFormat : (ActiveParent != null) ? ActiveParent.ActiveFormat : null);
|
||||
if (_ActiveFormat == null || !PrintAllAtOnce) // jsj added check for NULL ActiveParent
|
||||
_ActiveFormat = (LocalFormat != null ? LocalFormat : (ActiveParent != null) ? ActiveParent.ActiveFormat : null);
|
||||
//Console.WriteLine("Active {0}", (_ActiveFormat == null) ? "_ActiveFormat is null" : _ActiveFormat.Name);
|
||||
return _ActiveFormat;
|
||||
}
|
||||
@@ -3170,6 +3246,22 @@ namespace VEPROMS.CSLA.Library
|
||||
foreach (ItemInfo tmpInfo in _CacheByPrimaryKey[key])
|
||||
tmpInfo.MyConfig = null;
|
||||
}
|
||||
public EnhancedDocuments GetMyEnhancedDocuments()
|
||||
{
|
||||
switch (MyContent.Type / 10000)
|
||||
{
|
||||
case 0:
|
||||
ProcedureConfig pConfig = MyConfig as ProcedureConfig;
|
||||
return pConfig.MyEnhancedDocuments;
|
||||
case 1:
|
||||
SectionConfig sConfig = MyConfig as SectionConfig;
|
||||
return sConfig.MyEnhancedDocuments;
|
||||
case 2:
|
||||
StepConfig stConfig = MyConfig as StepConfig;
|
||||
return stConfig.MyEnhancedDocuments;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
//public bool HasStandardSteps()
|
||||
//{ return MyContent.ContentItemCount > 1; }
|
||||
public Color ForeColor
|
||||
@@ -3378,7 +3470,7 @@ namespace VEPROMS.CSLA.Library
|
||||
localPrintLevel = PrintLevel + ((ActiveFormat.PlantFormat.FormatData.Express && IsSequential) ? 0 : CurrentSectionLevel());
|
||||
if (!ActiveFormat.PlantFormat.FormatData.Express) doMeta = true;
|
||||
}
|
||||
if(sd.StepSectionLayoutData.TieTabToLevel && ActiveFormat.PlantFormat.FormatData.SectData.CountSubSectionsForLevel)
|
||||
if (sd.StepSectionLayoutData.TieTabToLevel && ActiveFormat.PlantFormat.FormatData.SectData.CountSubSectionsForLevel)
|
||||
if (SectionLevel() > 1)
|
||||
localPrintLevel += 1;
|
||||
SeqTabFmtList seqtabs = ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.SeqTabFmtList;
|
||||
@@ -3393,7 +3485,7 @@ namespace VEPROMS.CSLA.Library
|
||||
|
||||
// Check to be sure the parent tab should be included... If this sequential is within a note
|
||||
// or caution or equipment list, don't use parent tab AND always start the numbering as a numeric
|
||||
if (doMeta && IsSequential && (InNote() || InCaution() ||
|
||||
if (doMeta && IsSequential && (InNote() || InCaution() ||
|
||||
(MyParent.IsEquipmentList && !MyParent.FormatStepData.TabData.IdentPrint.Contains("{seq}"))))
|
||||
{
|
||||
// if immediate parent is note, caution or equip, use numeric, otherwise use alpha.
|
||||
@@ -3470,7 +3562,7 @@ namespace VEPROMS.CSLA.Library
|
||||
parentTab = myparent.MyTab.CleanText.Trim();
|
||||
if (((MyDocStyle.StructureStyle.Style & E_DocStructStyle.DSS_AddDotZeroStdHLS) == E_DocStructStyle.DSS_AddDotZeroStdHLS) && myparent.MyContent.Type == 20002)
|
||||
parentTab = parentTab.Replace(".0", ""); // this was added in, remove for substeps.
|
||||
tbformat = parentTab + (parentTab.EndsWith(".") ? "" : parentTab=="" ? "" : ".") + tbformat.TrimStart();
|
||||
tbformat = parentTab + (parentTab.EndsWith(".") ? "" : parentTab == "" ? "" : ".") + tbformat.TrimStart();
|
||||
}
|
||||
else if (IsSequential && ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.SkipNonSeqTabWithPar)
|
||||
{
|
||||
@@ -3524,7 +3616,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (!IsSection && !IsProcedure && tbformat.IndexOf("{Section Prefix}") >= 0)
|
||||
{
|
||||
string tmpsectpref = SectionPrefix(tbformat) ?? string.Empty;
|
||||
if (ActiveSection.MyTab.CleanText != null && ActiveSection.MyTab.CleanText != "" && tmpsectpref != string.Empty) trimTabStart = true;
|
||||
if (ActiveSection.MyTab!=null && ActiveSection.MyTab.CleanText != null && ActiveSection.MyTab.CleanText != "" && tmpsectpref != string.Empty) trimTabStart = true;
|
||||
tbformat = tbformat.Replace("{Section Prefix}", SectionPrefix(tbformat));
|
||||
if (tbformate != null) tbformate = tbformate.Replace("{Section Prefix}", SectionPrefix(tbformate));
|
||||
}
|
||||
@@ -3778,7 +3870,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (MyDocStyle != null && (MyDocStyle.StructureStyle.Style & E_DocStructStyle.DSS_SkipOneStepLevel) == E_DocStructStyle.DSS_SkipOneStepLevel)
|
||||
level++;
|
||||
if (MyDocStyle != null && (MyDocStyle.StructureStyle.Style & E_DocStructStyle.DSS_SkipTwoStepLevels) == E_DocStructStyle.DSS_SkipTwoStepLevels && level == 0)
|
||||
@@ -3912,7 +4004,7 @@ namespace VEPROMS.CSLA.Library
|
||||
// use of the MixCautionsAndNotes format flag - no bullet is used, if more that one replace the tab
|
||||
// with a bullet. Also, if only one in group and tab text ends with 'S', remove it:
|
||||
bool mixCandN = MixCautionNotesDiffType();
|
||||
if ((MyPrevious == null && (nextItem == null||specialCalvertAlarm)) || mixCandN || FormatStepData.SeparateBox)
|
||||
if ((MyPrevious == null && (nextItem == null || specialCalvertAlarm)) || mixCandN || FormatStepData.SeparateBox)
|
||||
{
|
||||
if (_MyHeader.CleanText.ToUpper().EndsWith("S"))
|
||||
{
|
||||
@@ -3949,10 +4041,10 @@ namespace VEPROMS.CSLA.Library
|
||||
// For calvert formats, if all tabs are null or empty, then don't add a bullet in.
|
||||
bool allnull = ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvert && (tbformat == null || tbformat == "") && (nextTbFormat == null || tbformat == "") && (prevTbFormat == null || prevTbFormat == "");
|
||||
if (!allnull && (tbformat == nextTbFormat || tbformat == prevTbFormat))
|
||||
{
|
||||
tbformat = ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.IdentB;
|
||||
TabToIdentBAdjustFont();
|
||||
}
|
||||
{
|
||||
tbformat = ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.IdentB;
|
||||
TabToIdentBAdjustFont();
|
||||
}
|
||||
else if ((nextTbFormat == null || tbformat != nextTbFormat) && (prevTbFormat == null || tbformat != prevTbFormat))
|
||||
{
|
||||
tbformat = "";
|
||||
@@ -3972,9 +4064,9 @@ namespace VEPROMS.CSLA.Library
|
||||
(MyPrevious != null && MyPrevious.MyContent.Type == MyContent.Type) ||
|
||||
(NextItem != null && nextItem.MyContent.Type == MyContent.Type))
|
||||
{
|
||||
tbformat = tbformat + ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.IdentB;
|
||||
TabToIdentBAdjustFont();
|
||||
}
|
||||
tbformat = tbformat + ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.IdentB;
|
||||
TabToIdentBAdjustFont();
|
||||
}
|
||||
}
|
||||
else if (FormatStepData.TabData.IsTransition)
|
||||
return tbformat;
|
||||
@@ -4027,9 +4119,9 @@ namespace VEPROMS.CSLA.Library
|
||||
// treat cautions and notes as different if they are all NOT exactly the same type
|
||||
if (ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.OnlyBulletSameCautionNoteType)
|
||||
{
|
||||
if (MyPrevious != null && MyPrevious.MyContent.Type != MyContent.Type &&
|
||||
if (MyPrevious != null && MyPrevious.MyContent.Type != MyContent.Type &&
|
||||
((MyPrevious.IsCaution && this.IsCaution) || (MyPrevious.IsNote && this.IsNote))) return true;
|
||||
if (NextItem != null && NextItem.MyContent.Type != MyContent.Type &&
|
||||
if (NextItem != null && NextItem.MyContent.Type != MyContent.Type &&
|
||||
((NextItem.IsCaution && this.IsCaution) || (NextItem.IsNote && this.IsNote))) return true;
|
||||
}
|
||||
|
||||
@@ -4132,6 +4224,55 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
#region EnhancedSupport
|
||||
public void ClearEnhancedSectionFromSource(int srcId)
|
||||
{
|
||||
using (Section ssrc = Section.Get(srcId))
|
||||
{
|
||||
SectionConfig ssrcc = ssrc.MyConfig as SectionConfig;
|
||||
EnhancedDocuments newEds = new EnhancedDocuments();
|
||||
foreach (EnhancedDocument ed in ssrcc.MyEnhancedDocuments)
|
||||
{
|
||||
if (ed.ItemID != ItemID) newEds.Add(ed);
|
||||
}
|
||||
if (newEds.Count > 0)
|
||||
{
|
||||
ssrcc.MyEnhancedDocuments = null;
|
||||
ssrcc.MyEnhancedDocuments = newEds;
|
||||
ssrcc.SaveEnhancedDocuments();
|
||||
ssrc.MyContent.Config = ssrcc.ToString();
|
||||
ssrc.Save();
|
||||
}
|
||||
}
|
||||
}
|
||||
public void ClearEnhancedSectionLink()
|
||||
{
|
||||
// for this source section, clear any enhanced flags in connected section
|
||||
// where the enhanced type is "T", i.e. title only
|
||||
if (!IsSection) return;
|
||||
SectionConfig sc = MyConfig as SectionConfig;
|
||||
if (sc.Section_LnkEnh != "T" || sc.MyEnhancedDocuments == null || sc.MyEnhancedDocuments.Count == 0) return;
|
||||
foreach (EnhancedDocument ed in sc.MyEnhancedDocuments)
|
||||
{
|
||||
using (Section s = Section.Get(ed.ItemID))
|
||||
{
|
||||
// have to get config from a SectionInfo, it is null off of this section (not sure why)
|
||||
SectionInfo si = SectionInfo.Get(ed.ItemID);
|
||||
SectionConfig esc = si.MyConfig as SectionConfig;
|
||||
esc.MyEnhancedDocuments.Clear();
|
||||
esc.SaveEnhancedDocuments();
|
||||
s.MyContent.Config = esc.ToString();
|
||||
s.Save();
|
||||
}
|
||||
}
|
||||
sc.Section_LnkEnh = null;
|
||||
using (Section mysect = Section.Get(ItemID))
|
||||
{
|
||||
mysect.MyContent.Config = sc.ToString();
|
||||
mysect.Save();
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
#region ParentNoteOrCaution
|
||||
private bool _ParentNoteOrCautionLoaded = false;
|
||||
private ItemInfo _ParentNoteOrCaution;
|
||||
@@ -4246,20 +4387,20 @@ namespace VEPROMS.CSLA.Library
|
||||
private int? _TemplateColumnMode = null;
|
||||
public int TemplateColumnMode
|
||||
{
|
||||
get
|
||||
get
|
||||
{
|
||||
if (_TemplateColumnMode == null)
|
||||
{
|
||||
ItemInfo pi = ActiveParent as ItemInfo;
|
||||
if (pi != null)
|
||||
{
|
||||
if (!pi.IsStep) // only steps are in template
|
||||
_TemplateColumnMode = -1;
|
||||
else if (pi.FormatStepData.UseOldTemplate)
|
||||
_TemplateColumnMode = pi.TemplateChildColumnMode;
|
||||
else
|
||||
_TemplateColumnMode = pi.TemplateColumnMode; // go up parents until find of columnmode or section
|
||||
}
|
||||
if (!pi.IsStep) // only steps are in template
|
||||
_TemplateColumnMode = -1;
|
||||
else if (pi.FormatStepData.UseOldTemplate)
|
||||
_TemplateColumnMode = pi.TemplateChildColumnMode;
|
||||
else
|
||||
_TemplateColumnMode = pi.TemplateColumnMode; // go up parents until find of columnmode or section
|
||||
}
|
||||
}
|
||||
return _TemplateColumnMode ?? -1;
|
||||
}
|
||||
@@ -4325,9 +4466,9 @@ namespace VEPROMS.CSLA.Library
|
||||
|
||||
// GetSmartTemplateIndex(int topIndx, string strtxt): Added for Calvert Alarms since their
|
||||
// template also uses the text, not just the type, to find a match in the template.
|
||||
public int GetSmartTemplateIndex(int topIndx, string strtxt)
|
||||
public int GetSmartTemplateIndex(int topIndx, string strtxt)
|
||||
{
|
||||
string txt = strtxt.Replace(@"\u160?"," ");
|
||||
string txt = strtxt.Replace(@"\u160?", " ");
|
||||
if (ActiveFormat == null) return -1;
|
||||
FormatData formatData = ActiveFormat.PlantFormat.FormatData;
|
||||
if (formatData.TopTemplateTypes == null || formatData.TopTemplateTypes.Count == 0) return -1;
|
||||
@@ -4338,7 +4479,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (txt == null && formatData.Templates[indx].type == (MyContent.Type - 20001)) return indx;
|
||||
// now see if we're on the topType, if so, look under this one for the step type
|
||||
// that we're on, the TEXT ALSO NEEDS TO MATCH. If found return the index of it.
|
||||
if (txt != null && formatData.Templates[indx].text!=null && (txt.Trim() == formatData.Templates[indx].text.Trim())
|
||||
if (txt != null && formatData.Templates[indx].text != null && (txt.Trim() == formatData.Templates[indx].text.Trim())
|
||||
&& ((MyContent.Type - 20001) == formatData.Templates[indx].type)) return indx;
|
||||
indx++;
|
||||
}
|
||||
@@ -4495,7 +4636,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
}
|
||||
#endregion ItemInfo
|
||||
#region Tab
|
||||
@@ -4564,7 +4705,7 @@ namespace VEPROMS.CSLA.Library
|
||||
get
|
||||
{
|
||||
// this trims off any symbols at the start of the tab
|
||||
return _ReplaceSymbols.Replace(CleanText, "").Replace("#","");
|
||||
return _ReplaceSymbols.Replace(CleanText, "").Replace("#", "");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5373,7 +5514,7 @@ namespace VEPROMS.CSLA.Library
|
||||
public string TranCategory { get { return _TranCategory; } }
|
||||
// added stepTypeList parameter to allow a transition search is selected step elements (B2015-055)
|
||||
private string _StepTypeList;
|
||||
public string StepTypeList { get { return _StepTypeList;} }
|
||||
public string StepTypeList { get { return _StepTypeList; } }
|
||||
public ItemListTransitionSearchCriteria(string docVersionList, int tranType, string tranCategory, string stepTypeList)
|
||||
{
|
||||
_DocVersionList = docVersionList;
|
||||
@@ -5635,6 +5776,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[Serializable()]
|
||||
public partial class ProcedureInfo : ItemInfo, IVEDrillDownReadOnly
|
||||
{
|
||||
public bool CreateEnhanced = false;
|
||||
public string PDFNumber
|
||||
{
|
||||
get
|
||||
@@ -5718,27 +5860,27 @@ namespace VEPROMS.CSLA.Library
|
||||
public new Procedure Get()
|
||||
{
|
||||
return (Procedure)(_Editable = Procedure.Get(ItemID));
|
||||
}
|
||||
}
|
||||
//public static void RefreshTransitions(ProcedureInfo tmp)
|
||||
//{
|
||||
// RefreshTransitions(tmp, null, null);
|
||||
//}
|
||||
public static void RefreshTransitions(ProcedureInfo tmp)//, TransitionInfoList transitionToDisconnected, TransitionInfoList transitionsToNonEditable)
|
||||
{
|
||||
{
|
||||
//TransitionsToDisconnected = transitionToDisconnected;
|
||||
//TransitionsToNonEditable = transitionsToNonEditable;
|
||||
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)
|
||||
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)
|
||||
{
|
||||
TransitionLookup tranLookup = new TransitionLookup(0, tmp.ItemID, tmp.MyLookup);
|
||||
tranLookup.ApplicabilityUnit = tmp.MyDocVersion.DocVersionConfig.SelectedSlave;
|
||||
@@ -6023,9 +6165,9 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
Database.LogException("ItemInfoList.DataPortal_Fetch", ex);
|
||||
throw new DbCslaException("ItemInfoList.DataPortal_Fetch", ex);
|
||||
}
|
||||
MyLookup = lookup;
|
||||
}
|
||||
}
|
||||
MyLookup = lookup;
|
||||
}
|
||||
}
|
||||
[Serializable()]
|
||||
public class ProcedureTransitionsCountCommand : CommandBase
|
||||
@@ -6144,7 +6286,7 @@ namespace VEPROMS.CSLA.Library
|
||||
private bool? _HasStepCheckOffs = null;
|
||||
public bool HasStepCheckOffs
|
||||
{
|
||||
get
|
||||
get
|
||||
{
|
||||
if (_HasStepCheckOffs == null)
|
||||
{
|
||||
@@ -6152,7 +6294,7 @@ namespace VEPROMS.CSLA.Library
|
||||
//Console.WriteLine("{0},'{1}','{2}'", ItemID, ShortPath, _HasStepCheckOffs);
|
||||
}
|
||||
return (bool)_HasStepCheckOffs;
|
||||
}
|
||||
}
|
||||
}
|
||||
public bool HasInitials
|
||||
{
|
||||
@@ -6166,10 +6308,10 @@ namespace VEPROMS.CSLA.Library
|
||||
private static bool GetStepCheckOff(ItemInfo ii)
|
||||
{
|
||||
if (ii is StepInfo && ((ii as StepInfo).MyConfig as StepConfig).Step_CheckOffIndex > 1) return true;
|
||||
if(ii.MyContent.ContentParts != null)
|
||||
foreach(PartInfo pi in ii.MyContent.ContentParts)
|
||||
foreach(ItemInfo iic in pi.MyItems)
|
||||
if(GetStepCheckOff(iic)) return true;
|
||||
if (ii.MyContent.ContentParts != null)
|
||||
foreach (PartInfo pi in ii.MyContent.ContentParts)
|
||||
foreach (ItemInfo iic in pi.MyItems)
|
||||
if (GetStepCheckOff(iic)) return true;
|
||||
return false;
|
||||
}
|
||||
//private int? _TemplateColumnMode
|
||||
@@ -6242,7 +6384,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (Int32.TryParse(tmpstr, out x)) return x;
|
||||
// flag the case where the current section's tab already has prefixed in the parent's tab:
|
||||
// (without this, BGE's section headers were coming up as 6.1.6.1.1...)
|
||||
if (IsSection && ActiveParent.IsSection)
|
||||
if (IsSection && ActiveParent.IsSection)
|
||||
{
|
||||
if (DisplayNumber.StartsWith((ActiveParent as SectionInfo).DisplayNumber.Trim())) return -2;
|
||||
}
|
||||
|
@@ -632,9 +632,9 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
else
|
||||
{
|
||||
if (GetType() == typeof(ProcedureInfo))
|
||||
if (GetType() == typeof(ProcedureInfo) || MyContent.Type < 10000)
|
||||
tmp = DataPortal.Fetch<ProcedureInfo>(new PastingPartCriteria(copyStartID, itemID, addType, type, fromType, DateTime.Now, Volian.Base.Library.VlnSettings.UserID));
|
||||
else if (GetType() == typeof(SectionInfo))
|
||||
else if (GetType() == typeof(SectionInfo) || (MyContent.Type < 20000))
|
||||
tmp = DataPortal.Fetch<SectionInfo>(new PastingPartCriteria(copyStartID, itemID, addType, type, fromType, DateTime.Now, Volian.Base.Library.VlnSettings.UserID));
|
||||
else
|
||||
tmp = DataPortal.Fetch<StepInfo>(new PastingPartCriteria(copyStartID, itemID, addType, type, fromType, DateTime.Now, Volian.Base.Library.VlnSettings.UserID));
|
||||
@@ -838,19 +838,32 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
#endregion
|
||||
#region Enhanced Document Support
|
||||
public ItemInfo DoAddEnhancedSteps(int enhType, int enhItemID, EAddpingPart addpart)
|
||||
{
|
||||
// get the item object in the enhanced document so that inserting of the new enhanced item and
|
||||
// its children can be done:
|
||||
ItemInfo existingEnhancedItemInfo = ItemInfo.Get(enhItemID);
|
||||
ItemInfo newEnhancedItemInfo = existingEnhancedItemInfo.InsertEnhancedSteps(MyContent.Text, null, addpart, MyContent.Type, enhType, ItemID);
|
||||
if (newEnhancedItemInfo == null) return null;
|
||||
StepConfig sc = new StepConfig(MyContent.Config);
|
||||
sc.AddEnhancedDocument(enhType, newEnhancedItemInfo.ItemID);
|
||||
SaveConfig(sc.ToString());
|
||||
return newEnhancedItemInfo;
|
||||
}
|
||||
public ItemInfo InsertEnhancedSteps(string text, string number, EAddpingPart addType, int? type, int eDocType, int newSourceID)
|
||||
//public ItemInfo InsertEnhancedSiblingAfter(string text, string number, int? type, int eDocType, int newID)
|
||||
{
|
||||
ItemInfo tmp = null;
|
||||
if (addType == EAddpingPart.Child)
|
||||
{
|
||||
E_FromType fromType = E_FromType.Caution;
|
||||
if (ActiveFormat.PlantFormat.FormatData.StepDataList[(int)type- 20000].Type.ToUpper() == "NOTE") fromType = E_FromType.Note;
|
||||
if (this.IsSection) fromType = E_FromType.Step;
|
||||
else if (ActiveFormat.PlantFormat.FormatData.StepDataList[(int)type - 20000].Type.ToUpper() == "NOTE") fromType = E_FromType.Note;
|
||||
tmp = InsertEnhancedSmartTemplateSubStep(text, number, this, addType, (int)type, fromType, newSourceID);
|
||||
}
|
||||
else
|
||||
tmp = InsertEnhancedSmartTemplateSteps(text, number, this, addType, (int)type, newSourceID);
|
||||
//ItemInfo tmp = InsertEnhancedSmartTemplateSteps(text, number, this, EAddpingPart.After, (int)MyContent.Type, newID);
|
||||
tmp = InsertEnhancedSmartTemplateSteps(text, number, this, addType, 20002, newSourceID);
|
||||
if (tmp == null) return null;
|
||||
|
||||
// if next exists, it is updated in SQL so we have to manually force the iteminfo updates
|
||||
// Refresh ItemInfo to update PreviousID field
|
||||
if (tmp.NextItem != null) using (Item item = tmp.NextItem.Get()) ItemInfo.Refresh(item);
|
||||
@@ -858,14 +871,21 @@ namespace VEPROMS.CSLA.Library
|
||||
// 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();
|
||||
// Update all of the content records that have transitions that point to the Siblings or Sibling Children of the new item
|
||||
//tmp.UpdateTransitionText();
|
||||
tmp.UpdateROText();
|
||||
//?? OnNewSiblingAfter(new ItemInfoInsertEventArgs(tmp, EAddpingPart.After));
|
||||
// Note that non-enhanced update transition and ro text at this point. But since
|
||||
// transitions and ro's are converted to text, this is not needed.
|
||||
|
||||
if (addType == EAddpingPart.Child)
|
||||
OnNewChild(new ItemInfoInsertEventArgs(tmp, EAddpingPart.Child));
|
||||
else if (addType == EAddpingPart.After)
|
||||
{
|
||||
OnNewSiblingAfter(new ItemInfoInsertEventArgs(tmp, EAddpingPart.After));
|
||||
|
||||
}
|
||||
else if (addType == EAddpingPart.Before)
|
||||
OnNewSiblingBefore(new ItemInfoInsertEventArgs(tmp, EAddpingPart.Before));
|
||||
return tmp;
|
||||
}
|
||||
|
||||
private ItemInfo InsertEnhancedSmartTemplateSubStep(string text, string number, ItemInfo tmp, EAddpingPart addType, int type, E_FromType fromTypeTop, int newID)
|
||||
private ItemInfo InsertEnhancedSmartTemplateSubStep(string text, string number, ItemInfo tmp, EAddpingPart addType, int type, E_FromType fromTypeTop, int newSourceID)
|
||||
{
|
||||
int newItemID = 0;
|
||||
int topType = GetSmartTemplateTopLevelIndxOfThisType(type);
|
||||
@@ -882,11 +902,9 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
if (firstSmart == null)
|
||||
{
|
||||
// set stepconfig for this new enhanced item:
|
||||
StepConfig sc = new StepConfig("");
|
||||
sc.AddEnhancedDocument(0, newID);
|
||||
|
||||
firstSmart = NewItemInfoFetch(ItemID, addType, number, tmptext, type, (int?)fromTypeTop, null, null, DateTime.Now, Volian.Base.Library.VlnSettings.UserID);
|
||||
sc.AddEnhancedDocument(0, newSourceID);
|
||||
firstSmart = NewItemInfoFetch(ItemID, addType, number, tmptext, type, (int?)fromTypeTop, null, sc.ToString(), DateTime.Now, Volian.Base.Library.VlnSettings.UserID);
|
||||
siblingSmart = firstSmart;
|
||||
newItemID = firstSmart.ItemID;
|
||||
}
|
||||
@@ -942,10 +960,9 @@ namespace VEPROMS.CSLA.Library
|
||||
if (firstSmart == null)
|
||||
{
|
||||
// set stepconfig for this new enhanced item:
|
||||
StepConfig sc = new StepConfig("" );
|
||||
StepConfig sc = new StepConfig("");
|
||||
sc.AddEnhancedDocument(0, newSourceID);
|
||||
firstSmart = CopyPasteItemInfoFetch(newSourceID, this.ItemID, type, type, eAddpingPart);
|
||||
//firstSmart = NewItemInfoFetch(ItemID, eAddpingPart, number, tmptext, type, null, null, sc.ToString(), DateTime.Now, Volian.Base.Library.VlnSettings.UserID);
|
||||
firstSmart = NewItemInfoFetch(ItemID, eAddpingPart, number, tmptext, type, null, null, sc.ToString(), DateTime.Now, Volian.Base.Library.VlnSettings.UserID);
|
||||
siblingSmart = parentSmart = firstSmart;
|
||||
newItemID = firstSmart.ItemID;
|
||||
}
|
||||
@@ -983,8 +1000,424 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
tmp = firstSmart;
|
||||
}
|
||||
|
||||
return tmp;
|
||||
}
|
||||
public ItemInfo EnhancedPasteItem(int copyStartID, ItemInfo pasteFromItem, EAddpingPart addType, string chgid)
|
||||
{
|
||||
EnhancedDocuments pasteFromItemsEnhancedDocuments = pasteFromItem.GetMyEnhancedDocuments();
|
||||
if (pasteFromItemsEnhancedDocuments == null || pasteFromItemsEnhancedDocuments.Count == 0) return null;
|
||||
ItemInfo newItemInfo = this;
|
||||
ItemInfo newEnhancedItemInfo = null;
|
||||
// need to save the original item ids in the copied item so that they can be
|
||||
// changed to the new enhanced ids in 'config'. The oldid/newid pairs will
|
||||
// be stored in a dictionary & the update will be made after the loop.
|
||||
Dictionary<int, int> oldToNewEnhancedIds = new Dictionary<int, int>();
|
||||
|
||||
// tmpCopyStartSourceItem is the item that was copied in source.
|
||||
ItemInfo tmpCopyStartSourceItem = ItemInfo.Get(copyStartID);
|
||||
|
||||
// loop through all enhanced document types, pasting in the copied item(s).
|
||||
// Note that the copy/paste finds the enhanced items that relate to source,
|
||||
// i.e. copied item & paste from, and uses those to do the copy/paste.
|
||||
// sc is the config (passed in) for the item that we are pasting around.
|
||||
foreach (EnhancedDocument edSource in pasteFromItem.GetMyEnhancedDocuments())
|
||||
{
|
||||
if (edSource.Type != 0)
|
||||
{
|
||||
ItemInfo tmpPasteItemFrom = ItemInfo.Get(edSource.ItemID); // here is problem
|
||||
|
||||
// get the 'enhanced' item to copy. To do this, get the enhanced link
|
||||
// from source's config that matches this 'type'. Use that Id to get the enhanced
|
||||
// Item that is to be copied:
|
||||
int tmpCopyEnhancedID = 0;
|
||||
foreach (EnhancedDocument edCopy in tmpCopyStartSourceItem.GetMyEnhancedDocuments())
|
||||
{
|
||||
if (edSource.Type == edCopy.Type)
|
||||
{
|
||||
tmpCopyEnhancedID = edCopy.ItemID;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (tmpCopyEnhancedID == 0) break; // no connected copied item.
|
||||
if (addType == EAddpingPart.Before)
|
||||
newEnhancedItemInfo = tmpPasteItemFrom.PasteSiblingBefore(tmpCopyEnhancedID, chgid);
|
||||
else if (addType == EAddpingPart.After)
|
||||
newEnhancedItemInfo = tmpPasteItemFrom.PasteSiblingAfter(tmpCopyEnhancedID, chgid);
|
||||
else if (addType == EAddpingPart.Child)
|
||||
newEnhancedItemInfo = tmpPasteItemFrom.PasteChild(tmpCopyEnhancedID, chgid);
|
||||
else if (addType == EAddpingPart.Replace) // what about user interface for enhanced pasted steps?
|
||||
{
|
||||
ItemInfo enhReplaceItem = ItemInfo.Get(edSource.ItemID);
|
||||
newEnhancedItemInfo = Item.PasteReplace(enhReplaceItem, tmpCopyEnhancedID, chgid);
|
||||
}
|
||||
|
||||
// update the config data for the new enhanced item (procedure, section or step) to point back to the correct source
|
||||
string cfgEnhStr = null;
|
||||
if (newEnhancedItemInfo.IsStep)
|
||||
{
|
||||
StepConfig scnewenh = newEnhancedItemInfo.MyConfig as StepConfig;
|
||||
if (scnewenh == null) break; //error here, i.e. should have a related enhanced step
|
||||
scnewenh.MyEnhancedDocuments[0].ItemID = newItemInfo.ItemID;
|
||||
scnewenh.SaveEnhancedDocuments();
|
||||
cfgEnhStr = scnewenh.ToString();
|
||||
}
|
||||
else if (newEnhancedItemInfo.IsSection)
|
||||
{
|
||||
SectionConfig secnewenh = newEnhancedItemInfo.MyConfig as SectionConfig;
|
||||
if (secnewenh == null) break; //error here, i.e. should have a related enhanced step
|
||||
secnewenh.MyEnhancedDocuments[0].ItemID = newItemInfo.ItemID;
|
||||
secnewenh.SaveEnhancedDocuments();
|
||||
cfgEnhStr = secnewenh.ToString();
|
||||
}
|
||||
else if (newEnhancedItemInfo.IsProcedure)
|
||||
{
|
||||
ProcedureConfig pnewenh = newEnhancedItemInfo.MyConfig as ProcedureConfig;
|
||||
if (pnewenh == null) break; //error here, i.e. should have a related enhanced step
|
||||
pnewenh.MyEnhancedDocuments[0].ItemID = newItemInfo.ItemID;
|
||||
pnewenh.SaveEnhancedDocuments();
|
||||
cfgEnhStr = pnewenh.ToString();
|
||||
}
|
||||
if (cfgEnhStr != null) newEnhancedItemInfo.SaveConfig(cfgEnhStr);
|
||||
// save the new enhanced step ids to set in the new source's config (to relate steps)
|
||||
foreach (EnhancedDocument edNew in newItemInfo.GetMyEnhancedDocuments())
|
||||
{
|
||||
if (edNew.ItemID == tmpCopyEnhancedID) oldToNewEnhancedIds.Add(edNew.ItemID, newEnhancedItemInfo.ItemID);
|
||||
}
|
||||
}
|
||||
}
|
||||
// update the config to point to new enhanced document steps for the new source item
|
||||
if (oldToNewEnhancedIds.Count > 0)
|
||||
{
|
||||
// save the updated config info on the newly pasted source: step, section or procedure:
|
||||
string cfgNewSrc = null;
|
||||
if (newItemInfo.IsStep)
|
||||
{
|
||||
StepConfig scnewpst1 = newItemInfo.MyConfig as StepConfig;
|
||||
foreach (EnhancedDocument edOrig in scnewpst1.MyEnhancedDocuments)
|
||||
edOrig.ItemID = oldToNewEnhancedIds[edOrig.ItemID];
|
||||
scnewpst1.SaveEnhancedDocuments();
|
||||
cfgNewSrc = scnewpst1.ToString();
|
||||
}
|
||||
else if (newItemInfo.IsSection)
|
||||
{
|
||||
SectionConfig secnewpst1 = newItemInfo.MyConfig as SectionConfig;
|
||||
foreach (EnhancedDocument edOrig in secnewpst1.MyEnhancedDocuments)
|
||||
edOrig.ItemID = oldToNewEnhancedIds[edOrig.ItemID];
|
||||
secnewpst1.SaveEnhancedDocuments();
|
||||
cfgNewSrc = secnewpst1.ToString();
|
||||
}
|
||||
else if (newItemInfo.IsProcedure)
|
||||
{
|
||||
ProcedureConfig pnewpst1 = newItemInfo.MyConfig as ProcedureConfig;
|
||||
foreach (EnhancedDocument edOrig in pnewpst1.MyEnhancedDocuments)
|
||||
edOrig.ItemID = oldToNewEnhancedIds[edOrig.ItemID];
|
||||
pnewpst1.SaveEnhancedDocuments();
|
||||
cfgNewSrc = pnewpst1.ToString();
|
||||
}
|
||||
if (cfgNewSrc != null) newItemInfo.SaveConfig(cfgNewSrc);
|
||||
}
|
||||
// if this is a HLS, then need to adjust links between any associated notes/cautions too:
|
||||
if (newItemInfo.IsStep)
|
||||
{
|
||||
StepConfig scForNC = newItemInfo.MyConfig as StepConfig;
|
||||
foreach (EnhancedDocument ed in scForNC.MyEnhancedDocuments) EnhancedSetNoteCautionLinks(newItemInfo, ed.Type);
|
||||
}
|
||||
return newEnhancedItemInfo;
|
||||
}
|
||||
#region HandleEnhancedNoteCautionConfigLinks
|
||||
private static void EnhancedSetNoteCautionLinks(ItemInfo newItemInfo, int enhType)
|
||||
{
|
||||
// For this enhanced document type, adjust all of the ids to link between source & enhanced if there are
|
||||
// notes & cautions. Notes first. There may be some source notes that aren't linked and some enhanced
|
||||
// that are not linked, so account for this.
|
||||
// get the high level enhanced step, this will be used for both note & caution code:
|
||||
ItemInfo enhHls = null;
|
||||
foreach (EnhancedDocument enh in newItemInfo.GetMyEnhancedDocuments())
|
||||
{
|
||||
if (enh.Type == enhType)
|
||||
{
|
||||
enhHls = ItemInfo.Get(enh.ItemID);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (newItemInfo.IsHigh && enhHls != null && newItemInfo.Notes != null && newItemInfo.Notes.Count > 0)
|
||||
{
|
||||
int srcIndxNt = 0;
|
||||
int enhIndxNt = 0;
|
||||
// for each note association between the source & enhanced document, update
|
||||
// the config items to link them.
|
||||
ItemInfo srcNtItem = newItemInfo.Notes[srcIndxNt];
|
||||
while (srcNtItem != null)
|
||||
{
|
||||
StepConfig scSourceNote = newItemInfo.Notes[srcIndxNt].MyConfig as StepConfig;
|
||||
if (scSourceNote.MyEnhancedDocuments.Count > 0)
|
||||
{
|
||||
// Loop through for each enhanced document related to the pasted source HLS
|
||||
foreach (EnhancedDocument enh in srcNtItem.GetMyEnhancedDocuments())
|
||||
{
|
||||
if (enh.Type == enhType)
|
||||
{
|
||||
// Find hls in enhanced in order to get its notes to set their config to
|
||||
// point back to the new source's note itemid. There may be enhanced items that
|
||||
// don't connect back, so find one that does based on Enhance HLS note list &
|
||||
// the notes' links back to source.
|
||||
ItemInfo enhNtItem = null;
|
||||
while (enhNtItem == null && enhIndxNt < enhHls.Notes.Count)
|
||||
{
|
||||
ItemInfo enhTstNote = enhHls.Notes[enhIndxNt];
|
||||
StepConfig enhTstNoteCfg = enhTstNote.MyConfig as StepConfig;
|
||||
if (enhTstNoteCfg.MyEnhancedDocuments.Count > 0)
|
||||
{
|
||||
foreach (EnhancedDocument enhNt in enhTstNote.GetMyEnhancedDocuments())
|
||||
{
|
||||
if (enhNt.Type == 0) // found it:
|
||||
{
|
||||
enhNtItem = enhTstNote;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (enhNtItem == null) enhIndxNt++;
|
||||
}
|
||||
if (enhNtItem != null)
|
||||
{
|
||||
StepConfig scNewEnhancedNote = enhNtItem.MyConfig as StepConfig;
|
||||
scNewEnhancedNote.MyEnhancedDocuments[0].ItemID = newItemInfo.Notes[srcIndxNt].ItemID;
|
||||
scNewEnhancedNote.SaveEnhancedDocuments();
|
||||
enhNtItem.SaveConfig(scNewEnhancedNote.ToString());
|
||||
foreach (EnhancedDocument noteEnh in scSourceNote.MyEnhancedDocuments)
|
||||
{
|
||||
if (noteEnh.Type == enhType)
|
||||
{
|
||||
noteEnh.ItemID = enhHls.Notes[enhIndxNt].ItemID;
|
||||
scSourceNote.SaveEnhancedDocuments();
|
||||
newItemInfo.Notes[srcIndxNt].SaveConfig(scSourceNote.ToString());
|
||||
break;
|
||||
}
|
||||
}
|
||||
enhIndxNt++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
srcIndxNt++;
|
||||
srcNtItem = srcIndxNt>=newItemInfo.Notes.Count?null:newItemInfo.Notes[srcIndxNt];
|
||||
}
|
||||
}
|
||||
// now do any cautions.
|
||||
if (newItemInfo.IsHigh && newItemInfo.Cautions != null && newItemInfo.Cautions.Count > 0)
|
||||
{
|
||||
int srcIndxCt = 0;
|
||||
int enhIndxCt = 0;
|
||||
// for each caution association between the source & enhanced document, update
|
||||
// the config items to link them.
|
||||
ItemInfo srcCtItem = newItemInfo.Cautions[srcIndxCt];
|
||||
while (srcCtItem != null)
|
||||
{
|
||||
StepConfig scSourceCaution = newItemInfo.Cautions[srcIndxCt].MyConfig as StepConfig;
|
||||
if (scSourceCaution.MyEnhancedDocuments.Count > 0)
|
||||
{
|
||||
// Loop through for each enhanced document related to the pasted source HLS
|
||||
foreach (EnhancedDocument enh in srcCtItem.GetMyEnhancedDocuments())
|
||||
{
|
||||
if (enh.Type == enhType)
|
||||
{
|
||||
// Find hls in enhanced in order to get its notes to set their config to
|
||||
// point back to the new source's note itemid.
|
||||
ItemInfo enhCtItem = null;
|
||||
while (enhCtItem == null && enhIndxCt < enhHls.Cautions.Count)
|
||||
{
|
||||
ItemInfo enhTstCaut = enhHls.Cautions[enhIndxCt];
|
||||
StepConfig enhTstCautCfg = enhTstCaut.MyConfig as StepConfig;
|
||||
if (enhTstCautCfg.MyEnhancedDocuments.Count > 0)
|
||||
{
|
||||
foreach (EnhancedDocument enhCt in enhTstCaut.GetMyEnhancedDocuments())
|
||||
{
|
||||
if (enhCt.Type == 0)
|
||||
{
|
||||
enhCtItem = enhTstCaut;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (enhCtItem == null) enhIndxCt++;
|
||||
}
|
||||
if (enhCtItem != null)
|
||||
{
|
||||
StepConfig scNewEnhancedCaution = enhCtItem.MyConfig as StepConfig;
|
||||
scNewEnhancedCaution.MyEnhancedDocuments[0].ItemID = newItemInfo.Cautions[srcIndxCt].ItemID;
|
||||
scNewEnhancedCaution.SaveEnhancedDocuments();
|
||||
enhCtItem.SaveConfig(scNewEnhancedCaution.ToString());
|
||||
foreach (EnhancedDocument cautionEnh in scSourceCaution.MyEnhancedDocuments)
|
||||
{
|
||||
if (cautionEnh.Type == enh.Type)
|
||||
{
|
||||
cautionEnh.ItemID = enhHls.Cautions[enhIndxCt].ItemID;
|
||||
scSourceCaution.SaveEnhancedDocuments();
|
||||
newItemInfo.Cautions[srcIndxCt].SaveConfig(scSourceCaution.ToString());
|
||||
break;
|
||||
}
|
||||
}
|
||||
enhIndxCt++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
srcIndxCt++;
|
||||
srcCtItem = srcIndxCt >= newItemInfo.Cautions.Count ? null : newItemInfo.Cautions[srcIndxCt];
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
#region HandleEnhancedStepConfigLinks
|
||||
private void EnhancedSetStepLinks(ItemInfo newSourceSectionInfo, int enhType)
|
||||
{
|
||||
//for the input source section, link all HLS to enhanced HLS (and any associated cautions/notes). Note that
|
||||
// this assumes that all source steps are linked, but there may be 'deleted' steps in enhanced that may not be linked back.
|
||||
ItemInfo newEnhSectionInfo = null;
|
||||
ItemInfo enhStep = null; // in enhanced document, find first step that has links (there may be enhanced steps that don't have links)
|
||||
SectionConfig newSectCfg = newSourceSectionInfo.MyConfig as SectionConfig;
|
||||
foreach (EnhancedDocument ed in newSectCfg.MyEnhancedDocuments)
|
||||
{
|
||||
if (ed.Type == enhType)
|
||||
{
|
||||
newEnhSectionInfo = ItemInfo.Get(ed.ItemID);
|
||||
StepConfig cfg = newEnhSectionInfo.Steps[0].MyConfig as StepConfig;
|
||||
if (cfg.MyEnhancedDocuments.Count > 0) enhStep = newEnhSectionInfo.Steps[0];
|
||||
else enhStep = GetNextEnhancedStep(newEnhSectionInfo.Steps[0]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (enhStep == null) return;
|
||||
// now adjust all of the ids to link between source & enhanced for this section's steps.
|
||||
// The enhType represents which enhanced document we are working with, for example, backgrounds or deviations.
|
||||
for (int iStp = 0; iStp < newSourceSectionInfo.Steps.Count; iStp++)
|
||||
{
|
||||
StepConfig scSourceStep = newSourceSectionInfo.Steps[iStp].MyConfig as StepConfig;
|
||||
if (scSourceStep.MyEnhancedDocuments.Count > 0)
|
||||
{
|
||||
// Loop through for each enhanced document related to the pasted source HLS
|
||||
foreach (EnhancedDocument enh in scSourceStep.MyEnhancedDocuments)
|
||||
{
|
||||
if (enh.Type == enhType)
|
||||
{
|
||||
// Find hls in enhanced in order to set the config to point back to the new source's itemid.
|
||||
ItemInfo enhHls = enhStep;
|
||||
StepConfig scNewEnhancedStep = enhHls.MyConfig as StepConfig;
|
||||
scNewEnhancedStep.MyEnhancedDocuments[0].ItemID = newSourceSectionInfo.Steps[iStp].ItemID;
|
||||
scNewEnhancedStep.SaveEnhancedDocuments();
|
||||
enhHls.SaveConfig(scNewEnhancedStep.ToString());
|
||||
// set the source to go to this enh.
|
||||
enh.ItemID = enhHls.ItemID;
|
||||
scSourceStep.SaveEnhancedDocuments();
|
||||
newSourceSectionInfo.Steps[iStp].SaveConfig(scSourceStep.ToString());
|
||||
EnhancedSetNoteCautionLinks(newSourceSectionInfo.Steps[iStp], enhType);
|
||||
}
|
||||
}
|
||||
}
|
||||
enhStep = GetNextEnhancedStep(enhStep);
|
||||
}
|
||||
}
|
||||
private ItemInfo GetNextEnhancedStep(ItemInfo itemInfo)
|
||||
{
|
||||
if (itemInfo==null) return null;
|
||||
ItemInfo curStep = itemInfo.NextItem;
|
||||
while (curStep != null)
|
||||
{
|
||||
StepConfig cfg = curStep.MyConfig as StepConfig;
|
||||
if (cfg.MyEnhancedDocuments.Count > 0) return curStep;
|
||||
curStep = curStep.NextItem;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
private ItemInfo GetNextEnhancedSection(ItemInfo itemInfo)
|
||||
{
|
||||
if (itemInfo == null) return null;
|
||||
ItemInfo curSect = itemInfo.NextItem;
|
||||
while (curSect != null)
|
||||
{
|
||||
SectionConfig cfg = curSect.MyConfig as SectionConfig;
|
||||
if (cfg.MyEnhancedDocuments.Count > 0) return curSect;
|
||||
curSect = curSect.NextItem;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
#endregion
|
||||
public ItemInfo PasteEnhancedItems(int copyStartID, ItemInfo pasteFromItem, EAddpingPart addType, string chgid)
|
||||
{
|
||||
ItemInfo retItem = null;
|
||||
if (IsProcedure) // newly Pasted Item is a procedure.
|
||||
{
|
||||
// the following pastes each type of enhanced procedure, including its sections/steps
|
||||
EnhancedPasteItem(copyStartID, pasteFromItem, addType, chgid);
|
||||
// for each enhanced type for this procedure, adjust the config data for its sections/steps:
|
||||
ProcedureConfig sourceProcConfig = this.MyConfig as ProcedureConfig;
|
||||
foreach (EnhancedDocument enhProc in sourceProcConfig.MyEnhancedDocuments)
|
||||
{
|
||||
if (enhProc.Type != 0)
|
||||
{
|
||||
ItemInfo pastedEnhancedProc = ItemInfo.Get(enhProc.ItemID);
|
||||
// get the first enhanced section, there may be non-linked sections before first linked section:
|
||||
SectionConfig firstEnhSectionConfig = pastedEnhancedProc.Sections == null ? null : pastedEnhancedProc.Sections[0].MyConfig as SectionConfig;
|
||||
ItemInfo pastedEnhancedCurrentSection = null;
|
||||
if (firstEnhSectionConfig.MyEnhancedDocuments.Count > 0) pastedEnhancedCurrentSection = pastedEnhancedProc.Sections[0];
|
||||
else pastedEnhancedCurrentSection = GetNextEnhancedSection(pastedEnhancedProc.Sections[0]);
|
||||
|
||||
// newly pasted procedure has sections/steps, need to adjust 'MyEnhancedDocuments' config items to point to correct
|
||||
if (Sections != null)
|
||||
{
|
||||
foreach (ItemInfo sourceSect in Sections)
|
||||
{
|
||||
SectionConfig srcCfg = sourceSect.MyConfig as SectionConfig;
|
||||
if (srcCfg != null && (srcCfg.Section_LnkEnh=="Y" || srcCfg.Section_LnkEnh=="T") && srcCfg.MyEnhancedDocuments != null && srcCfg.MyEnhancedDocuments.Count > 0)
|
||||
{
|
||||
// use pastedEnhancedCurrentSection to link to:
|
||||
foreach (EnhancedDocument ed in srcCfg.MyEnhancedDocuments)
|
||||
{
|
||||
if (ed.Type == enhProc.Type)
|
||||
{
|
||||
ed.ItemID = pastedEnhancedCurrentSection.ItemID;
|
||||
srcCfg.SaveEnhancedDocuments();
|
||||
sourceSect.SaveConfig(srcCfg.ToString());
|
||||
break;
|
||||
}
|
||||
}
|
||||
SectionConfig enhSectCfg = pastedEnhancedCurrentSection.MyConfig as SectionConfig;
|
||||
enhSectCfg.MyEnhancedDocuments[0].ItemID = sourceSect.ItemID;
|
||||
enhSectCfg.SaveEnhancedDocuments();
|
||||
pastedEnhancedCurrentSection.SaveConfig(enhSectCfg.ToString());
|
||||
if (srcCfg.Section_LnkEnh == "Y") EnhancedSetStepLinks(sourceSect, enhProc.Type); //if steps, do them for this type
|
||||
pastedEnhancedCurrentSection = GetNextEnhancedSection(pastedEnhancedCurrentSection);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
retItem = null;
|
||||
}
|
||||
else if (IsSection)
|
||||
{
|
||||
ItemInfo pastedSect = EnhancedPasteItem(copyStartID, pasteFromItem, addType, chgid);
|
||||
SectionConfig sourceSectConfig = this.MyConfig as SectionConfig;
|
||||
foreach (EnhancedDocument enhSect in sourceSectConfig.MyEnhancedDocuments)
|
||||
if (enhSect.Type != 0) EnhancedSetStepLinks(this, enhSect.Type);
|
||||
retItem = pastedSect;
|
||||
}
|
||||
else if (pasteFromItem.IsStep || (pasteFromItem.IsSection && addType == EAddpingPart.Child))
|
||||
{
|
||||
ItemInfo pastedStep = EnhancedPasteItem(copyStartID, pasteFromItem, addType, chgid);
|
||||
retItem = pastedStep;
|
||||
}
|
||||
return retItem;
|
||||
}
|
||||
private void SaveConfig(string cfg)
|
||||
{
|
||||
using (Content c1 = Content.Get(ContentID))
|
||||
{
|
||||
c1.Config = cfg;
|
||||
c1.Save();
|
||||
}
|
||||
RefreshConfig();
|
||||
}
|
||||
#endregion
|
||||
#region DataPortal
|
||||
|
@@ -180,7 +180,9 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
// gets here if other session has working draft open & click on sam working draft.
|
||||
OwnerInfo oi = OwnerInfo.GetBySessionIDandVersionID(si.SessionID, objectID);
|
||||
if(oi.OwnerType == 0)
|
||||
if (oi == null)
|
||||
message = message + string.Format("The working draft is already checked out to {0}", si.UserID) + Environment.NewLine;
|
||||
else if(oi.OwnerType == 0)
|
||||
message = message + string.Format("The procedure {0} is already checked out to {1}", ItemInfo.Get(oi.OwnerItemID).MyProcedure.DisplayNumber, si.UserID) + Environment.NewLine;
|
||||
else if (oi.OwnerType == 1)
|
||||
message = message + string.Format("The document {0} is already checked out to {1}", DocumentInfo.Get(oi.OwnerItemID).DocumentEntries[0].MyContent.Text, si.UserID) + Environment.NewLine;
|
||||
|
Reference in New Issue
Block a user