diff --git a/PROMS/VEPROMS.CSLA.Library/Config/DocVersionConfig.cs b/PROMS/VEPROMS.CSLA.Library/Config/DocVersionConfig.cs
index d70c0693..df985863 100644
--- a/PROMS/VEPROMS.CSLA.Library/Config/DocVersionConfig.cs
+++ b/PROMS/VEPROMS.CSLA.Library/Config/DocVersionConfig.cs
@@ -28,14 +28,11 @@ namespace VEPROMS.CSLA.Library
}
return eds;
}
- public DVEnhancedDocument this[int type]
+ public DVEnhancedDocument GetByType(int type)
{
- get
- {
- foreach (DVEnhancedDocument ed in this)
- if (ed.Type == type) return ed;
- return null;
- }
+ foreach (DVEnhancedDocument ed in this)
+ if (ed.Type == type) return ed;
+ return null;
}
public DVEnhancedDocument this[string name]
{
@@ -46,6 +43,15 @@ namespace VEPROMS.CSLA.Library
return null;
}
}
+ public bool HasSourcePointer
+ {
+ get
+ {
+ foreach (DVEnhancedDocument ed in this)
+ if (ed.Type == 0) return true;
+ return false;
+ }
+ }
}
public partial class DVEnhancedDocument
{
@@ -86,7 +92,7 @@ namespace VEPROMS.CSLA.Library
Type = type;
VersionID = versionID;
PdfX = pdfX;
- PdfToken = PdfToken;
+ PdfToken = pdfToken;
}
public override string ToString()
{
@@ -110,6 +116,49 @@ namespace VEPROMS.CSLA.Library
}
set { _MyEnhancedDocuments = value; }
}
+ public void SaveDVEnhancedDocuments()
+ {
+ // get all of the current enhanced links from datastructure in code. This list may have been
+ // modified by adding items during code execution by associating source <--> background etc.
+ DVEnhancedDocuments edsToAdd = new DVEnhancedDocuments();
+ foreach (DVEnhancedDocument ed in MyEnhancedDocuments)
+ edsToAdd.Add(ed);
+
+ // from the existing list in xml, remove any that are in the 'editted (edsToAdd) list
+ // so that what remains are those that need added to xml that will then be written to database
+ foreach (XmlNode xn in _Xp.XmlContents.SelectNodes("//Enhanced"))
+ {
+ DVEnhancedDocument tmp = edsToAdd.GetByType(int.Parse(xn.Attributes["Type"].Value));
+ if (tmp != null)
+ {
+ if (xn.Attributes["Name"].Value != tmp.Name)
+ xn.Attributes["Name"].Value = tmp.Name;
+ if (int.Parse(xn.Attributes["Type"].Value) != tmp.Type)
+ xn.Attributes["Type"].Value = tmp.Type.ToString();
+ if (int.Parse(xn.Attributes["VersionID"].Value) != tmp.VersionID)
+ xn.Attributes["VersionID"].Value = tmp.VersionID.ToString();
+ if (int.Parse(xn.Attributes["PdfX"].Value) != tmp.PdfX)
+ xn.Attributes["PdfX"].Value = tmp.PdfX.ToString();
+ if (xn.Attributes["PdfToken"].Value != tmp.PdfToken)
+ xn.Attributes["PdfToken"].Value = tmp.PdfToken;
+ edsToAdd.Remove(tmp);
+ }
+ }
+
+ // WILL NEED THIS FOR New/ADD
+ //foreach (DVEnhancedDocument edadd in edsToAdd)
+ //{
+ // // Add (example):
+ // // First add 'Enhanced' element:
+ // XmlNode newEnhNode = _Xp.XmlContents.CreateNode(XmlNodeType.Element, "Enhanced", _Xp.XmlContents.NamespaceURI);
+ // XmlNode xnEnh = _Xp.XmlContents.DocumentElement.AppendChild(newEnhNode);
+ // // Now add the 'Type' and 'ItemID' attributes:
+ // XmlAttribute xa = xnEnh.Attributes.Append(_Xp.XmlContents.CreateAttribute("Type"));
+ // xa.Value = edadd.Type.ToString();
+ // xa = xnEnh.Attributes.Append(_Xp.XmlContents.CreateAttribute("ItemID"));
+ // xa.Value = edadd.ItemID.ToString();
+ //}
+ }
#region DynamicTypeDescriptor
internal override bool IsReadOnly
{
diff --git a/PROMS/VEPROMS.CSLA.Library/Config/EnumDescConverter.cs b/PROMS/VEPROMS.CSLA.Library/Config/EnumDescConverter.cs
index 97629307..cd05d4a7 100644
--- a/PROMS/VEPROMS.CSLA.Library/Config/EnumDescConverter.cs
+++ b/PROMS/VEPROMS.CSLA.Library/Config/EnumDescConverter.cs
@@ -53,7 +53,8 @@ namespace DescriptiveEnum
/// The description, if any, else the passed name
public static string GetEnumDescription(System.Type value, string name)
{
- FieldInfo fi= value.GetField(name);
+ FieldInfo fi= value.GetField(name);
+ if (fi == null) return "";
DescriptionAttribute[] attributes =
(DescriptionAttribute[])fi.GetCustomAttributes(
typeof(DescriptionAttribute), false);
diff --git a/PROMS/VEPROMS.CSLA.Library/Config/ProcConfig.cs b/PROMS/VEPROMS.CSLA.Library/Config/ProcConfig.cs
index cc681c45..497d9b76 100644
--- a/PROMS/VEPROMS.CSLA.Library/Config/ProcConfig.cs
+++ b/PROMS/VEPROMS.CSLA.Library/Config/ProcConfig.cs
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Text;
using System.ComponentModel;
using DescriptiveEnum;
+using System.Xml;
namespace VEPROMS.CSLA.Library
{
@@ -875,6 +876,45 @@ namespace VEPROMS.CSLA.Library
}
set { _MyEnhancedDocuments = value; }
}
+ public void AddEnhancedDocument(int type, int itemid)
+ {
+ MyEnhancedDocuments.Add(type, itemid);
+ SaveEnhancedDocuments();
+ }
+ public void SaveEnhancedDocuments()
+ {
+ // get all of the current enhanced links from datastructure in code. This list may have been
+ // modified by adding items during code execution by associating source <--> background etc.
+ EnhancedDocuments edsToAdd = new EnhancedDocuments();
+ foreach (EnhancedDocument ed in MyEnhancedDocuments)
+ edsToAdd.Add(ed);
+
+ // from the existing list in xml, remove any that are in the 'editted (edsToAdd) list
+ // so that what remains are those that need added to xml that will then be written to database
+ foreach (XmlNode xn in _Xp.XmlContents.SelectNodes("//Enhanced"))
+ {
+ //EnhancedDocument tmp = edsToAdd[int.Parse(xn.Attributes["Type"].Value)];
+ EnhancedDocument tmp = edsToAdd.GetByType(int.Parse(xn.Attributes["Type"].Value)); // [int.Parse(xn.Attributes["Type"].Value)];
+ if (tmp != null)
+ {
+ if (int.Parse(xn.Attributes["ItemID"].Value) != tmp.ItemID)
+ xn.Attributes["ItemID"].Value = tmp.ItemID.ToString();
+ edsToAdd.Remove(tmp);
+ }
+ }
+ foreach (EnhancedDocument edadd in edsToAdd)
+ {
+ // Add (example):
+ // First add 'Enhanced' element:
+ XmlNode newEnhNode = _Xp.XmlContents.CreateNode(XmlNodeType.Element, "Enhanced", _Xp.XmlContents.NamespaceURI);
+ XmlNode xnEnh = _Xp.XmlContents.DocumentElement.AppendChild(newEnhNode);
+ // Now add the 'Type' and 'ItemID' attributes:
+ XmlAttribute xa = xnEnh.Attributes.Append(_Xp.XmlContents.CreateAttribute("Type"));
+ xa.Value = edadd.Type.ToString();
+ xa = xnEnh.Attributes.Append(_Xp.XmlContents.CreateAttribute("ItemID"));
+ xa.Value = edadd.ItemID.ToString();
+ }
+ }
#endregion
#region IItemConfig Members
diff --git a/PROMS/VEPROMS.CSLA.Library/Config/SectionConfig.cs b/PROMS/VEPROMS.CSLA.Library/Config/SectionConfig.cs
index 3f754f3c..ef74d0f6 100644
--- a/PROMS/VEPROMS.CSLA.Library/Config/SectionConfig.cs
+++ b/PROMS/VEPROMS.CSLA.Library/Config/SectionConfig.cs
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Text;
using System.ComponentModel;
using DescriptiveEnum;
+using System.Xml;
namespace VEPROMS.CSLA.Library
{
@@ -349,11 +350,11 @@ namespace VEPROMS.CSLA.Library
{
get
{
- return _Xp["Section", "LnkEnh"];
+ return _Xp["Step", "LnkEnh"]; //KBR - wrong in data/xml?? is in step node not section node.
}
set
{
- _Xp["Section", "LnkEnh"] = value;
+ _Xp["Step", "LnkEnh"] = value;
OnPropertyChanged("Section_LnkEnh");
}
}
@@ -909,7 +910,74 @@ namespace VEPROMS.CSLA.Library
OnPropertyChanged("Edit_LnkEnh");
}
}
+ private EnhancedDocuments _MyEnhancedDocuments = null;
+ public EnhancedDocuments MyEnhancedDocuments
+ {
+ get
+ {
+ if (_MyEnhancedDocuments == null)
+ {
+ _MyEnhancedDocuments = EnhancedDocuments.Load(_Xp);
+ }
+ return _MyEnhancedDocuments;
+ }
+ set
+ {
+ _MyEnhancedDocuments = value;
+ //OnPropertyChanged("EnhancedDocuments");
+ }
+ }
+ public void AddEnhancedDocument(int type, int itemid)
+ {
+ MyEnhancedDocuments.Add(type, itemid);
+ SaveEnhancedDocuments();
+ }
+ public void SaveEnhancedDocuments()
+ {
+ if (MyEnhancedDocuments == null || MyEnhancedDocuments.Count == 0) // clear out the xml node
+ {
+ //XmlNode dd = _Xp.XmlContents.SelectSingleNode("//Slave[@index='" + index.ToString() + "']");
+ //dd.ParentNode.RemoveChild(dd);
+ List nodesToDel = new List();
+ foreach (XmlNode xnr in _Xp.XmlContents.SelectNodes("//Enhanced")) nodesToDel.Add(xnr);
+ if (nodesToDel != null)
+ {
+ XmlNode par = nodesToDel[0].ParentNode;
+ foreach (XmlNode xxnr in nodesToDel) par.RemoveChild(xxnr);
+ }
+ return;
+ }
+ // get all of the current enhanced links from datastructure in code. This list may have been
+ // modified by adding items during code execution by associating source <--> background etc.
+ EnhancedDocuments edsToAdd = new EnhancedDocuments();
+ foreach (EnhancedDocument ed in MyEnhancedDocuments)
+ edsToAdd.Add(ed);
+ // from the existing list in xml, remove any that are in the 'editted (edsToAdd) list
+ // so that what remains are those that need added to xml that will then be written to database
+ foreach (XmlNode xn in _Xp.XmlContents.SelectNodes("//Enhanced"))
+ {
+ EnhancedDocument tmp = edsToAdd.GetByType(int.Parse(xn.Attributes["Type"].Value)); //edsToAdd[int.Parse(xn.Attributes["Type"].Value)];
+ if (tmp != null)
+ {
+ if (int.Parse(xn.Attributes["ItemID"].Value) != tmp.ItemID)
+ xn.Attributes["ItemID"].Value = tmp.ItemID.ToString();
+ edsToAdd.Remove(tmp);
+ }
+ }
+ foreach (EnhancedDocument edadd in edsToAdd)
+ {
+ // Add (example):
+ // First add 'Enhanced' element:
+ XmlNode newEnhNode = _Xp.XmlContents.CreateNode(XmlNodeType.Element, "Enhanced", _Xp.XmlContents.NamespaceURI);
+ XmlNode xnEnh = _Xp.XmlContents.DocumentElement.AppendChild(newEnhNode);
+ // Now add the 'Type' and 'ItemID' attributes:
+ XmlAttribute xa = xnEnh.Attributes.Append(_Xp.XmlContents.CreateAttribute("Type"));
+ xa.Value = edadd.Type.ToString();
+ xa = xnEnh.Attributes.Append(_Xp.XmlContents.CreateAttribute("ItemID"));
+ xa.Value = edadd.ItemID.ToString();
+ }
+ }
#endregion
}
}
diff --git a/PROMS/VEPROMS.CSLA.Library/Config/StepConfig.cs b/PROMS/VEPROMS.CSLA.Library/Config/StepConfig.cs
index 63c3c37d..2d7ecb71 100644
--- a/PROMS/VEPROMS.CSLA.Library/Config/StepConfig.cs
+++ b/PROMS/VEPROMS.CSLA.Library/Config/StepConfig.cs
@@ -22,14 +22,11 @@ namespace VEPROMS.CSLA.Library
}
return ed;
}
- public EnhancedDocument this[int type]
+ public EnhancedDocument GetByType(int type)
{
- get
- {
- foreach (EnhancedDocument ed in this)
- if (ed.Type == type) return ed;
- return null;
- }
+ foreach (EnhancedDocument ed in this)
+ if (ed.Type == type) return ed;
+ return null;
}
}
public partial class EnhancedDocument
@@ -396,8 +393,14 @@ namespace VEPROMS.CSLA.Library
// so that what remains are those that need added to xml that will then be written to database
foreach (XmlNode xn in _Xp.XmlContents.SelectNodes("//Enhanced"))
{
- EnhancedDocument tmp = edsToAdd[int.Parse(xn.Attributes["Type"].Value)];
- if (tmp != null) edsToAdd.Remove(tmp);
+ //EnhancedDocument tmp = edsToAdd[int.Parse(xn.Attributes["Type"].Value)];
+ EnhancedDocument tmp = edsToAdd.GetByType(int.Parse(xn.Attributes["Type"].Value));
+ if (tmp != null)
+ {
+ if (int.Parse(xn.Attributes["ItemID"].Value) != tmp.ItemID)
+ xn.Attributes["ItemID"].Value = tmp.ItemID.ToString();
+ edsToAdd.Remove(tmp);
+ }
}
foreach (EnhancedDocument edadd in edsToAdd)
{
diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs
index 8f301a41..3baf6a76 100644
--- a/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs
+++ b/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs
@@ -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: ");
+ tmpForLink = Regex.Replace(tmpForLink, @"#Link:Transition:([0-9]+) [0-9]+ ", @"#Link:Transition:$1 ");
+ tmpForLink = Regex.Replace(tmpForLink, @"#Link:TransitionRange:([0-9]+) [0-9]+ ", @"#Link:TransitionRange:$1 ");
+ 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("", MyDocVersion.DocVersionConfig.Unit_Number);
//if (str.Contains(""))
// str = str.Replace("", 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;
}
diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/ItemInsertExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/ItemInsertExt.cs
index d8f986f9..4fd89539 100644
--- a/PROMS/VEPROMS.CSLA.Library/Extension/ItemInsertExt.cs
+++ b/PROMS/VEPROMS.CSLA.Library/Extension/ItemInsertExt.cs
@@ -632,9 +632,9 @@ namespace VEPROMS.CSLA.Library
}
else
{
- if (GetType() == typeof(ProcedureInfo))
+ if (GetType() == typeof(ProcedureInfo) || MyContent.Type < 10000)
tmp = DataPortal.Fetch(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(new PastingPartCriteria(copyStartID, itemID, addType, type, fromType, DateTime.Now, Volian.Base.Library.VlnSettings.UserID));
else
tmp = DataPortal.Fetch(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 oldToNewEnhancedIds = new Dictionary();
+
+ // 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
diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/MultiUserExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/MultiUserExt.cs
index 49a0029f..218ae211 100644
--- a/PROMS/VEPROMS.CSLA.Library/Extension/MultiUserExt.cs
+++ b/PROMS/VEPROMS.CSLA.Library/Extension/MultiUserExt.cs
@@ -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;
diff --git a/PROMS/VEPROMS.CSLA.Library/Format/ENums.cs b/PROMS/VEPROMS.CSLA.Library/Format/ENums.cs
index 8cd66472..4f0255af 100644
--- a/PROMS/VEPROMS.CSLA.Library/Format/ENums.cs
+++ b/PROMS/VEPROMS.CSLA.Library/Format/ENums.cs
@@ -186,7 +186,8 @@ namespace VEPROMS.CSLA.Library
AddingSub = 8,
AddingTable = 16,
AddingNext = 32,
- AddingPrev = 64
+ AddingPrev = 64,
+ EnhancedLinkedStep = 128 // this will flag that this is a linked step & should not allow inserts/deletes
}
[Flags]
public enum E_ReplaceFlags : uint
diff --git a/PROMS/VEPROMS.CSLA.Library/Generated/ContentInfo.cs b/PROMS/VEPROMS.CSLA.Library/Generated/ContentInfo.cs
index 0d1dd5af..b2d20e33 100644
--- a/PROMS/VEPROMS.CSLA.Library/Generated/ContentInfo.cs
+++ b/PROMS/VEPROMS.CSLA.Library/Generated/ContentInfo.cs
@@ -623,18 +623,22 @@ namespace VEPROMS.CSLA.Library
foreach (ContentInfo tmpInfo in _CacheByPrimaryKey[key])
{
tmpInfo.RefreshFields(tmp);
- // TODO: This needs to be handled in Generatedd Code.
+ // TODO: This needs to be handled in Generated Code.
if (tmp.LocalEntry != null && tmpInfo.MyEntry != null && tmp.MyEntry.MyDocument.DocID != tmpInfo.MyEntry.MyDocument.DocID)
EntryInfo.Refresh(tmp.MyEntry);
}
// Update Enhanced Document Text
StepConfig sc = new StepConfig(tmp.Config);
foreach (EnhancedDocument ed in sc.MyEnhancedDocuments)
- { // The following should be replaced by KBR
- ItemInfo ii = ItemInfo.Get(ed.ItemID);
- Content cc = ii.MyContent.Get();
- cc.Text = tmp.Text;
- cc.Save();
+ {
+ // Without this 'if' infinite loop. Only update text if in source and updating to point to enhanced.
+ if (ed.Type != 0)
+ {
+ ItemInfo ii = ItemInfo.Get(ed.ItemID);
+ DisplayText dt = new DisplayText(ii, ii.MyContent.Text, false);
+ string str = ItemInfo.Get(tmp.ContentItems[0].ItemID).DisplayText;
+ dt.Save(str);
+ }
}
}
protected virtual void RefreshFields(Content tmp)
diff --git a/PROMS/Volian.Controls.Library/DisplayHistory.designer.cs b/PROMS/Volian.Controls.Library/DisplayHistory.designer.cs
index 15e0a194..4a812bbb 100644
Binary files a/PROMS/Volian.Controls.Library/DisplayHistory.designer.cs and b/PROMS/Volian.Controls.Library/DisplayHistory.designer.cs differ
diff --git a/PROMS/Volian.Controls.Library/DisplayRO.cs b/PROMS/Volian.Controls.Library/DisplayRO.cs
index 21beea00..f8277ea9 100644
--- a/PROMS/Volian.Controls.Library/DisplayRO.cs
+++ b/PROMS/Volian.Controls.Library/DisplayRO.cs
@@ -230,7 +230,8 @@ namespace Volian.Controls.Library
//btnCancelRO.Enabled = ((_SavCurROLink != null) && chld.roid.Substring(0, 12).ToLower() != SavROLink.ROID.Substring(0, 12).ToLower());
string childroid = chld.roid.ToLower() + "0000";
childroid = childroid.Substring(0, 16);
- btnSaveRO.Enabled = UserInfo.CanEdit(MyUserInfo, Mydvi) && ((_SavCurROLink == null) || !(childroid.Equals(SavROLink.ROID.ToLower()))); //added security check (UserInfo.CanEdit)
+ bool isenh = MyRTB != null && MyRTB.MyItemInfo != null && MyRTB.MyItemInfo.IsEnhancedStep;
+ btnSaveRO.Enabled = !isenh && UserInfo.CanEdit(MyUserInfo, Mydvi) && ((_SavCurROLink == null) || !(childroid.Equals(SavROLink.ROID.ToLower()))); //added security check (UserInfo.CanEdit)
btnCancelRO.Enabled = ((_SavCurROLink != null) && childroid != SavROLink.ROID.ToLower());
btnGoToRO.Enabled = UserInfo.CanEditROs(MyUserInfo, Mydvi); // Writers and Reviewers cannot edit ROs (run the RO Editor)
switch (chld.type)
diff --git a/PROMS/Volian.Controls.Library/DisplayTabControl.cs b/PROMS/Volian.Controls.Library/DisplayTabControl.cs
index f11f5688..6873fcd2 100644
--- a/PROMS/Volian.Controls.Library/DisplayTabControl.cs
+++ b/PROMS/Volian.Controls.Library/DisplayTabControl.cs
@@ -48,12 +48,39 @@ namespace Volian.Controls.Library
}
public partial class DisplayTabControl : UserControl
{
+ private static bool _SyncronizeEnahnced = false;
+ public static bool SyncronizeEnhanced
+ {
+ get { return DisplayTabControl._SyncronizeEnahnced; }
+ set { DisplayTabControl._SyncronizeEnahnced = value; }
+ }
+ private static Dictionary _AllDTCs = new Dictionary();
+ private int? _VersionID = null;
+ public int? VersionID
+ {
+ get { return _VersionID; }
+ set
+ {
+ if (_AllDTCs.ContainsKey((int)value))
+ _AllDTCs[(int)value] = this;
+ else
+ _AllDTCs.Add((int)value, this);
+ _VersionID = value;
+ }
+ }
+
public event ItemSelectedChangedEvent OpenEnhancedDocument;
public void OnOpenEnhancedDocument(ItemSelectedChangedEventArgs args)
{
if (OpenEnhancedDocument != null)
OpenEnhancedDocument(this, args);
}
+ public event ItemSelectedChangedEvent RefreshEnhancedDocument;
+ public void OnRefreshEnhancedDocument(ItemSelectedChangedEventArgs args)
+ {
+ if (RefreshEnhancedDocument != null)
+ RefreshEnhancedDocument(this, args);
+ }
public event DisplayTabControlStatusEvent StatusChanged;
public void ONStatusChanged(object Sender, DisplayTabControlStatusEventArgs args)
{
@@ -76,7 +103,7 @@ namespace Volian.Controls.Library
/// "Item - " + Procedure ItemID for step pages
/// "Doc - " + DocumentID for Word Documents
///
- private Dictionary _MyDisplayTabItems;
+ public Dictionary _MyDisplayTabItems;
///
/// When a Tab is closed it is added to this list.
/// When another Tab is opened, any Tabs in this list are closed
@@ -398,14 +425,39 @@ namespace Volian.Controls.Library
}
#endregion
#region Public Methods
+ public void RefreshItem(ItemInfo myItemInfo)
+ {
+ ItemInfo proc = myItemInfo.MyProcedure; // Find procedure Item
+ string key = "Item - " + proc.ItemID.ToString();
+
+ if (_MyDisplayTabItems.ContainsKey(key)) // If procedure page open use it
+ {
+ DisplayTabItem pg = _MyDisplayTabItems[key];
+ if (pg.MyStepTabPanel.MyStepPanel._LookupEditItems.ContainsKey(myItemInfo.ItemID))
+ OpenItem(myItemInfo,false);
+ }
+ }
+ public DisplayTabItem OpenItem(ItemInfo myItemInfo2)
+ {
+ return OpenItem(myItemInfo2, true);
+ }
///
/// Open a Step Item or a Word Item
///
///
///
- public DisplayTabItem OpenItem(ItemInfo myItemInfo2)
+ public DisplayTabItem OpenItem(ItemInfo myItemInfo2, bool setFocus)
{
ItemInfo myItemInfo = myItemInfo2;
+ if(VersionID!=myItemInfo.MyDocVersion.VersionID)
+ {
+ if(_AllDTCs.ContainsKey(myItemInfo.MyDocVersion.VersionID))
+ {
+ return _AllDTCs[myItemInfo.MyDocVersion.VersionID].OpenItem(myItemInfo);
+ }
+ if(VersionID != 0)
+ return _AllDTCs[0].OpenItem(myItemInfo);
+ }
string message = string.Empty;
if (myItemInfo.MyContent.MyEntry == null) //not a document
{
@@ -440,7 +492,7 @@ namespace Volian.Controls.Library
}
_MyBar = GetParentBar(myItemInfo); // Get the docking bar associated with this item.
if (myItemInfo.MyContent.MyEntry == null) // If it is a Word document open in step editor
- return OpenStepTabPage(myItemInfo);
+ return OpenStepTabPage(myItemInfo,setFocus);
else // Otherwise open it in the Word editor
return OpenDSOTabPage(myItemInfo);
}
@@ -637,12 +689,16 @@ namespace Volian.Controls.Library
{
get { return _PnlCaret; }
}
+ private static int trackerSC = 0;
public void ShowCaret()
{
if (_MyStepRTB != null)
{
if (_MyEditItem.RTBLastFocus)
{
+ trackerSC++;
+ /*if (trackerSC>20) */Console.WriteLine("ShowCaret: {0}", trackerSC);
+ //Volian.Base.Library.vlnStackTrace.ShowStack("ShowCaret: EI: {0} StepRTB: {1}", _MyEditItem.MyItemInfo.ItemID, _MyStepRTB.MyItemInfo.ItemID);
if (!_MyStepRTB.Visible)
_MyStepRTB.Visible = true;
if (_MyStepRTB.SelectionLength == 0)
@@ -665,10 +721,14 @@ namespace Volian.Controls.Library
}
}
}
+ private static int trackerHC = 0;
public void HideCaret()
{
if (_MyStepRTB != null && !_MyStepRTB.Disposing && !_MyStepRTB.Closed)
{
+ trackerHC++;
+ /* if (trackerHC>20)*/ Console.WriteLine("HideCaret {0}", trackerHC);
+ //Volian.Base.Library.vlnStackTrace.ShowStack("HideCaret: StepRTB: {0}", _MyStepRTB.MyItemInfo.ItemID);
if (_MyStepRTB.SelectionLength == 0)
{
tmrCaret.Enabled = false;
@@ -823,23 +883,23 @@ namespace Volian.Controls.Library
///
///
///
- public bool IsItemInfoProcedureOpen(ItemInfo ii)
- {
- ItemInfo proc = ii.MyProcedure; // Find procedure Item
- if (dicEnhancedDocuments.ContainsKey(ii.MyProcedure.MyDocVersion))
- {
- frmEnhanced frm = dicEnhancedDocuments[ii.MyProcedure.MyDocVersion];
- string key = "Item - " + proc.ItemID.ToString();
- if (frm.MyDisplayTabClntrol._MyDisplayTabItems.ContainsKey(key))
- return true;
- }
- // return true;
- //return false;
- return false;
- }
- public Dictionary dicEnhancedDocuments = new Dictionary();
+ //public bool IsItemInfoProcedureOpen(ItemInfo ii)
+ // if (ii == null) return false; //{
+ // ItemInfo proc = ii.MyProcedure; // Find procedure Item
+ // if (dicEnhancedDocuments.ContainsKey(ii.MyProcedure.MyDocVersion))
+ // {
+ // frmEnhanced frm = dicEnhancedDocuments[ii.MyProcedure.MyDocVersion];
+ // string key = "Item - " + proc.ItemID.ToString();
+ // if (frm.MyDisplayTabClntrol._MyDisplayTabItems.ContainsKey(key))
+ // return true;
+ // }
+ // // return true;
+ // //return false;
+ // return false;
+ //}
+ //public Dictionary dicEnhancedDocuments = new Dictionary();
- private DisplayTabItem OpenStepTabPage(ItemInfo myItemInfo)
+ private DisplayTabItem OpenStepTabPage(ItemInfo myItemInfo, bool setFocus)
{
ItemInfo proc = myItemInfo.MyProcedure; // Find procedure Item
string key = "Item - " + proc.ItemID.ToString();
@@ -847,18 +907,24 @@ namespace Volian.Controls.Library
if (_MyDisplayTabItems.ContainsKey(key)) // If procedure page open use it
{
pg = _MyDisplayTabItems[key];
- pg.Selected = true;
- HandleChangeId(myItemInfo, pg);
- if (SelectedDisplayTabItem != pg) // If the selected page doesn't match
- SelectDisplayTabItem(pg); // Set the selected page
+ if (setFocus)
+ {
+ pg.Selected = true;
+ HandleChangeId(myItemInfo, pg);
+ if (SelectedDisplayTabItem != pg) // If the selected page doesn't match
+ SelectDisplayTabItem(pg); // Set the selected page
+ }
}
else // If not already open, create a new Page
{
pg = new DisplayTabItem(this.components, this, proc, key); // Open a new Procedure Tab
_MyDisplayTabItems.Add(key, pg);
- pg.Selected = true;
- HandleChangeId(myItemInfo, pg);
- SelectDisplayTabItem(pg);
+ if (setFocus)
+ {
+ pg.Selected = true;
+ HandleChangeId(myItemInfo, pg);
+ SelectDisplayTabItem(pg);
+ }
pg.MyStepTabPanel.MyProcedureItemInfo = proc;
// When more than one procedure is openned, the ribbon control cuts off the bottom of the buttons.
diff --git a/PROMS/Volian.Controls.Library/DisplayTabItem.cs b/PROMS/Volian.Controls.Library/DisplayTabItem.cs
index e5b46690..c895b2f5 100644
--- a/PROMS/Volian.Controls.Library/DisplayTabItem.cs
+++ b/PROMS/Volian.Controls.Library/DisplayTabItem.cs
@@ -66,6 +66,12 @@ namespace Volian.Controls.Library
get { return _MyUserRole; }
set { _MyUserRole = value; }
}
+ private bool _Closed = false;
+ public bool Closed
+ {
+ get { return _Closed; }
+ set { _Closed = value; }
+ }
///
/// Current SelectedItemInfo for this page
///
diff --git a/PROMS/Volian.Controls.Library/DisplayTags.cs b/PROMS/Volian.Controls.Library/DisplayTags.cs
index f3d0c990..266975ad 100644
--- a/PROMS/Volian.Controls.Library/DisplayTags.cs
+++ b/PROMS/Volian.Controls.Library/DisplayTags.cs
@@ -216,8 +216,16 @@ namespace Volian.Controls.Library
//if ((fmtdata.ProcData.CheckOffData.CheckOffList == null || fmtdata.ProcData.CheckOffData.CheckOffList.Count == 0) ||
// fmtdata.ProcData.CheckOffData.Menu=="Signoff")
// cmbCheckoff.Enabled = false;
-
- if (sc == null) // if there is no config data ...
+ cbCAS.Enabled = true;
+ if (((CurItemInfo.ActiveFormat.PlantFormat.FormatData.PurchaseOptions.Value & E_PurchaseOptions.EnhancedBackgrounds) == E_PurchaseOptions.EnhancedBackgrounds) ||
+ ((CurItemInfo.ActiveFormat.PlantFormat.FormatData.PurchaseOptions.Value & E_PurchaseOptions.EnhancedDeviations) == E_PurchaseOptions.EnhancedDeviations))
+ {
+ cbCAS.Enabled = false;
+ cbPageBreak.Enabled = false;
+ cbPlaceKeeper.Enabled = false;
+ cbPlaceKeeperCont.Enabled = false;
+ }
+ else if (sc == null) // if there is no config data ...
{
if (CurItemInfo.IsHigh)cbPageBreak.Checked = false; // Page Break is set to false
cbCAS.Checked = CurItemInfo.IncludeOnContActSum; // set based on step type format flag
diff --git a/PROMS/Volian.Controls.Library/DisplayTransition.cs b/PROMS/Volian.Controls.Library/DisplayTransition.cs
index 5da153f1..819472b7 100644
--- a/PROMS/Volian.Controls.Library/DisplayTransition.cs
+++ b/PROMS/Volian.Controls.Library/DisplayTransition.cs
@@ -32,7 +32,8 @@ namespace Volian.Controls.Library
if (_CurTrans == value && _CurItemFrom == MyRTB.MyItemInfo) return;
_CurItemFrom = MyRTB.MyItemInfo;
_TranFmtIndx = 0;
- btnTranSave.Enabled = UserInfo.CanEdit(MyUserInfo, Mydvi); //Can Insert Transitons
+ bool isenh = MyRTB != null && MyRTB.MyItemInfo != null && MyRTB.MyItemInfo.IsEnhancedStep;
+ btnTranSave.Enabled = !isenh && UserInfo.CanEdit(MyUserInfo, Mydvi); //Can Insert Transitons
btnTranCancel.Enabled = true;
}
else // Modify a transition
@@ -952,7 +953,8 @@ namespace Volian.Controls.Library
if (sectstartid == -1) btnTranSave.Enabled = false; // if there is an invalid section start - don't allow save.
IList chldrn = prcitm.GetChildren();
cbTranSectsFillIn((ItemInfo)chldrn[0], sectstartid, true);
- btnTranSave.Enabled = UserInfo.CanEdit(MyUserInfo, Mydvi); //Can Insert Transitons
+ bool isenh = MyRTB != null && MyRTB.MyItemInfo != null && MyRTB.MyItemInfo.IsEnhancedStep;
+ btnTranSave.Enabled = !isenh && UserInfo.CanEdit(MyUserInfo, Mydvi); //Can Insert Transitons
SaveCancelEnabling();
}
private void tvTran_AfterSelect(object sender, TreeViewEventArgs e)
@@ -961,7 +963,8 @@ namespace Volian.Controls.Library
E_TransUI etm = (E_TransUI)_CurItemFrom.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[listBoxTranFmt.SelectedIndex].TransUI;
if ((etm & E_TransUI.StepAllowNone) == E_TransUI.StepAllowNone && tvTran.SelectedNode.Tag==null)
{
- btnTranSave.Enabled = UserInfo.CanEdit(MyUserInfo, Mydvi); //Can Insert Transitons
+ bool isenh = MyRTB != null && MyRTB.MyItemInfo != null && MyRTB.MyItemInfo.IsEnhancedStep;
+ btnTranSave.Enabled = !isenh && UserInfo.CanEdit(MyUserInfo, Mydvi); //Can Insert Transitons
return;
}
// check if node is a true end-point, i.e. not a 'part' node. If part node, don't
@@ -994,7 +997,8 @@ namespace Volian.Controls.Library
tvTranRangeHilites(true, _RangeNode1, _RangeNode2);
lblxTranRangeTip.Text = "Select First Transition\r\nfor Range";
lblxTranRangeTip.BackColor = Color.Yellow;
- btnTranSave.Enabled = UserInfo.CanEdit(MyUserInfo, Mydvi); //Can Insert Transitons
+ bool isenh = MyRTB != null && MyRTB.MyItemInfo != null && MyRTB.MyItemInfo.IsEnhancedStep;
+ btnTranSave.Enabled = !isenh && UserInfo.CanEdit(MyUserInfo, Mydvi); //Can Insert Transitons
}
}
}
@@ -1003,7 +1007,8 @@ namespace Volian.Controls.Library
//bool hasChanged = _CurItemFrom != _SavCurItemFrom || _TranFmtIndx != _SavTranFmtIndx
// || ( selii != null && _CurTrans.ToID != selii.ItemID);
bool hasChanged = SettingsChanged;
- btnTranSave.Enabled = hasChanged && UserInfo.CanEdit(MyUserInfo, Mydvi); //Can Insert Transitons
+ bool isenh = MyRTB != null && MyRTB.MyItemInfo != null && MyRTB.MyItemInfo.IsEnhancedStep;
+ btnTranSave.Enabled = !isenh && hasChanged && UserInfo.CanEdit(MyUserInfo, Mydvi); //Can Insert Transitons
btnTranCancel.Enabled = _CurTrans != null && hasChanged;
//btnTranSave.Enabled = allowSave;
//if (CurTrans != null && selii != null)
diff --git a/PROMS/Volian.Controls.Library/EditItem.cs b/PROMS/Volian.Controls.Library/EditItem.cs
index 628e3f51..53a57179 100644
--- a/PROMS/Volian.Controls.Library/EditItem.cs
+++ b/PROMS/Volian.Controls.Library/EditItem.cs
@@ -683,7 +683,25 @@ namespace Volian.Controls.Library
private static int xOffset = 0;
public void RemoveItem()
{
- //Volian.Base.Library.VlnTimer _MyTimer = new VlnTimer();
+ // if this item has enhanced edititems, remove them:
+ StepConfig sc = MyItemInfo.MyConfig as StepConfig;
+ List thisEnhs = null;
+ if (sc != null)
+ thisEnhs = sc.MyEnhancedDocuments;
+ else
+ {
+ if (MyItemInfo.IsSection)
+ {
+ SectionConfig secc = MyItemInfo.MyConfig as SectionConfig;
+ if (secc.Section_LnkEnh=="Y")thisEnhs = secc.MyEnhancedDocuments;
+ }
+ }
+
+ List enhIds = new List();
+ foreach (EnhancedDocument ed in thisEnhs)
+ {
+ if (ed.Type != 0) enhIds.Add(ed.ItemID);
+ }
BeingRemoved = true;
MyStepPanel.SelectedEditItem = null; // Unselect the item to be deleted
//ShowTops("\r\n");
@@ -717,6 +735,13 @@ namespace Volian.Controls.Library
//_MyTimer.ShowElapsedTimes("RemoveItem");
ForceEditItemRefresh(newFocus);
MyStepPanel.Controls.Remove(pnl);
+ foreach (int enhId in enhIds)
+ {
+ ItemInfo ii = ItemInfo.Get(enhId);
+ bool success = this._MyStepPanel.MyStepTabPanel.MyDisplayTabControl.DeleteRTBItem(ii);
+ if (!success) // item was not displayed in editor, just delete from database (add tree if necessarY)
+ Item.DeleteItemAndChildren(ii);
+ }
}
private static void ForceEditItemRefresh(EditItem newFocus)
@@ -998,9 +1023,9 @@ namespace Volian.Controls.Library
if (MyStepPanel.SelectedEditItem is RTBItem)
{
RTBItem rtbi = MyStepPanel.SelectedEditItem as RTBItem;
- // see if this step has associated enhanced step(s):
- StepConfig sc = new StepConfig(MyItemInfo.MyContent.Config);
-
+ // see if this step has associated enhanced step(s). If it does, flag it so
+ // that the enhanced steps get inserted also.
+ StepConfig sc = new StepConfig(MyItemInfo.MyContent.Config);
if (sc.MyEnhancedDocuments.Count > 0)
{
rtbi.EnhAddFromItemInfo = MyItemInfo;
@@ -1034,6 +1059,18 @@ namespace Volian.Controls.Library
ItemInfo newItemInfo = MyItemInfo.InsertSiblingAfter("", "", type);
AddGridIfNeeded(newItemInfo);
DoAddSiblingAfter(newItemInfo, updateStatus);
+ if (MyStepPanel.SelectedEditItem is RTBItem)
+ {
+ RTBItem rtbi = MyStepPanel.SelectedEditItem as RTBItem;
+ // see if this step has associated enhanced step(s). If it does, flag it so
+ // that the enhanced steps get inserted also.
+ StepConfig sc = new StepConfig(MyItemInfo.MyContent.Config);
+ if (sc.MyEnhancedDocuments.Count > 0)
+ {
+ rtbi.EnhAddFromItemInfo = MyItemInfo;
+ rtbi.EnhAddType = EnhancedAddTypes.After;
+ }
+ }
}
private void DoAddSiblingAfter(ItemInfo newItemInfo, bool updateStatus)
{
@@ -1083,7 +1120,8 @@ namespace Volian.Controls.Library
if (MyStepPanel.SelectedEditItem is RTBItem)
{
RTBItem rtbi = MyStepPanel.SelectedEditItem as RTBItem;
- // see if this step has associated enhanced step(s):
+ // see if this step has associated enhanced step(s). If it does, flag it so
+ // that the enhanced steps get inserted also.
StepConfig sc = new StepConfig(MyItemInfo.MyContent.Config);
if (sc.MyEnhancedDocuments.Count > 0)
{
@@ -1206,9 +1244,21 @@ namespace Volian.Controls.Library
if (MyStepPanel.SelectedEditItem is RTBItem)
{
RTBItem rtbi = MyStepPanel.SelectedEditItem as RTBItem;
- // see if this step has associated enhanced step(s):
- StepConfig sc = new StepConfig(MyItemInfo.MyContent.Config);
- if (sc.MyEnhancedDocuments.Count > 0)
+ // see if this step has associated enhanced step(s). If it does, flag it so
+ // that the enhanced steps get inserted also.
+ EnhancedDocuments cfgeds = null;
+ if (MyItemInfo.IsStepSection)
+ {
+ SectionConfig scfg = MyItemInfo.MyConfig as SectionConfig;
+ if (scfg.Section_LnkEnh != "Y") return;
+ cfgeds = scfg.MyEnhancedDocuments;
+ }
+ else
+ {
+ StepConfig sc = new StepConfig(MyItemInfo.MyContent.Config);
+ cfgeds = sc.MyEnhancedDocuments;
+ }
+ if (cfgeds != null && cfgeds.Count > 0)
{
rtbi.EnhAddFromItemInfo = MyItemInfo;
rtbi.EnhAddType = EnhancedAddTypes.Child;
@@ -1294,8 +1344,10 @@ namespace Volian.Controls.Library
if (newEditItem != null) MyStepPanel.SelectedEditItem = newEditItem;//Update Screen
MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OnItemPaste(this, new vlnTreeItemInfoPasteEventArgs(newItemInfo, copyStartID, ItemInfo.EAddpingPart.Before, newItemInfo.MyContent.Type));
+ // MyItemInfo is the 'paste from' item, if it has enhanced need to copy and paste the steps in enhanced.
+ newItemInfo.EnhancedPasteItem(copyStartID, MyItemInfo, ItemInfo.EAddpingPart.Before, GetChangeId(MyItemInfo));
}
-
+
private string GetChangeId(ItemInfo iiDest)
{
// get the change id for the destination's procedure's change id.
@@ -1326,6 +1378,8 @@ namespace Volian.Controls.Library
MyStepPanel.SelectedEditItem = newEditItem;//Update Screen
MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OnItemPaste(this, new vlnTreeItemInfoPasteEventArgs(newItemInfo, copyStartID, ItemInfo.EAddpingPart.After, newItemInfo.MyContent.Type));
+ // MyItemInfo is the 'paste from' item, if it has enhanced need to copy and paste the steps in enhanced.
+ newItemInfo.EnhancedPasteItem(copyStartID, MyItemInfo, ItemInfo.EAddpingPart.After, GetChangeId(MyItemInfo));
}
public void PasteChild(int copyStartID)
{
@@ -1375,6 +1429,9 @@ namespace Volian.Controls.Library
break;
}
MyStepPanel.SelectedEditItem = newEditItem;//Update Screen
+
+ // MyItemInfo is the 'paste from' item, if it has enhanced need to copy and paste the steps in enhanced.
+ newItemInfo.EnhancedPasteItem(copyStartID, MyItemInfo, ItemInfo.EAddpingPart.Child, GetChangeId(MyItemInfo));
}
public EditItem PasteReplace(int copyStartID)
{
@@ -1389,6 +1446,7 @@ namespace Volian.Controls.Library
EditItem prevEditItem = MyPreviousEditItem;
EditItem parentEditItem = ActiveParent;
+ StepConfig savOrigPasteConfig = MyItemInfo.MyConfig as StepConfig;
int TopMostYBefore = TopMostEditItem.Top;
int? TopMostParentY = (MyParentEditItem == null ? null : (int?)(MyParentEditItem.TopMostEditItem.Top));
int? ParentY = (MyParentEditItem == null ? null : (int?)(MyParentEditItem.Top));
@@ -1452,6 +1510,8 @@ namespace Volian.Controls.Library
}
MyStepPanel.SelectedEditItem = newEditItem; //Update Screen
MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OnItemPaste(this, new vlnTreeItemInfoPasteEventArgs(newItemInfo, copyStartID, ItemInfo.EAddpingPart.Replace, newItemInfo.MyContent.Type));
+ // MyItemInfo is the 'paste from' item, if it has enhanced need to copy and paste the steps in enhanced.
+ newItemInfo.EnhancedPasteItem(copyStartID, MyItemInfo, ItemInfo.EAddpingPart.Replace, GetChangeId(MyItemInfo));
return newEditItem;
}
private bool HandleSqlExceptionOnCopy(Exception ex)