C2018-039: Upgrade – User Control of Format

This commit is contained in:
2018-12-12 15:25:53 +00:00
parent dcefdc8754
commit e2392f5fec
20 changed files with 5491 additions and 1203 deletions

View File

@@ -121,10 +121,11 @@ namespace VEPROMS
PlantFormat pf = _SectionConfig.MyFormat != null ? _SectionConfig.MyFormat.PlantFormat : _SectionConfig.MyDefaultFormat.PlantFormat;
CheckOffList chkoffList = pf.FormatData.ProcData.CheckOffData.CheckOffList;
CheckOffHeaderList chkoffHeaderList = pf.FormatData.ProcData.CheckOffData.CheckOffHeaderList;
if (ppGpbxSignoffCheckoff.Enabled && (chkoffList != null && chkoffList.MaxIndex > 1)
int maxindx = pf.FormatData.ProcData.CheckOffUCF ? pf.FormatData.ProcData.CheckOffData.CheckOffList.MaxIndex : pf.FormatData.ProcData.CheckOffData.CheckOffList.MaxIndexNoInherit;
if (ppGpbxSignoffCheckoff.Enabled && (chkoffList != null && maxindx > 1)
&& (ppCmbxCheckoffType.SelectedIndex != _SectionConfig.Section_CheckoffListSelection - (_hasSectionCheckoffDefault? 1:0)))
_SectionConfig.Section_CheckoffListSelection = ppCmbxCheckoffType.SelectedIndex + (_hasSectionCheckoffDefault? 1:0);
if (ppCmbxCheckoffHeading.Enabled && chkoffHeaderList != null && chkoffHeaderList.MaxIndex > 1)
if (ppCmbxCheckoffHeading.Enabled && chkoffHeaderList != null && chkoffHeaderList.MaxIndexNoInherit > 1)
_SectionConfig.Section_CheckoffHeaderSelection = ppCmbxCheckoffHeading.SelectedIndex;
if (ppCmbxSectPagination.SelectedValue == null)
@@ -144,6 +145,28 @@ namespace VEPROMS
DocumentInfo docinfo = DocumentInfo.Get(_SectionConfig.MySection.MyContent.MyEntry.MyDocument.DocID);
docinfo.RefreshDocumentEntries();
}
// if there is a change to the format, clean up any overridden formats that point to the selected item before saving the format change:
// To determine a change to the format, first see if selection changed in list and then see if the format selected does not match
// what was set on procedure, if necessary resolve for an inherited format.
if (_SectionConfig.MySection.MySectionInfo.ActiveFormat != null &&
_SectionConfig.MySection.MySectionInfo.ActiveFormat.FormatID != _cmbxformatOriginal)
{
// clean up & then refresh the configs
using (ContentInfoList cil = ContentInfoList.ClearOverrideFormatsByItem(_SectionConfig.MySection.ItemID, _cmbxformatOriginal, _SectionConfig.MySection.MySectionInfo.ActiveFormat.FormatID))
{
foreach (ContentInfo ci in cil)
{
using (Content c = ci.Get())
{
// first refresh configs because the ContentInfo.Refresh causes events to occur that refresh screen
// and if configs aren't done first, the screen refresh, if based on config data, will not be correct.
foreach (ItemInfo ii in ci.ContentItems) ii.RefreshConfig();
ContentInfo.Refresh(c);
}
}
}
}
// if there was a document to delete, do it.
if (_DocumentToDelete != null)
{
@@ -301,6 +324,7 @@ namespace VEPROMS
}
}
private bool checkEnhancedSettings = false;
private int? _cmbxformatOriginal = null;
private void frmSectionProperties_Load(object sender, EventArgs e)
{
_Initializing = true;
@@ -310,6 +334,7 @@ namespace VEPROMS
ppCmbxFormat.DisplayMember = "FullName";
ppCmbxFormat.ValueMember = "FullName";
ppCmbxFormat.DataSource = FormatInfoList.SortedFormatInfoList;
if (_SectionConfig.MySection.MySectionInfo.ActiveFormat != null) _cmbxformatOriginal = (int)_SectionConfig.MySection.MySectionInfo.ActiveFormat.FormatID;
if (_SectionConfig.FormatSelection != null)
ppCmbxFormat.SelectedValue = _SectionConfig.FormatSelection;
else
@@ -680,7 +705,8 @@ namespace VEPROMS
PlantFormat pf = _SectionConfig.MyFormat!=null?_SectionConfig.MyFormat.PlantFormat:_SectionConfig.MyDefaultFormat.PlantFormat;
CheckOffList chkoffList = pf.FormatData.ProcData.CheckOffData.CheckOffList;
CheckOffHeaderList chkoffHeaderList = pf.FormatData.ProcData.CheckOffData.CheckOffHeaderList;
if (chkoffList != null && chkoffList.MaxIndex > 0 &&
int maxindx = pf.FormatData.ProcData.CheckOffUCF ? pf.FormatData.ProcData.CheckOffData.CheckOffList.MaxIndex : pf.FormatData.ProcData.CheckOffData.CheckOffList.MaxIndexNoInherit;
if (chkoffList != null && maxindx > 0 &&
(pf.FormatData.ProcData.CheckOffData.Menu == "Signoff" || chkoffList[0].MenuItem.ToUpper().Equals("{SECTION DEFAULT}")))
{
if (SectionPropertyCheckOffList!=null)SectionPropertyCheckOffList.Clear();
@@ -688,10 +714,10 @@ namespace VEPROMS
// Don't put up the first item in the chkoffList, it is '{Section Default}'.
_hasSectionCheckoffDefault = false;
//for (int i = 1; i < chkoffList.Count; i++)
for (int i = 0; i < chkoffList.MaxIndex; i++)
foreach (CheckOff co in chkoffList)
{
if (!chkoffList[i].MenuItem.ToUpper().Equals("{SECTION DEFAULT}"))
SectionPropertyCheckOffList.Add(chkoffList[i]);
if (!co.MenuItem.ToUpper().Equals("{SECTION DEFAULT}"))
SectionPropertyCheckOffList.Add(co);
else
_hasSectionCheckoffDefault = true;
}