Refresh NextItems when looking for Range transition Item

Dispose of steps as they are imported.
This commit is contained in:
Rich 2016-08-03 15:12:04 +00:00
parent 4293219f16
commit 56ab02c3f7
2 changed files with 139 additions and 127 deletions

View File

@ -3123,33 +3123,35 @@ namespace VEPROMS
CheckForFloatingFoldout(contentid, config); CheckForFloatingFoldout(contentid, config);
string userid = xc.Attributes.GetNamedItem("userid").InnerText; string userid = xc.Attributes.GetNamedItem("userid").InnerText;
DateTime dts = DateTime.Parse(xc.Attributes.GetNamedItem("dts").InnerText); DateTime dts = DateTime.Parse(xc.Attributes.GetNamedItem("dts").InnerText);
step = Step.MakeStep(parentInfo, prevInfo, number, text, steptype, E_FromType.Table); using (step = Step.MakeStep(parentInfo, prevInfo, number, text, steptype, E_FromType.Table))
step.DTS = dts; {
step.UserID = userid; step.DTS = dts;
// check for a null in case an older export file is being imported (the older files will not have the fromatfilename attribute) step.UserID = userid;
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 // check for a null in case an older export file is being imported (the older files will not have the fromatfilename attribute)
string formatfilename = (fnNode != null) ? fnNode.InnerText : ""; 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
if (formatid != string.Empty) string formatfilename = (fnNode != null) ? fnNode.InnerText : "";
step.MyContent.MyFormat = OldToNewFormat(int.Parse(formatid),formatfilename); if (formatid != string.Empty)
step.MyContent.Config = config; step.MyContent.MyFormat = OldToNewFormat(int.Parse(formatid), formatfilename);
step.MyContent.DTS = dts; step.MyContent.Config = config;
step.MyContent.UserID = userid; step.MyContent.DTS = dts;
step.Save(); step.MyContent.UserID = userid;
if (!Old2NewItem.ContainsKey(int.Parse(xn.Attributes.GetNamedItem("itemid").InnerText))) step.Save();
Old2NewItem.Add(int.Parse(xn.Attributes.GetNamedItem("itemid").InnerText), step.ItemID); if (!Old2NewItem.ContainsKey(int.Parse(xn.Attributes.GetNamedItem("itemid").InnerText)))
if (!Old2NewContent.ContainsKey(int.Parse(xc.Attributes.GetNamedItem("contentid").InnerText))) Old2NewItem.Add(int.Parse(xn.Attributes.GetNamedItem("itemid").InnerText), step.ItemID);
Old2NewContent.Add(int.Parse(xc.Attributes.GetNamedItem("contentid").InnerText), step.MyContent.ContentID); if (!Old2NewContent.ContainsKey(int.Parse(xc.Attributes.GetNamedItem("contentid").InnerText)))
if (xc.SelectNodes("grid").Count > 0) Old2NewContent.Add(int.Parse(xc.Attributes.GetNamedItem("contentid").InnerText), step.MyContent.ContentID);
AddGrid(step.MyContent, xc); if (xc.SelectNodes("grid").Count > 0)
if (xn.SelectNodes("annotation").Count > 0) AddGrid(step.MyContent, xc);
AddAnnotations(step.ItemID, xn); if (xn.SelectNodes("annotation").Count > 0)
if (xc.SelectNodes("rousage").Count > 0) AddAnnotations(step.ItemID, xn);
AddROUsages(step.MyContent, xc); if (xc.SelectNodes("rousage").Count > 0)
if (xc.SelectNodes("transition").Count > 0) AddROUsages(step.MyContent, xc);
AddTransitions(step.MyContent, xc); if (xc.SelectNodes("transition").Count > 0)
prevInfo = StepInfo.Get(step.ItemID); AddTransitions(step.MyContent, xc);
if (xc.HasChildNodes) prevInfo = StepInfo.Get(step.ItemID);
AddParts(xc, prevInfo); if (xc.HasChildNodes)
AddParts(xc, prevInfo);
}
return prevInfo; return prevInfo;
} }
private void AddSteps(XmlNode xn, ItemInfo parentInfo) private void AddSteps(XmlNode xn, ItemInfo parentInfo)
@ -3212,31 +3214,33 @@ namespace VEPROMS
CheckForFloatingFoldout(contentid, config); CheckForFloatingFoldout(contentid, config);
string userid = xc.Attributes.GetNamedItem("userid").InnerText; string userid = xc.Attributes.GetNamedItem("userid").InnerText;
DateTime dts = DateTime.Parse(xc.Attributes.GetNamedItem("dts").InnerText); DateTime dts = DateTime.Parse(xc.Attributes.GetNamedItem("dts").InnerText);
step = Step.MakeStep(parentInfo, prevInfo, number, text, steptype, E_FromType.Step); using (step = Step.MakeStep(parentInfo, prevInfo, number, text, steptype, E_FromType.Step))
step.DTS = dts; {
step.UserID = userid; step.DTS = dts;
// check for a null in case an older export file is being imported (the older files will not have the fromatfilename attribute) step.UserID = userid;
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 // check for a null in case an older export file is being imported (the older files will not have the fromatfilename attribute)
string formatfilename = (fnNode != null) ? fnNode.InnerText : ""; 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
if (formatid != string.Empty) string formatfilename = (fnNode != null) ? fnNode.InnerText : "";
step.MyContent.MyFormat = OldToNewFormat(int.Parse(formatid), formatfilename); if (formatid != string.Empty)
step.MyContent.Config = config; step.MyContent.MyFormat = OldToNewFormat(int.Parse(formatid), formatfilename);
step.MyContent.DTS = dts; step.MyContent.Config = config;
step.MyContent.UserID = userid; step.MyContent.DTS = dts;
step.Save(); step.MyContent.UserID = userid;
if (!Old2NewItem.ContainsKey(int.Parse(xn.Attributes.GetNamedItem("itemid").InnerText))) step.Save();
Old2NewItem.Add(int.Parse(xn.Attributes.GetNamedItem("itemid").InnerText), step.ItemID); if (!Old2NewItem.ContainsKey(int.Parse(xn.Attributes.GetNamedItem("itemid").InnerText)))
if (!Old2NewContent.ContainsKey(int.Parse(xc.Attributes.GetNamedItem("contentid").InnerText))) Old2NewItem.Add(int.Parse(xn.Attributes.GetNamedItem("itemid").InnerText), step.ItemID);
Old2NewContent.Add(int.Parse(xc.Attributes.GetNamedItem("contentid").InnerText), step.MyContent.ContentID); if (!Old2NewContent.ContainsKey(int.Parse(xc.Attributes.GetNamedItem("contentid").InnerText)))
if (xn.SelectNodes("annotation").Count > 0) Old2NewContent.Add(int.Parse(xc.Attributes.GetNamedItem("contentid").InnerText), step.MyContent.ContentID);
AddAnnotations(step.ItemID, xn); if (xn.SelectNodes("annotation").Count > 0)
if (xc.SelectNodes("rousage").Count > 0) AddAnnotations(step.ItemID, xn);
AddROUsages(step.MyContent, xc); if (xc.SelectNodes("rousage").Count > 0)
if (xc.SelectNodes("transition").Count > 0) AddROUsages(step.MyContent, xc);
AddTransitions(step.MyContent, xc); if (xc.SelectNodes("transition").Count > 0)
prevInfo = StepInfo.Get(step.ItemID); AddTransitions(step.MyContent, xc);
if (xc.HasChildNodes) prevInfo = StepInfo.Get(step.ItemID);
AddParts(xc, prevInfo); if (xc.HasChildNodes)
AddParts(xc, prevInfo);
}
return prevInfo; return prevInfo;
} }
private void AddRNOs(XmlNode xn, ItemInfo parentInfo) private void AddRNOs(XmlNode xn, ItemInfo parentInfo)
@ -3300,31 +3304,33 @@ namespace VEPROMS
CheckForFloatingFoldout(contentid, config); CheckForFloatingFoldout(contentid, config);
string userid = xc.Attributes.GetNamedItem("userid").InnerText; string userid = xc.Attributes.GetNamedItem("userid").InnerText;
DateTime dts = DateTime.Parse(xc.Attributes.GetNamedItem("dts").InnerText); DateTime dts = DateTime.Parse(xc.Attributes.GetNamedItem("dts").InnerText);
step = Step.MakeStep(parentInfo, prevInfo, number, text, steptype, E_FromType.RNO); using (step = Step.MakeStep(parentInfo, prevInfo, number, text, steptype, E_FromType.RNO))
step.DTS = dts; {
step.UserID = userid; step.DTS = dts;
// check for a null in case an older export file is being imported (the older files will not have the fromatfilename attribute) step.UserID = userid;
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 // check for a null in case an older export file is being imported (the older files will not have the fromatfilename attribute)
string formatfilename = (fnNode != null) ? fnNode.InnerText : ""; 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
if (formatid != string.Empty) string formatfilename = (fnNode != null) ? fnNode.InnerText : "";
step.MyContent.MyFormat = OldToNewFormat(int.Parse(formatid), formatfilename); if (formatid != string.Empty)
step.MyContent.Config = config; step.MyContent.MyFormat = OldToNewFormat(int.Parse(formatid), formatfilename);
step.MyContent.DTS = dts; step.MyContent.Config = config;
step.MyContent.UserID = userid; step.MyContent.DTS = dts;
step.Save(); step.MyContent.UserID = userid;
if (!Old2NewItem.ContainsKey(int.Parse(xn.Attributes.GetNamedItem("itemid").InnerText))) step.Save();
Old2NewItem.Add(int.Parse(xn.Attributes.GetNamedItem("itemid").InnerText), step.ItemID); if (!Old2NewItem.ContainsKey(int.Parse(xn.Attributes.GetNamedItem("itemid").InnerText)))
if (!Old2NewContent.ContainsKey(int.Parse(xc.Attributes.GetNamedItem("contentid").InnerText))) Old2NewItem.Add(int.Parse(xn.Attributes.GetNamedItem("itemid").InnerText), step.ItemID);
Old2NewContent.Add(int.Parse(xc.Attributes.GetNamedItem("contentid").InnerText), step.MyContent.ContentID); if (!Old2NewContent.ContainsKey(int.Parse(xc.Attributes.GetNamedItem("contentid").InnerText)))
if (xn.SelectNodes("annotation").Count > 0) Old2NewContent.Add(int.Parse(xc.Attributes.GetNamedItem("contentid").InnerText), step.MyContent.ContentID);
AddAnnotations(step.ItemID, xn); if (xn.SelectNodes("annotation").Count > 0)
if (xc.SelectNodes("rousage").Count > 0) AddAnnotations(step.ItemID, xn);
AddROUsages(step.MyContent, xc); if (xc.SelectNodes("rousage").Count > 0)
if (xc.SelectNodes("transition").Count > 0) AddROUsages(step.MyContent, xc);
AddTransitions(step.MyContent, xc); if (xc.SelectNodes("transition").Count > 0)
prevInfo = StepInfo.Get(step.ItemID); AddTransitions(step.MyContent, xc);
if (xc.HasChildNodes) prevInfo = StepInfo.Get(step.ItemID);
AddParts(xc, prevInfo); if (xc.HasChildNodes)
AddParts(xc, prevInfo);
}
return prevInfo; return prevInfo;
} }
private void AddNotes(XmlNode xn, ItemInfo parentInfo) private void AddNotes(XmlNode xn, ItemInfo parentInfo)
@ -3388,31 +3394,33 @@ namespace VEPROMS
CheckForFloatingFoldout(contentid, config); CheckForFloatingFoldout(contentid, config);
string userid = xc.Attributes.GetNamedItem("userid").InnerText; string userid = xc.Attributes.GetNamedItem("userid").InnerText;
DateTime dts = DateTime.Parse(xc.Attributes.GetNamedItem("dts").InnerText); DateTime dts = DateTime.Parse(xc.Attributes.GetNamedItem("dts").InnerText);
step = Step.MakeStep(parentInfo, prevInfo, number, text, steptype, E_FromType.Note); using (step = Step.MakeStep(parentInfo, prevInfo, number, text, steptype, E_FromType.Note))
step.DTS = dts; {
step.UserID = userid; step.DTS = dts;
// check for a null in case an older export file is being imported (the older files will not have the fromatfilename attribute) step.UserID = userid;
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 // check for a null in case an older export file is being imported (the older files will not have the fromatfilename attribute)
string formatfilename = (fnNode != null) ? fnNode.InnerText : ""; 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
if (formatid != string.Empty) string formatfilename = (fnNode != null) ? fnNode.InnerText : "";
step.MyContent.MyFormat = OldToNewFormat(int.Parse(formatid), formatfilename); if (formatid != string.Empty)
step.MyContent.Config = config; step.MyContent.MyFormat = OldToNewFormat(int.Parse(formatid), formatfilename);
step.MyContent.DTS = dts; step.MyContent.Config = config;
step.MyContent.UserID = userid; step.MyContent.DTS = dts;
step.Save(); step.MyContent.UserID = userid;
if (!Old2NewItem.ContainsKey(int.Parse(xn.Attributes.GetNamedItem("itemid").InnerText))) step.Save();
Old2NewItem.Add(int.Parse(xn.Attributes.GetNamedItem("itemid").InnerText), step.ItemID); if (!Old2NewItem.ContainsKey(int.Parse(xn.Attributes.GetNamedItem("itemid").InnerText)))
if (!Old2NewContent.ContainsKey(int.Parse(xc.Attributes.GetNamedItem("contentid").InnerText))) Old2NewItem.Add(int.Parse(xn.Attributes.GetNamedItem("itemid").InnerText), step.ItemID);
Old2NewContent.Add(int.Parse(xc.Attributes.GetNamedItem("contentid").InnerText), step.MyContent.ContentID); if (!Old2NewContent.ContainsKey(int.Parse(xc.Attributes.GetNamedItem("contentid").InnerText)))
if (xn.SelectNodes("annotation").Count > 0) Old2NewContent.Add(int.Parse(xc.Attributes.GetNamedItem("contentid").InnerText), step.MyContent.ContentID);
AddAnnotations(step.ItemID, xn); if (xn.SelectNodes("annotation").Count > 0)
if (xc.SelectNodes("rousage").Count > 0) AddAnnotations(step.ItemID, xn);
AddROUsages(step.MyContent, xc); if (xc.SelectNodes("rousage").Count > 0)
if (xc.SelectNodes("transition").Count > 0) AddROUsages(step.MyContent, xc);
AddTransitions(step.MyContent, xc); if (xc.SelectNodes("transition").Count > 0)
prevInfo = StepInfo.Get(step.ItemID); AddTransitions(step.MyContent, xc);
if (xc.HasChildNodes) prevInfo = StepInfo.Get(step.ItemID);
AddParts(xc, prevInfo); if (xc.HasChildNodes)
AddParts(xc, prevInfo);
}
return prevInfo; return prevInfo;
} }
private void AddCautions(XmlNode xn, ItemInfo parentInfo) private void AddCautions(XmlNode xn, ItemInfo parentInfo)
@ -3476,31 +3484,33 @@ namespace VEPROMS
CheckForFloatingFoldout(contentid, config); CheckForFloatingFoldout(contentid, config);
string userid = xc.Attributes.GetNamedItem("userid").InnerText; string userid = xc.Attributes.GetNamedItem("userid").InnerText;
DateTime dts = DateTime.Parse(xc.Attributes.GetNamedItem("dts").InnerText); DateTime dts = DateTime.Parse(xc.Attributes.GetNamedItem("dts").InnerText);
step = Step.MakeStep(parentInfo, prevInfo, number, text, steptype, E_FromType.Caution); using (step = Step.MakeStep(parentInfo, prevInfo, number, text, steptype, E_FromType.Caution))
step.DTS = dts; {
step.UserID = userid; step.DTS = dts;
// check for a null in case an older export file is being imported (the older files will not have the fromatfilename attribute) step.UserID = userid;
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 // check for a null in case an older export file is being imported (the older files will not have the fromatfilename attribute)
string formatfilename = (fnNode != null) ? fnNode.InnerText : ""; 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
if (formatid != string.Empty) string formatfilename = (fnNode != null) ? fnNode.InnerText : "";
step.MyContent.MyFormat = OldToNewFormat(int.Parse(formatid), formatfilename); if (formatid != string.Empty)
step.MyContent.Config = config; step.MyContent.MyFormat = OldToNewFormat(int.Parse(formatid), formatfilename);
step.MyContent.DTS = dts; step.MyContent.Config = config;
step.MyContent.UserID = userid; step.MyContent.DTS = dts;
step.Save(); step.MyContent.UserID = userid;
if (!Old2NewItem.ContainsKey(int.Parse(xn.Attributes.GetNamedItem("itemid").InnerText))) step.Save();
Old2NewItem.Add(int.Parse(xn.Attributes.GetNamedItem("itemid").InnerText), step.ItemID); if (!Old2NewItem.ContainsKey(int.Parse(xn.Attributes.GetNamedItem("itemid").InnerText)))
if (!Old2NewContent.ContainsKey(int.Parse(xc.Attributes.GetNamedItem("contentid").InnerText))) Old2NewItem.Add(int.Parse(xn.Attributes.GetNamedItem("itemid").InnerText), step.ItemID);
Old2NewContent.Add(int.Parse(xc.Attributes.GetNamedItem("contentid").InnerText), step.MyContent.ContentID); if (!Old2NewContent.ContainsKey(int.Parse(xc.Attributes.GetNamedItem("contentid").InnerText)))
if (xn.SelectNodes("annotation").Count > 0) Old2NewContent.Add(int.Parse(xc.Attributes.GetNamedItem("contentid").InnerText), step.MyContent.ContentID);
AddAnnotations(step.ItemID, xn); if (xn.SelectNodes("annotation").Count > 0)
if (xc.SelectNodes("rousage").Count > 0) AddAnnotations(step.ItemID, xn);
AddROUsages(step.MyContent, xc); if (xc.SelectNodes("rousage").Count > 0)
if (xc.SelectNodes("transition").Count > 0) AddROUsages(step.MyContent, xc);
AddTransitions(step.MyContent, xc); if (xc.SelectNodes("transition").Count > 0)
prevInfo = StepInfo.Get(step.ItemID); AddTransitions(step.MyContent, xc);
if (xc.HasChildNodes) prevInfo = StepInfo.Get(step.ItemID);
AddParts(xc, prevInfo); if (xc.HasChildNodes)
AddParts(xc, prevInfo);
}
return prevInfo; return prevInfo;
} }
private void AddSections(XmlNode xn, ItemInfo parentInfo) private void AddSections(XmlNode xn, ItemInfo parentInfo)

View File

@ -1205,6 +1205,8 @@ namespace VEPROMS.CSLA.Library
Dictionary<int, ItemInfo> rangeAncestors = GetAncestors(tb._RangeItem); Dictionary<int, ItemInfo> rangeAncestors = GetAncestors(tb._RangeItem);
tb.AppendPrefix(); tb.AppendPrefix();
bool usedRangeAncestor = false; bool usedRangeAncestor = false;
// Refresh Next Items
tb._ToItem.RefreshNextItems();
ItemInfo next = GetNextItem(tb._ToItem, rangeAncestors, ref usedRangeAncestor); ItemInfo next = GetNextItem(tb._ToItem, rangeAncestors, ref usedRangeAncestor);
string lastTab = Tab(tb._RangeItem, tb._RangeItem.ActiveFormat.PlantFormat.FormatData.TransData.TStepNoFlag); string lastTab = Tab(tb._RangeItem, tb._RangeItem.ActiveFormat.PlantFormat.FormatData.TransData.TStepNoFlag);
while (next.ItemID != tb._RangeItem.ItemID) while (next.ItemID != tb._RangeItem.ItemID)