B2020-007: default step section setting/unsetting
This commit is contained in:
@@ -1286,6 +1286,7 @@ namespace VEPROMS
|
||||
// in the transition text if it was a default:
|
||||
int cntDefaultSect = 0;
|
||||
string defSectDesc = "";
|
||||
string curSectDesc = "";
|
||||
foreach (SectionInfo si in _SectionConfig.MySection.MySectionInfo.MyProcedure.Sections)
|
||||
{
|
||||
SectionConfig sc = si.MyConfig as SectionConfig;
|
||||
@@ -1294,15 +1295,19 @@ namespace VEPROMS
|
||||
cntDefaultSect++;
|
||||
if (cntDefaultSect == 1) defSectDesc = string.Format("{0} {1}", sc.Number, sc.Title).Trim(); // get default section name - used in Warning message if another section is checked to be default
|
||||
}
|
||||
if (si.ItemID == _SectionConfig.MySection.ItemID) curSectDesc = string.Format("{0} {1}", sc.Number, sc.Title).Trim();
|
||||
}
|
||||
if (!ppCbDefaultStepSection.Checked) //user un-checked the default section box
|
||||
{
|
||||
if (cntDefaultSect == 1)
|
||||
{
|
||||
// If user unchecks this section, i.e. wants to clear it from being 'Default Step Section'
|
||||
// remind user that one section Must be the default step section.
|
||||
// B2020-007: Don't allow the user to unselect the Default Step Section. Give the user a message and turn the check
|
||||
// box back on. The way to change the default section will be to check the box for the default section to change to.
|
||||
// That will bring up a dialog asking the user if they want to change the default section (see the next 'else')
|
||||
MessageBox.Show("One section MUST be set as the 'Default Step Section'.\n\nTo make another section the 'Default Step Section',\n select the checkbox on the Properties of that section.", "WARNING");
|
||||
//ppCbDefaultStepSection.Checked = true;
|
||||
_Initializing = true;
|
||||
ppCbDefaultStepSection.Checked = true;
|
||||
_Initializing = false;
|
||||
}
|
||||
}
|
||||
else // user checked the default section box
|
||||
@@ -1312,12 +1317,14 @@ namespace VEPROMS
|
||||
// Note that this just sets the config item - it does not save it. Save is
|
||||
// done when the 'OK' button is clicked. At that time, if this section's
|
||||
// Section_OriginalSteps is set, then all other sections will need to have this
|
||||
// property cleared (Only 1 section can be the OriginalStep section.
|
||||
string msg = string.Format("Only one section can be set as the 'Default Step Section'.\n\nYou need to un-select \"{0}\" as the default section before selecting this one.", defSectDesc);
|
||||
MessageBox.Show(msg, "WARNING");
|
||||
_Initializing = true;
|
||||
ppCbDefaultStepSection.Checked = false; // reset the check box back to unchecked
|
||||
_Initializing = false;
|
||||
// property cleared (Only 1 section can be the OriginalStep section)
|
||||
string msg = string.Format("Only one section can be set as the 'Default Step Section'. '{0}' is currently the default.\n\nDo you want to make '{1}' the Default?", defSectDesc, curSectDesc);
|
||||
if (MessageBox.Show(msg, "WARNING", MessageBoxButtons.YesNo) == DialogResult.No)
|
||||
{
|
||||
_Initializing = true;
|
||||
ppCbDefaultStepSection.Checked = false; // reset the check box back to unchecked
|
||||
_Initializing = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
//C2019-042 a section cannot be a foldout section and the default step section
|
||||
|
Reference in New Issue
Block a user