B2020-007: default step section setting/unsetting

This commit is contained in:
Kathy Ruffing 2020-01-30 16:49:12 +00:00
parent a1edbe06b8
commit 02f17709b7
2 changed files with 27 additions and 12 deletions

View File

@ -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

View File

@ -3659,7 +3659,7 @@ namespace VEPROMS.CSLA.Library
item._IsDeleted = true;
}
}
private ConfigDynamicTypeDescriptor _MyConfig = null;
public ConfigDynamicTypeDescriptor _MyConfig = null;
public ConfigDynamicTypeDescriptor MyConfig
{
get
@ -3696,8 +3696,16 @@ namespace VEPROMS.CSLA.Library
string key = ItemID.ToString();
ConvertListToDictionary();
if (_CacheByPrimaryKey.ContainsKey(key))
{
foreach (ItemInfo tmpInfo in _CacheByPrimaryKey[key])
{
tmpInfo.MyConfig = null;
// B2020-007: 'refresh' (by making null so get reset) Procedure, Section and Step configs also.
if (tmpInfo is ProcedureInfo) (tmpInfo as ProcedureInfo)._ProcedureConfig = null;
if (tmpInfo is SectionInfo) (tmpInfo as SectionInfo)._SectionConfig = null;
if (tmpInfo is StepInfo) (tmpInfo as StepInfo)._StepConfig = null;
}
}
}
public EnhancedDocuments GetMyEnhancedDocuments()
{
@ -7674,7 +7682,7 @@ namespace VEPROMS.CSLA.Library
#region SectionConfig
[NonSerialized]
private SectionConfig _SectionConfig;
public SectionConfig _SectionConfig;
public SectionConfig SectionConfig
{ get { return (_SectionConfig != null ? _SectionConfig : _SectionConfig = new SectionConfig(this)); } }
#endregion
@ -7747,7 +7755,7 @@ namespace VEPROMS.CSLA.Library
public partial class StepInfo : ItemInfo
{
#region StepConfig
private StepConfig _StepConfig;
public StepConfig _StepConfig;
public StepConfig StepConfig
{ get { return (_StepConfig != null ? _StepConfig : _StepConfig = new StepConfig(this)); } }
#endregion