B2015-052: For finding the Default Step section, if none is specified look for ‘PROCEDURE STEPS’ in the Display Text of the section
This commit is contained in:
parent
45d311bdfe
commit
895f65322d
@ -169,9 +169,14 @@ namespace Volian.Controls.Library
|
|||||||
if ((etm & E_TransUI.SectDefault) == E_TransUI.SectDefault)
|
if ((etm & E_TransUI.SectDefault) == E_TransUI.SectDefault)
|
||||||
{
|
{
|
||||||
secStartId = FindSectionStart(_CurrentProcedure);
|
secStartId = FindSectionStart(_CurrentProcedure);
|
||||||
|
if (secStartId > -1)
|
||||||
|
{
|
||||||
secitm = ItemInfo.Get(secStartId);
|
secitm = ItemInfo.Get(secStartId);
|
||||||
selitm = (secitm.Steps.Count > 0) ? secitm.Steps[0] : null;
|
selitm = (secitm.Steps.Count > 0) ? secitm.Steps[0] : null;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
btnTranSave.Enabled = false; // if there is an invalid section start - don't allow save.
|
||||||
|
}
|
||||||
cbTranSectsFillIn(secitm, secitm == null ? -1 : secStartId, true);
|
cbTranSectsFillIn(secitm, secitm == null ? -1 : secStartId, true);
|
||||||
// Fill step items, passing in the active step to the selected item, or the first
|
// Fill step items, passing in the active step to the selected item, or the first
|
||||||
// step if the selection was not at the step level.
|
// step if the selection was not at the step level.
|
||||||
@ -740,6 +745,7 @@ namespace Volian.Controls.Library
|
|||||||
tmpitm = tmpitm.MyParent;
|
tmpitm = tmpitm.MyParent;
|
||||||
}
|
}
|
||||||
int sectstartid = FindSectionStart(_CurrentProcedure);
|
int sectstartid = FindSectionStart(_CurrentProcedure);
|
||||||
|
if (sectstartid==-1) btnTranSave.Enabled = false; // if there is an invalid section start - don't allow save.
|
||||||
IList chldrn = _CurrentProcedure.GetChildren();
|
IList chldrn = _CurrentProcedure.GetChildren();
|
||||||
if (chldrn != null && chldrn.Count > 0) cbTranSectsFillIn((ItemInfo)chldrn[0], secitm==null?sectstartid:secitm.ItemID, true); //sectstartid);
|
if (chldrn != null && chldrn.Count > 0) cbTranSectsFillIn((ItemInfo)chldrn[0], secitm==null?sectstartid:secitm.ItemID, true); //sectstartid);
|
||||||
}
|
}
|
||||||
@ -824,13 +830,30 @@ namespace Volian.Controls.Library
|
|||||||
}
|
}
|
||||||
private int FindSectionStart(ItemInfo prcitm)
|
private int FindSectionStart(ItemInfo prcitm)
|
||||||
{
|
{
|
||||||
|
// Steps to get the section start. continue down list until finding a valid id. If none is found
|
||||||
|
// put up a message dialog - and if returns a result of -1, caller should disable the 'ok' button
|
||||||
|
// so that a transition cannot be entered until the default section is defined:
|
||||||
|
// 1) Look in ProcedureConfig/SectionStart
|
||||||
|
// 2) Look in SectionConfig/OriginalSteps
|
||||||
|
// 3) Search through the procedure's sections for 'Procedure Steps' as the title
|
||||||
|
// 4) Display message box telling user to set the default section on section properties/format dialog
|
||||||
|
// (this returns a -1, i.e. error)
|
||||||
|
|
||||||
|
// 1) Look in ProcedureConfig/SectionStart
|
||||||
ProcedureConfig pc = (ProcedureConfig)prcitm.MyConfig;
|
ProcedureConfig pc = (ProcedureConfig)prcitm.MyConfig;
|
||||||
int sectstartid = -1;
|
int sectstartid = -1;
|
||||||
string ss = pc == null ? null : pc.SectionStart;
|
string ss = pc == null ? null : pc.SectionStart;
|
||||||
if (ss != null && ss != "") sectstartid = System.Convert.ToInt32(ss);
|
SectionInfo si = null;
|
||||||
SectionInfo si = SectionInfo.Get(sectstartid);
|
if (ss != null && ss != "")
|
||||||
if (si == null) return -1;
|
{
|
||||||
|
sectstartid = System.Convert.ToInt32(ss);
|
||||||
|
si = SectionInfo.Get(sectstartid);
|
||||||
|
}
|
||||||
|
if (si != null)
|
||||||
|
{
|
||||||
if (si.MyProcedure.ItemID == prcitm.ItemID) return sectstartid;
|
if (si.MyProcedure.ItemID == prcitm.ItemID) return sectstartid;
|
||||||
|
// The following code fixes the sectionstart property for the Copy Procedure function. This code will correct
|
||||||
|
// any procedures that were copied prior to the implementation of this the copy procedure function fix.
|
||||||
foreach (SectionInfo si1 in prcitm.Sections)
|
foreach (SectionInfo si1 in prcitm.Sections)
|
||||||
{
|
{
|
||||||
if (si.DisplayNumber == si1.DisplayNumber && si.DisplayText == si1.DisplayText)
|
if (si.DisplayNumber == si1.DisplayNumber && si.DisplayText == si1.DisplayText)
|
||||||
@ -846,6 +869,26 @@ namespace Volian.Controls.Library
|
|||||||
return si1.ItemID;
|
return si1.ItemID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
// 2) Look in SectionConfig/OriginalSteps = 'Y'
|
||||||
|
foreach (SectionInfo sio in prcitm.Sections)
|
||||||
|
{
|
||||||
|
SectionConfig sc = sio.MyConfig as SectionConfig;
|
||||||
|
if (sc != null && sc.Section_OriginalSteps == "Y")
|
||||||
|
{
|
||||||
|
return sio.ItemID;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3) Find if any of the section titles contain 'PROCEDURES STEPS'
|
||||||
|
foreach (SectionInfo sit in prcitm.Sections)
|
||||||
|
{
|
||||||
|
if (sit.DisplayText.ToUpper().Contains("PROCEDURE STEPS"))
|
||||||
|
return sit.ItemID;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 4) Display messagebox to tell user to specify which section should be used as the 'default section'.
|
||||||
|
MessageBox.Show("No default step section was found. Set the appropriate Step Section as the default by using the Section Property Page, Format Tab.", "Transition using Default Step Sction in Format", MessageBoxButtons.OK,MessageBoxIcon.Error);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
private void cbTranProcs_SelectedIndexChanged(object sender, EventArgs e)
|
private void cbTranProcs_SelectedIndexChanged(object sender, EventArgs e)
|
||||||
@ -859,6 +902,7 @@ namespace Volian.Controls.Library
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int sectstartid = FindSectionStart(prcitm);
|
int sectstartid = FindSectionStart(prcitm);
|
||||||
|
if (sectstartid == -1) btnTranSave.Enabled = false; // if there is an invalid section start - don't allow save.
|
||||||
IList chldrn = prcitm.GetChildren();
|
IList chldrn = prcitm.GetChildren();
|
||||||
cbTranSectsFillIn((ItemInfo)chldrn[0], sectstartid, true);
|
cbTranSectsFillIn((ItemInfo)chldrn[0], sectstartid, true);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user