B2017-268: Fix crash when creating a new enhanced procedure & linking an existing source procedure to it when the Procedure Numbers were different.

This commit is contained in:
Kathy Ruffing 2017-12-04 17:05:35 +00:00
parent 12fb3abab0
commit 7dfd2d9738

View File

@ -1784,25 +1784,28 @@ namespace VEPROMS.CSLA.Library
} }
else if (IsProcedure) else if (IsProcedure)
{ {
using (Item ii = this.Get()) // To fix B2017-268 the order of the following 2 'usings' had to be changed and the
{ // Content.Number had to be set in the enhanced.
ProcedureConfig sc = this.MyConfig as ProcedureConfig; using (Item ei = Item.Get(enhii.ItemID))
sc.AddEnhancedDocument(enhtype, enhii.ItemID); {
sc.SaveEnhancedDocuments(); ProcedureConfig sc = enhii.MyConfig as ProcedureConfig;
ii.MyContent.Config = sc.ToString(); sc.AddEnhancedDocument(0, this.ItemID);
ii.Save(); sc.SaveEnhancedDocuments();
RefreshConfig(); ei.MyContent.Number = MyContent.Number;
} ei.MyContent.Text = DisplayText;
using (Item ei = Item.Get(enhii.ItemID)) ei.MyContent.Config = sc.ToString();
{ ei.Save();
ProcedureConfig sc = enhii.MyConfig as ProcedureConfig; enhii.RefreshConfig();
sc.AddEnhancedDocument(0, this.ItemID); }
sc.SaveEnhancedDocuments(); using (Item ii = this.Get())
ei.MyContent.Text = DisplayText; {
ei.MyContent.Config = sc.ToString(); ProcedureConfig sc = this.MyConfig as ProcedureConfig;
ei.Save(); sc.AddEnhancedDocument(enhtype, enhii.ItemID);
enhii.RefreshConfig(); sc.SaveEnhancedDocuments();
} ii.MyContent.Config = sc.ToString();
ii.Save();
RefreshConfig();
}
} }
} }
#endregion #endregion