C2023-017: Added logic to filter the format list when selecting a format to be applied to a section
This commit is contained in:
parent
350b943066
commit
b83ec3520b
@ -11,11 +11,14 @@ using DescriptiveEnum;
|
|||||||
using DevComponents.DotNetBar;
|
using DevComponents.DotNetBar;
|
||||||
using DevComponents.DotNetBar.Controls;
|
using DevComponents.DotNetBar.Controls;
|
||||||
using Volian.Controls.Library;
|
using Volian.Controls.Library;
|
||||||
|
using System.Xml;
|
||||||
|
using Csla;
|
||||||
|
|
||||||
namespace VEPROMS
|
namespace VEPROMS
|
||||||
{
|
{
|
||||||
public partial class frmProcedureProperties : DevComponents.DotNetBar.Office2007Form
|
public partial class frmProcedureProperties : DevComponents.DotNetBar.Office2007Form
|
||||||
{
|
{
|
||||||
|
private readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
private bool _Initializing = false;
|
private bool _Initializing = false;
|
||||||
private string _DefaultFormatName = null;
|
private string _DefaultFormatName = null;
|
||||||
//private string _DefaultPagination = null;
|
//private string _DefaultPagination = null;
|
||||||
@ -184,7 +187,9 @@ namespace VEPROMS
|
|||||||
ppCmbxFormat.DataSource = null;
|
ppCmbxFormat.DataSource = null;
|
||||||
ppCmbxFormat.DisplayMember = "FullName";
|
ppCmbxFormat.DisplayMember = "FullName";
|
||||||
ppCmbxFormat.ValueMember = "FullName";
|
ppCmbxFormat.ValueMember = "FullName";
|
||||||
ppCmbxFormat.DataSource = FormatInfoList.SortedFormatInfoList;
|
|
||||||
|
//C2023-017: Retrieves a filtered list of formats for the current plant
|
||||||
|
ppCmbxFormat.DataSource = PopulateFormatList(FormatInfoList.SortedFormatInfoList);
|
||||||
if (_ProcedureConfig.MyProcedure.MyProcedureInfo.ActiveFormat != null) _cmbxformatOriginal = _ProcedureConfig.MyProcedure.MyProcedureInfo.ActiveFormat.FormatID;
|
if (_ProcedureConfig.MyProcedure.MyProcedureInfo.ActiveFormat != null) _cmbxformatOriginal = _ProcedureConfig.MyProcedure.MyProcedureInfo.ActiveFormat.FormatID;
|
||||||
if (_ProcedureConfig.FormatSelection != null)
|
if (_ProcedureConfig.FormatSelection != null)
|
||||||
ppCmbxFormat.SelectedValue = _ProcedureConfig.FormatSelection;
|
ppCmbxFormat.SelectedValue = _ProcedureConfig.FormatSelection;
|
||||||
@ -254,6 +259,51 @@ namespace VEPROMS
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//C2023-017: Remove any formats that are not applicable to the current plant
|
||||||
|
private IList<FormatInfo> PopulateFormatList(SortedBindingList<FormatInfo> RawList)
|
||||||
|
{
|
||||||
|
List<FormatInfo> result = new List<FormatInfo>();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//Get the top folder configuration XML of the PROMS treeview and load
|
||||||
|
//the Formats node to retrieve the available formats for this plant
|
||||||
|
FolderInfo fi = FolderInfo.GetTop();
|
||||||
|
System.Xml.XmlDocument xDoc = new System.Xml.XmlDocument();
|
||||||
|
xDoc.LoadXml(fi.Config);
|
||||||
|
XmlNodeList fList = xDoc.GetElementsByTagName("Formats");
|
||||||
|
|
||||||
|
//We need to check to see if the current database has been updated with the necessary changes
|
||||||
|
//to the folder configuration value. If so then build the list of available to be returned
|
||||||
|
//to the calling code
|
||||||
|
if (fList == null)
|
||||||
|
{
|
||||||
|
_MyLog.InfoFormat("Filtered format list not available: Database update needed for config value of top folder record");
|
||||||
|
return RawList;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//Create a string array that we can use to filter the raw list and add the format to the return value
|
||||||
|
string[] availableFormats = fList[0].Attributes["Active"].Value.Split(',');
|
||||||
|
foreach (FormatInfo item in RawList)
|
||||||
|
{
|
||||||
|
if (Array.IndexOf(availableFormats, item.ApplicablePlant.ToString()) > -1)
|
||||||
|
{
|
||||||
|
result.Add(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
//On any exception simply return the original list that was passed in
|
||||||
|
_MyLog.ErrorFormat("Error loading filtered format list - PopulateFormatList(): {0}", ex.Message);
|
||||||
|
return RawList;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
#region General tab
|
#region General tab
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -192,6 +192,16 @@ namespace VEPROMS.CSLA.Library
|
|||||||
return _UserID;
|
return _UserID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private int _ApplicablePlant = 0;
|
||||||
|
public int ApplicablePlant
|
||||||
|
{
|
||||||
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
|
get
|
||||||
|
{
|
||||||
|
CanReadProperty("ApplicablePlant", true);
|
||||||
|
return _ApplicablePlant;
|
||||||
|
}
|
||||||
|
}
|
||||||
private int _FormatContentCount = 0;
|
private int _FormatContentCount = 0;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Count of FormatContents for this Format
|
/// Count of FormatContents for this Format
|
||||||
@ -518,6 +528,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
_FormatDocVersionCount = dr.GetInt32("DocVersionCount");
|
_FormatDocVersionCount = dr.GetInt32("DocVersionCount");
|
||||||
_FormatFolderCount = dr.GetInt32("FolderCount");
|
_FormatFolderCount = dr.GetInt32("FolderCount");
|
||||||
_ChildFormatCount = dr.GetInt32("ChildCount");
|
_ChildFormatCount = dr.GetInt32("ChildCount");
|
||||||
|
_ApplicablePlant = dr.GetInt32("ApplicablePlant");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user