Support for SAMGS Supplemental Information

This commit is contained in:
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)