Support for SAMGS Supplemental Information

This commit is contained in:
Kathy Ruffing 2017-05-03 13:57:12 +00:00
parent 419dd4712a
commit e7f9d4e3ed
8 changed files with 210 additions and 22 deletions

View File

@ -3407,6 +3407,9 @@ namespace VEPROMS
case "steps":
AddSteps(xn, parentInfo);
break;
case "supinfos":
AddSupInfos(xn, parentInfo);
break;
case "tables":
AddTables(xn, parentInfo);
break;
@ -3625,7 +3628,23 @@ namespace VEPROMS
foreach (XmlNode nd in xn.ChildNodes)
prevInfo = AddRNO(nd, parentInfo, prevInfo);
}
private void AddSupInfos(XmlNode xn, ItemInfo parentInfo)
{
if (parentInfo.IsProcedure)
{
pbImportSection.Value = 0;
pbImportStep.Value = 0;
pbImportSection.Maximum = xn.ChildNodes.Count;
}
if (parentInfo.IsSection)
{
pbImportStep.Value = 0;
pbImportStep.Maximum = xn.ChildNodes.Count;
}
ItemInfo prevInfo = null;
foreach (XmlNode nd in xn.ChildNodes)
prevInfo = AddSupInfo(nd, parentInfo, prevInfo);
}
// jsj 4-29-2016 appears to not be used
//private ItemInfo AddRNO(XmlReader xr, ItemInfo parentInfo, ItemInfo prevInfo, int oldid)
//{
@ -3702,6 +3721,52 @@ namespace VEPROMS
}
return prevInfo;
}
private ItemInfo AddSupInfo(XmlNode xn, ItemInfo parentInfo, ItemInfo prevInfo)
{
pbImportStep.PerformStep();
lblImportStep.Text = string.Format("{0} of {1} Steps", pbImportStep.Value.ToString(), pbImportStep.Maximum.ToString());
Application.DoEvents();
XmlNode xc = xn.SelectSingleNode("content");
Step step;
string number = xc.Attributes.GetNamedItem("number").InnerText;
string text = xc.Attributes.GetNamedItem("text").InnerText;
int steptype = int.Parse(xc.Attributes.GetNamedItem("type").InnerText);
string formatid = xc.Attributes.GetNamedItem("formatid").InnerText;
string config = xc.Attributes.GetNamedItem("config").InnerText;
config = StripEnhanced(config);
int contentid = int.Parse(xc.Attributes.GetNamedItem("contentid").InnerText);
CheckForFloatingFoldout(contentid, config);
string userid = xc.Attributes.GetNamedItem("userid").InnerText;
DateTime dts = DateTime.Parse(xc.Attributes.GetNamedItem("dts").InnerText);
using (step = Step.MakeStep(parentInfo, prevInfo, number, text, steptype, E_FromType.SupInfo))
{
step.DTS = dts;
step.UserID = userid;
// check for a null in case an older export file is being imported (the older files will not have the fromatfilename attribute)
XmlNode fnNode = xc.Attributes.GetNamedItem("formatfilename"); //Bug fix B2016-103 the formatid in an Export file may not match the formatid where you are importing to
string formatfilename = (fnNode != null) ? fnNode.InnerText : "";
if (formatid != string.Empty)
step.MyContent.MyFormat = OldToNewFormat(int.Parse(formatid), formatfilename);
step.MyContent.Config = config;
step.MyContent.DTS = dts;
step.MyContent.UserID = userid;
step.Save();
if (!Old2NewItem.ContainsKey(int.Parse(xn.Attributes.GetNamedItem("itemid").InnerText)))
Old2NewItem.Add(int.Parse(xn.Attributes.GetNamedItem("itemid").InnerText), step.ItemID);
if (!Old2NewContent.ContainsKey(int.Parse(xc.Attributes.GetNamedItem("contentid").InnerText)))
Old2NewContent.Add(int.Parse(xc.Attributes.GetNamedItem("contentid").InnerText), step.MyContent.ContentID);
if (xn.SelectNodes("annotation").Count > 0)
AddAnnotations(step.ItemID, xn);
if (xc.SelectNodes("rousage").Count > 0)
AddROUsages(step.MyContent, xc);
if (xc.SelectNodes("transition").Count > 0)
AddTransitions(step.MyContent, xc);
prevInfo = StepInfo.Get(step.ItemID);
if (xc.HasChildNodes)
AddParts(xc, prevInfo);
}
return prevInfo;
}
private void AddNotes(XmlNode xn, ItemInfo parentInfo)
{
if (parentInfo.IsProcedure)

View File

@ -821,17 +821,10 @@ namespace VEPROMS.CSLA.Library
{
get
{
//int result = 0;
foreach (ContentPart cp in _Section.MyContent.ContentParts)
{
if (cp.FromType == 2)
if (cp.FromType == (int)E_FromType.Section)
return true;
//if (cp.FromType == 2) result += 1;
//if (cp.FromType == 6) result += 2;
//if (result == 3)
//{
// return true;
//}
}
return false;
}

View File

@ -297,6 +297,24 @@ namespace VEPROMS.CSLA.Library
OnPropertyChanged("Step_NewManualPagebreak");
}
}
public bool Step_PreferredPagebreak
{
get
{
string s = _Xp["Step", "PreferredPagebreak"];
if (s == string.Empty) return false;
if (s == "True") return true;
return false;
}
set
{
string s = _Xp["Step", "PreferredPagebreak"];
if (value.ToString() == s) return;
_Xp["Step", "PreferredPagebreak"] = value.ToString();
OnPropertyChanged("Step_PreferredPagebreak");
}
}
//[Category("Step Attributes")]
//[DisplayName("Step Change Bar Override")]
//[RefreshProperties(RefreshProperties.All)]

View File

@ -509,6 +509,9 @@ namespace VEPROMS.CSLA.Library
case E_FromType.Table:
myItemInfo._Tables = pi.MyItems;
break;
case E_FromType.SupInfo:
myItemInfo._SupInfos = pi.MyItems;
break;
}
foreach (ItemInfo ii in pi.MyItems)
{
@ -846,7 +849,7 @@ namespace VEPROMS.CSLA.Library
// Console.WriteLine("Items: {0}", TimeSpan.FromTicks(ticksItems).TotalSeconds);
// Console.WriteLine("Transitions: {0}", TimeSpan.FromTicks(ticksTrans).TotalSeconds);
//}
internal static string GetCombinedTab(ItemInfo itemInfo, string parTab)
public static string GetCombinedTab(ItemInfo itemInfo, string parTab)
{
string pTab = parTab == null ? "" : parTab;
int profileDepth = ProfileTimer.Push(">>>> itemInfo.MyTab.CleanText.Trim");
@ -1787,6 +1790,16 @@ namespace VEPROMS.CSLA.Library
return retval;
}
}
public bool IsSupInfoPart
{
get
{
if (FromType != null)
return (FromType == E_FromType.SupInfo);
bool retval = ((ItemPartCount > 0) && (ItemParts[0].PartType == E_FromType.SupInfo));
return retval;
}
}
public bool IsInRNO
{
get
@ -1798,6 +1811,17 @@ namespace VEPROMS.CSLA.Library
return parent.IsInRNO;
}
}
public bool IsInSupInfo
{
get
{
if (IsHigh) return false;
if (IsSupInfoPart) return true;
ItemInfo parent = ActiveParent as ItemInfo;
if (parent == null) return false;
return parent.IsInSupInfo;
}
}
public bool IsRtfRaw
{
get
@ -2903,11 +2927,11 @@ namespace VEPROMS.CSLA.Library
}
#endregion
#region Lookups and More Related
private ItemInfoList Lookup(int fromType, ref ItemInfoList itemInfoList)
private ItemInfoList Lookup(E_FromType fromType, ref ItemInfoList itemInfoList)
{
//Console.WriteLine(itemInfoList);
if (itemInfoList == null)
itemInfoList = Lookup(fromType);
itemInfoList = Lookup((int)fromType);
return itemInfoList;
}
private bool _LoadAllAtOnce;
@ -2958,28 +2982,32 @@ namespace VEPROMS.CSLA.Library
_RNOs = null;
_Steps = null;
_Tables = null;
_SupInfos = null;
}
private ItemInfoList _Procedures;
public ItemInfoList Procedures
{ get { return Lookup(1, ref _Procedures); } }
{ get { return Lookup(E_FromType.Procedure, ref _Procedures); } }
private ItemInfoList _Sections;
public ItemInfoList Sections
{ get { return Lookup(2, ref _Sections); } }
{ get { return Lookup(E_FromType.Section, ref _Sections); } }
private ItemInfoList _Cautions;
public ItemInfoList Cautions
{ get { return Lookup(3, ref _Cautions); } }
{ get { return Lookup(E_FromType.Caution, ref _Cautions); } }
private ItemInfoList _Notes;
public ItemInfoList Notes
{ get { return Lookup(4, ref _Notes); } }
{ get { return Lookup(E_FromType.Note, ref _Notes); } }
private ItemInfoList _RNOs;
public ItemInfoList RNOs
{ get { return Lookup(5, ref _RNOs); } }
{ get { return Lookup(E_FromType.RNO, ref _RNOs); } }
private ItemInfoList _Steps;
public ItemInfoList Steps
{ get { return Lookup(6, ref _Steps); } }
{ get { return Lookup(E_FromType.Step, ref _Steps); } }
private ItemInfoList _Tables;
public ItemInfoList Tables
{ get { return Lookup(7, ref _Tables); } }
{ get { return Lookup(E_FromType.Table, ref _Tables); } }
private ItemInfoList _SupInfos;
public ItemInfoList SupInfos
{ get { return Lookup(E_FromType.SupInfo, ref _SupInfos); } }
//public void ResetChildren()
//{
// _Procedures = null;
@ -3550,6 +3578,13 @@ namespace VEPROMS.CSLA.Library
}
_TagsSetup = true;
}
public bool SupplementalInformation
{
get
{
return MyDocStyle == null ? false : MyDocStyle.SupplementalInformation;
}
}
protected void SetTabText()
{
if (IsSection) // B2016-160 Support transitions to sections
@ -3558,6 +3593,14 @@ namespace VEPROMS.CSLA.Library
_MyTab.CleanText = DisplayNumber;
return;
}
// this is used for edit, print uses combinedtabs in the print code. When combined tabs were used for edit,
// part of the supinfo text overwrote tabs on screen.
if (IsSupInfoPart)
{
_MyTab.Text = MyParent.MyTab.Text;
_MyTab.CleanText = MyParent.MyTab.CleanText;
return;
}
string cltext = null;
int stepType = (int)(MyContent.Type % 10000);
string tbformat;
@ -4941,7 +4984,6 @@ namespace VEPROMS.CSLA.Library
}
}
#endregion
}
#endregion ItemInfo
#region Tab
@ -6225,6 +6267,27 @@ namespace VEPROMS.CSLA.Library
[Serializable()]
public partial class ProcedureInfo : ItemInfo, IVEDrillDownReadOnly
{
private bool? _ProcHasSupInfoData = null;
public bool ProcHasSupInfoData
{
get
{
if (_ProcHasSupInfoData == null)
{
_ProcHasSupInfoData = GetProcHasSupInfoData();
}
return (bool)_ProcHasSupInfoData;
}
set { _ProcHasSupInfoData = value; }
}
private bool GetProcHasSupInfoData()
{
foreach (SectionInfo mySection in Sections)
{
if (mySection.MyDocStyle.SupplementalInformation && mySection.HasSupInfoSteps) return true;
}
return false;
}
public bool CreateEnhanced = false;
public string PDFNumber
{
@ -6822,6 +6885,30 @@ namespace VEPROMS.CSLA.Library
[Serializable()]
public partial class SectionInfo : ItemInfo, IVEDrillDownReadOnly
{
// Determine if this section contains any Supplemental information steps. This is used for print to determine
// whether some of the supinfo processing needs to occur.
private bool? _HasSupInfoSteps = null;
public bool HasSupInfoSteps
{
get
{
if (_HasSupInfoSteps == null)
{
_HasSupInfoSteps = GetSupInfoSteps(this);
}
return (bool)_HasSupInfoSteps;
}
set { _HasSupInfoSteps = value; }
}
private static bool GetSupInfoSteps(ItemInfo ii)
{
if (ii.SupInfos != null && ii.SupInfos.Count > 0) return true;
if (ii.MyContent.ContentParts != null)
foreach (PartInfo pi in ii.MyContent.ContentParts)
foreach (ItemInfo iic in pi.MyItems)
if (GetSupInfoSteps(iic)) return true;
return false;
}
private bool? _HasStepCheckOffs = null;
public bool HasStepCheckOffs
{

View File

@ -356,6 +356,7 @@ namespace VEPROMS.CSLA.Library
tmp.UpdateROText();
OnNewSiblingBefore(new ItemInfoInsertEventArgs(tmp, EAddpingPart.Before));
((ItemInfo)ActiveParent).MyContent.RefreshContentParts();
if (tmp.IsSupInfoPart) (MyActiveSection as SectionInfo).HasSupInfoSteps = true;
return tmp;
}
private ItemInfo InsertSmartTemplateSubStep(string text, string number, ItemInfo tmp, EAddpingPart adPart, int type, E_FromType fromTypeTop)
@ -698,6 +699,7 @@ namespace VEPROMS.CSLA.Library
// 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();
if (tmp.IsSupInfoPart) (MyActiveSection as SectionInfo).HasSupInfoSteps = true;
OnNewSiblingAfter(new ItemInfoInsertEventArgs(tmp, EAddpingPart.After));
return tmp;
}
@ -867,6 +869,8 @@ namespace VEPROMS.CSLA.Library
tmp.UpdateTransitionText();
tmp.UpdateROText();
MyContent.RefreshContentParts();
ResetParts();
if (tmp.IsSupInfoPart) (MyActiveSection as SectionInfo).HasSupInfoSteps = true;
OnNewChild(new ItemInfoInsertEventArgs(tmp, EAddpingPart.Child));
return tmp;
}

View File

@ -103,6 +103,9 @@ namespace VEPROMS.CSLA.Library
else
partText = ".Table";
break;
case E_FromType.SupInfo:
partText = ".SupInfo";
break;
default:
break;
}
@ -244,10 +247,10 @@ namespace VEPROMS.CSLA.Library
public enum E_FromType : int
{
Procedure = 1, Section = 2, Caution = 3, Note = 4, RNO = 5, Step = 6, Table = 7
Procedure = 1, Section = 2, Caution = 3, Note = 4, RNO = 5, Step = 6, Table = 7, SupInfo = 8
}
public enum E_FromTypes : int
{
Procedures = 1, Sections = 2, Cautions = 3, Notes = 4, RNOs = 5, Steps = 6, Tables = 7
Procedures = 1, Sections = 2, Cautions = 3, Notes = 4, RNOs = 5, Steps = 6, Tables = 7, SupInfos = 8
}
}

View File

@ -144,6 +144,18 @@ namespace VEPROMS.CSLA.Library
}
}
#endregion
#region SupplementalInfo
[Category("Miscellaneous")]
[Description("Supports Supplemental Information")]
private LazyLoad<bool> _SupplementalInformation;
public bool SupplementalInformation
{
get
{
return LazyLoad(ref _SupplementalInformation, "@SupplementalInformation");
}
}
#endregion
#region LandscapePageList
[Category("Miscellaneous")]
[Description("Should PageList be landscape")]

View File

@ -707,6 +707,9 @@ namespace Volian.Controls.Library
case E_FromType.Table:
MyEditItem.AddChildAfter(ii, nextItem);
break;
case E_FromType.SupInfo:
MyEditItem.AddChildSupInfo(ii, nextItem);
break;
default:
MyEditItem.AddChildAfter(ii, nextItem);
break;
@ -739,6 +742,9 @@ namespace Volian.Controls.Library
case ChildRelation.RNO:
MyEditItem.ActiveParent.AddChildRNO(ii, nextItem);
break;
case ChildRelation.SupInfo:
MyEditItem.ActiveParent.AddChildSupInfo(ii, nextItem);
break;
default:
break;
}