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:
Kathy Ruffing 2016-01-20 16:43:23 +00:00
parent 77cdf81736
commit 6366af8b47
17 changed files with 1132 additions and 243 deletions

View File

@ -28,15 +28,12 @@ namespace VEPROMS.CSLA.Library
}
return eds;
}
public DVEnhancedDocument this[int type]
{
get
public DVEnhancedDocument GetByType(int type)
{
foreach (DVEnhancedDocument ed in this)
if (ed.Type == type) return ed;
return null;
}
}
public DVEnhancedDocument this[string name]
{
get
@ -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): <Enhanced Type="Background" ItemID="43138" /><Enhanced Type="Deviation" ItemID="67165" />
// // 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
{

View File

@ -54,6 +54,7 @@ namespace DescriptiveEnum
public static string GetEnumDescription(System.Type value, string name)
{
FieldInfo fi= value.GetField(name);
if (fi == null) return "";
DescriptionAttribute[] attributes =
(DescriptionAttribute[])fi.GetCustomAttributes(
typeof(DescriptionAttribute), false);

View File

@ -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): <Enhanced Type="Background" ItemID="43138" /><Enhanced Type="Deviation" ItemID="67165" />
// 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

View File

@ -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<XmlNode> nodesToDel = new List<XmlNode>();
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): <Enhanced Type="Background" ItemID="43138" /><Enhanced Type="Deviation" ItemID="67165" />
// 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
}
}

View File

@ -22,16 +22,13 @@ namespace VEPROMS.CSLA.Library
}
return ed;
}
public EnhancedDocument this[int type]
{
get
public EnhancedDocument GetByType(int type)
{
foreach (EnhancedDocument ed in this)
if (ed.Type == type) return ed;
return null;
}
}
}
public partial class EnhancedDocument
{
private int _Type;
@ -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)
{

View File

@ -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);
@ -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;
@ -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;
@ -1437,7 +1465,7 @@ namespace VEPROMS.CSLA.Library
get
{
if (ItemID == 95759 && _FromType == null)
Console.WriteLine("\"Null FromType\",{0},{1},\"{2}\",{3}", ItemID, MyContent.Type,DisplayNumber,MyItemInfoUnique);
Console.WriteLine("\"Null FromType\",{0},{1},\"{2}\",{3}", ItemID, MyContent.Type, DisplayNumber, MyItemInfoUnique);
return _FromType;
}
set { _FromType = value; }
@ -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
@ -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
@ -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;
@ -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));
}
@ -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"))
{
@ -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;
@ -4327,7 +4468,7 @@ namespace VEPROMS.CSLA.Library
// template also uses the text, not just the type, to find a match in the template.
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++;
}
@ -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
@ -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

View File

@ -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,9 +1000,425 @@ 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
private void DataPortal_Fetch(PastingPartCriteria criteria)

View File

@ -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;

View File

@ -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

View File

@ -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
{
// 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);
Content cc = ii.MyContent.Get();
cc.Text = tmp.Text;
cc.Save();
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)

View File

@ -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)

View File

@ -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<int, DisplayTabControl> _AllDTCs = new Dictionary<int, DisplayTabControl>();
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
/// </summary>
private Dictionary<string, DisplayTabItem> _MyDisplayTabItems;
public Dictionary<string, DisplayTabItem> _MyDisplayTabItems;
/// <summary>
/// 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);
}
/// <summary>
/// Open a Step Item or a Word Item
/// </summary>
/// <param name="myItemInfo"></param>
/// <returns></returns>
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
/// </summary>
/// <param name="myItemInfo"></param>
/// <returns></returns>
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;
}
//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 false;
return false;
}
public Dictionary<DocVersionInfo, frmEnhanced> dicEnhancedDocuments = new Dictionary<DocVersionInfo, frmEnhanced>();
// }
// // return true;
// //return false;
// return false;
//}
//public Dictionary<DocVersionInfo, frmEnhanced> dicEnhancedDocuments = new Dictionary<DocVersionInfo, frmEnhanced>();
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];
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);
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.

View File

@ -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; }
}
/// <summary>
/// Current SelectedItemInfo for this page
/// </summary>

View File

@ -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

View File

@ -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)

View File

@ -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<EnhancedDocument> 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<int> enhIds = new List<int>();
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):
// 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):
// 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);
if (sc.MyEnhancedDocuments.Count > 0)
cfgeds = sc.MyEnhancedDocuments;
}
if (cfgeds != null && cfgeds.Count > 0)
{
rtbi.EnhAddFromItemInfo = MyItemInfo;
rtbi.EnhAddType = EnhancedAddTypes.Child;
@ -1294,6 +1344,8 @@ 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)
@ -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)