Fix some of enhanced format flags

C2016-008: Create an enhanced step if it is missing from a source
This commit is contained in:
2016-04-14 12:44:51 +00:00
parent ac49c296cd
commit 3bcd01ce8d
3 changed files with 94 additions and 1 deletions

View File

@@ -1399,6 +1399,33 @@ namespace Volian.Controls.Library
}
}
}
public void AddMissingEnhancedStep(ItemInfo ii, int EnhType)
{
// if the missing enhanced step is a cuation or note, check that parent HLS has the needed
// enhanced step to insert the caution/note from. If not, do a message.
if (ii.IsCaution || ii.IsNote)
{
bool canMakeMissingStep = false;
StepConfig sc = ii.MyHLS.MyConfig as StepConfig;
foreach (EnhancedDocument ed in sc.MyEnhancedDocuments)
{
if (EnhType == ed.Type) // the hls has an enhanced linked step of this type, the caution/note can be made:
{
canMakeMissingStep = true;
break;
}
}
if (!canMakeMissingStep)
{
MessageBox.Show("Cannot create the missing enhanced step, the Enhanced Step for the High Level step must be created first.");
return;
}
}
ItemInfo newEnh = ii.DoAddMissingEnhancedSteps(EnhType);
// if enhanced items were created, then see if they need displayed:
if (newEnh != null) AddAllEnhancedItemsToDisplay(MyItemInfo);
SetFocus();
}
private string GetChangeId(ItemInfo iiDest)
{
// get the change id for the destination's procedure's change id.