Merge pull request 'C2023-017: Added logic to filter the format list when selecting a format to be applied to a section' (#126) from C2023-017 into Development
Code review completed. Merging into Development.
This commit is contained in:
commit
b34fb42f94
@ -21941,6 +21941,210 @@ GO
|
||||
==========================================================================================================
|
||||
*/
|
||||
|
||||
/****** Add the ApplicablePlant field to the Formats table ******/
|
||||
ALTER TABLE Formats ADD ApplicablePlant int NULL;
|
||||
GO
|
||||
|
||||
/****** Update the Formats table with the appropriate ApplicablePlant value ******/
|
||||
|
||||
--This update statement corrects a typo in the name of one of the format records
|
||||
UPDATE Formats SET [Description] = REPLACE([Description], 'Robimson', 'Robinson') WHERE [Description] LIKE '%Robimson%';
|
||||
|
||||
UPDATE Formats SET ApplicablePlant = 1 WHERE [Description] LIKE '%DC Cook%' OR [Name] LIKE 'AEP%';
|
||||
UPDATE Formats SET ApplicablePlant = 2 WHERE [Description] LIKE '%Calvert%' OR [Name] LIKE 'BGE%';
|
||||
UPDATE Formats SET ApplicablePlant = 3 WHERE [Description] LIKE '%BNPP%' OR [Name] LIKE 'BNPP%';
|
||||
UPDATE Formats SET ApplicablePlant = 4 WHERE [Description] LIKE '%Beaver Valley%' OR [Name] LIKE 'BVPS%';
|
||||
UPDATE Formats SET ApplicablePlant = 5 WHERE [Description] LIKE '%Byr-Bwd%' OR ([Name] LIKE 'EXC%' OR [Name] LIKE 'EXEB%' OR [Name] LIKE 'CWE%');
|
||||
UPDATE Formats SET ApplicablePlant = 6 WHERE [Description] LIKE '%Callaway%' OR [Name] LIKE 'CAL%';
|
||||
UPDATE Formats SET ApplicablePlant = 7 WHERE [Description] LIKE '%Catawba%' OR [Name] LIKE 'CAT%';
|
||||
UPDATE Formats SET ApplicablePlant = 8 WHERE [Description] LIKE '%Comanche%' OR ([Name] LIKE 'CAT%' OR [Name] LIKE 'ComPeak%' OR [Name] LIKE 'CPD%' OR [Name] LIKE 'CPF%' OR [Name] LIKE 'CPS%' OR [Name] LIKE 'TUEC%');
|
||||
UPDATE Formats SET ApplicablePlant = 9 WHERE [Description] LIKE '%Robinson%' OR [Name] LIKE 'AEP%' OR [Name] LIKE 'RNP%';
|
||||
UPDATE Formats SET ApplicablePlant = 10 WHERE [Description] LIKE '%Harris%' OR ([Name] LIKE 'CPLS%' OR [Name] LIKE 'SHE%');
|
||||
UPDATE Formats SET ApplicablePlant = 11 WHERE [Description] LIKE '%IP%' OR [Name] LIKE 'IP%';
|
||||
UPDATE Formats SET ApplicablePlant = 12 WHERE [Description] LIKE '%Farley%' OR [Name] LIKE 'FNP%';
|
||||
UPDATE Formats SET ApplicablePlant = 13 WHERE [Description] LIKE '%Turkey%' OR [Name] LIKE 'FPL%' OR [Name] LIKE 'TP%';
|
||||
UPDATE Formats SET ApplicablePlant = 14 WHERE [Description] LIKE '%Ginna%' OR [Name] LIKE 'Ginna%' OR [Name] LIKE 'RGE%';
|
||||
UPDATE Formats SET ApplicablePlant = 15 WHERE [Description] LIKE '%Vogtle%' OR [Name] LIKE 'GPC%' OR [Name] LIKE 'VEGP%';
|
||||
UPDATE Formats SET ApplicablePlant = 16 WHERE [Description] LIKE '%South Texas%' OR [Name] LIKE 'HLP%' OR [Name] LIKE 'OHLP%';
|
||||
UPDATE Formats SET ApplicablePlant = 17 WHERE [Description] LIKE '%McGuire%' OR [Name] LIKE 'MCG%';
|
||||
UPDATE Formats SET ApplicablePlant = 18 WHERE [Description] LIKE '%PI%' OR [Name] LIKE 'NSP%';
|
||||
UPDATE Formats SET ApplicablePlant = 19 WHERE [Description] LIKE '%Southern Nuclear%' OR [Name] LIKE 'STHN%';
|
||||
UPDATE Formats SET ApplicablePlant = 20 WHERE [Description] LIKE '%VC Summer%' OR [Name] LIKE 'SUM%' OR [Name] LIKE 'VCB%' OR [Name] LIKE 'VCS%';
|
||||
UPDATE Formats SET ApplicablePlant = 21 WHERE [Description] LIKE '%TVA%' OR [Name] LIKE 'TVA%';
|
||||
UPDATE Formats SET ApplicablePlant = 22 WHERE [Description] LIKE '%Wolf%' OR [Name] LIKE 'WCN%';
|
||||
UPDATE Formats SET ApplicablePlant = 23 WHERE [Description] LIKE '%Westinghouse%' OR [Name] LIKE 'WST%';
|
||||
UPDATE Formats SET ApplicablePlant = 1000 WHERE [Description] LIKE '%Proms%' OR [Description] LIKE '%Generic%' OR [Name] LIKE 'EXP%' OR [Name] LIKE 'Proms%' OR [Name] LIKE 'base%';
|
||||
|
||||
|
||||
/****** Object: StoredProcedure [dbo].[getFormats] Script Date: 9/28/2023 8:42:56 AM ******/
|
||||
SET ANSI_NULLS ON
|
||||
GO
|
||||
SET QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
|
||||
/*****************************************************************************
|
||||
Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
|
||||
Copyright 2018 - Volian Enterprises, Inc. All rights reserved.
|
||||
*****************************************************************************/
|
||||
ALTER PROCEDURE [dbo].[getFormats]
|
||||
|
||||
WITH EXECUTE AS OWNER
|
||||
AS
|
||||
BEGIN
|
||||
with formatz([FormatID], [ParentID],[Name],[Description],[Data],[Config],[GenMac],[DTS],[UserID],[LastChanged],[ApplicablePlant]) as
|
||||
(select [FormatID], [ParentID],[Name],[Description],[Data],[Config],[GenMac],[DTS],[UserID],[LastChanged],[ApplicablePlant]
|
||||
FROM [dbo].[Formats] fs where DATALENGTH(fs.Data) > 5
|
||||
union all -- Child formats
|
||||
select fs.[FormatID], fs.[ParentID], fs.[Name], fs.[Description], fz.[Data], fs.[Config], fz.[GenMac], fs.[DTS], fs.[UserID], fs.[LastChanged], fs.[ApplicablePlant]
|
||||
from formats fs
|
||||
join formatz fz on fz.FormatID = fs.ParentID
|
||||
where DATALENGTH(fs.Data) = 5) -- the DATALENGTH(fs.Data) = 5 is how to check for empty xml (Data's type is xml)
|
||||
select * from (
|
||||
select *,
|
||||
(SELECT COUNT(*) FROM [Contents] WHERE [Contents].[FormatID]=[Formatz].[FormatID]) [ContentCount],
|
||||
(SELECT COUNT(*) FROM [DocVersions] WHERE [DocVersions].[FormatID]=[Formatz].[FormatID]) [DocVersionCount],
|
||||
(SELECT COUNT(*) FROM [Folders] WHERE [Folders].[FormatID]=[Formatz].[FormatID]) [FolderCount],
|
||||
(SELECT COUNT(*) FROM [Formats] [Children] WHERE [Children].[ParentID]=[Formatz].[FormatID]) [ChildCount] from Formatz) t1
|
||||
where Description not like '%(Unused)%' or (ContentCount + DocVersionCount + FolderCount + ChildCount > 0)
|
||||
END
|
||||
RETURN
|
||||
|
||||
/****** Object: StoredProcedure [dbo].[getAllFormats] Script Date: 9/28/2023 8:32:15 AM ******/
|
||||
SET ANSI_NULLS ON
|
||||
GO
|
||||
SET QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
|
||||
/*****************************************************************************
|
||||
Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
|
||||
Copyright 2018 - Volian Enterprises, Inc. All rights reserved.
|
||||
*****************************************************************************/
|
||||
ALTER PROCEDURE [dbo].[getAllFormats]
|
||||
|
||||
WITH EXECUTE AS OWNER
|
||||
AS
|
||||
SELECT * From (SELECT
|
||||
[FormatID],
|
||||
[ParentID],
|
||||
[Name],
|
||||
[Description],
|
||||
[Data],
|
||||
[Config],
|
||||
[GenMac],
|
||||
[DTS],
|
||||
[UserID],
|
||||
[LastChanged],
|
||||
[ApplicablePlant],
|
||||
(SELECT COUNT(*) FROM [Contents] WHERE [Contents].[FormatID]=[Formats].[FormatID]) [ContentCount],
|
||||
(SELECT COUNT(*) FROM [DocVersions] WHERE [DocVersions].[FormatID]=[Formats].[FormatID]) [DocVersionCount],
|
||||
(SELECT COUNT(*) FROM [Folders] WHERE [Folders].[FormatID]=[Formats].[FormatID]) [FolderCount],
|
||||
(SELECT COUNT(*) FROM [Formats] [Children] WHERE [Children].[ParentID]=[Formats].[FormatID]) [ChildCount]
|
||||
FROM [Formats] ) T1
|
||||
RETURN
|
||||
|
||||
|
||||
/****** Object: StoredProcedure [dbo].[getFormatByName] Script Date: 9/29/2023 12:16:48 PM ******/
|
||||
SET ANSI_NULLS ON
|
||||
GO
|
||||
SET QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
ALTER PROCEDURE [dbo].[getFormatByName]
|
||||
(
|
||||
@Name varchar(255)
|
||||
)
|
||||
WITH EXECUTE AS OWNER
|
||||
AS
|
||||
DECLARE @FormatID INT
|
||||
Set @FormatID = (select FormatID from Formats where Name = @Name)
|
||||
BEGIN
|
||||
with formatz([FormatID], [ParentID],[Name],[Description],[Data],[Config],[GenMac],[DTS],[UserID],[LastChanged],[ApplicablePlant]) as
|
||||
(select [FormatID], [ParentID],[Name],[Description],[Data],[Config],[GenMac],[DTS],[UserID],[LastChanged],[ApplicablePlant]
|
||||
FROM [dbo].[Formats] fs where DATALENGTH(fs.Data) > 5
|
||||
union all -- Child formats
|
||||
select fs.[FormatID], fs.[ParentID], fs.[Name], fs.[Description], fz.[Data], fs.[Config], fz.[GenMac], fs.[DTS], fs.[UserID], fs.[LastChanged], fs.[ApplicablePlant]
|
||||
from formats fs
|
||||
join formatz fz on fz.FormatID = fs.ParentID
|
||||
where DATALENGTH(fs.Data) = 5) -- the DATALENGTH(fs.Data) = 5 is how to check for empty xml (Data's type is xml)
|
||||
select *,
|
||||
(SELECT COUNT(*) FROM [Contents] WHERE [Contents].[FormatID]=[Formatz].[FormatID]) [ContentCount],
|
||||
(SELECT COUNT(*) FROM [DocVersions] WHERE [DocVersions].[FormatID]=[Formatz].[FormatID]) [DocVersionCount],
|
||||
(SELECT COUNT(*) FROM [Folders] WHERE [Folders].[FormatID]=[Formatz].[FormatID]) [FolderCount],
|
||||
(SELECT COUNT(*) FROM [Formats] [Children] WHERE [Children].[ParentID]=[Formatz].[FormatID]) [ChildCount] from Formatz
|
||||
WHERE [FormatID]=@FormatID
|
||||
END
|
||||
|
||||
SELECT
|
||||
[Contents].[ContentID],
|
||||
[Contents].[Number],
|
||||
[Contents].[Text],
|
||||
[Contents].[Type],
|
||||
[Contents].[FormatID],
|
||||
[Contents].[Config],
|
||||
[Contents].[DTS],
|
||||
[Contents].[UserID],
|
||||
[Contents].[LastChanged]
|
||||
FROM [Contents]
|
||||
WHERE
|
||||
[Contents].[FormatID]=@FormatID
|
||||
|
||||
|
||||
SELECT
|
||||
[DocVersions].[VersionID],
|
||||
[DocVersions].[FolderID],
|
||||
[DocVersions].[VersionType],
|
||||
[DocVersions].[Name],
|
||||
[DocVersions].[Title],
|
||||
[DocVersions].[ItemID],
|
||||
[DocVersions].[FormatID],
|
||||
[DocVersions].[Config],
|
||||
[DocVersions].[DTS],
|
||||
[DocVersions].[UserID],
|
||||
[DocVersions].[LastChanged],
|
||||
[Folders].[ParentID] [Folder_ParentID],
|
||||
[Folders].[DBID] [Folder_DBID],
|
||||
[Folders].[Name] [Folder_Name],
|
||||
[Folders].[Title] [Folder_Title],
|
||||
[Folders].[ShortName] [Folder_ShortName],
|
||||
[Folders].[FormatID] [Folder_FormatID],
|
||||
[Folders].[ManualOrder] [Folder_ManualOrder],
|
||||
[Folders].[Config] [Folder_Config],
|
||||
[Folders].[DTS] [Folder_DTS],
|
||||
[Folders].[UsrID] [Folder_UsrID]
|
||||
FROM [DocVersions]
|
||||
JOIN [Folders] ON
|
||||
[Folders].[FolderID]=[DocVersions].[FolderID]
|
||||
WHERE
|
||||
[DocVersions].[FormatID]=@FormatID
|
||||
|
||||
|
||||
SELECT
|
||||
[Folders].[FolderID],
|
||||
[Folders].[ParentID],
|
||||
[Folders].[DBID],
|
||||
[Folders].[Name],
|
||||
[Folders].[Title],
|
||||
[Folders].[ShortName],
|
||||
[Folders].[FormatID],
|
||||
[Folders].[ManualOrder],
|
||||
[Folders].[Config],
|
||||
[Folders].[DTS],
|
||||
[Folders].[UsrID],
|
||||
[Folders].[LastChanged],
|
||||
[Connections].[Name] [Connection_Name],
|
||||
[Connections].[Title] [Connection_Title],
|
||||
[Connections].[ConnectionString] [Connection_ConnectionString],
|
||||
[Connections].[ServerType] [Connection_ServerType],
|
||||
[Connections].[Config] [Connection_Config],
|
||||
[Connections].[DTS] [Connection_DTS],
|
||||
[Connections].[UsrID] [Connection_UsrID]
|
||||
FROM [Folders]
|
||||
JOIN [Connections] ON
|
||||
[Connections].[DBID]=[Folders].[DBID]
|
||||
WHERE
|
||||
[Folders].[FormatID]=@FormatID
|
||||
|
||||
RETURN
|
||||
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
/*
|
||||
@ -21976,8 +22180,8 @@ BEGIN TRY -- Try Block
|
||||
DECLARE @RevDate varchar(255)
|
||||
DECLARE @RevDescription varchar(255)
|
||||
|
||||
set @RevDate = '10/03/2022 2:00 PM'
|
||||
set @RevDescription = 'B2022-124: [JPR] Blank RO Values (All Spaces) printing as ?'
|
||||
set @RevDate = '10/03/2023 11:00 AM'
|
||||
set @RevDescription = 'C2023-017: Added logic to filter the format list when selecting a format to be applied to a section'
|
||||
|
||||
Select cast(@RevDate as datetime) RevDate, @RevDescription RevDescription
|
||||
PRINT 'SQL Code Revision ' + @RevDate + ' - ' + @RevDescription
|
||||
@ -21995,3 +22199,6 @@ ELSE PRINT 'StoredProcedure [vesp_GetSQLCodeRevision] Error on Creation'
|
||||
go
|
||||
|
||||
Exec vesp_GetSQLCodeRevision;
|
||||
|
||||
|
||||
|
||||
|
@ -13,6 +13,7 @@ using DevComponents.DotNetBar.Controls;
|
||||
using System.Drawing.Imaging;
|
||||
using VEPROMS.Properties;
|
||||
using DescriptiveEnum;
|
||||
using Volian.Controls.Library;
|
||||
|
||||
namespace VEPROMS
|
||||
{
|
||||
@ -150,8 +151,8 @@ namespace VEPROMS
|
||||
ppCmbxFormat.DataSource = null;
|
||||
ppCmbxFormat.DisplayMember = "FullName";
|
||||
ppCmbxFormat.ValueMember = "FullName";
|
||||
ppCmbxFormat.DataSource = FormatInfoList.SortedFormatInfoList;
|
||||
if (_FolderConfig != null && _FolderConfig.MyFolder != null) _cmbxformatOriginal = _FolderConfig.MyFolder.FormatID;
|
||||
ppCmbxFormat.DataSource = FormatUtility.GetFilteredFormatList(FormatInfoList.SortedFormatInfoList);
|
||||
if (_FolderConfig != null && _FolderConfig.MyFolder != null) _cmbxformatOriginal = _FolderConfig.MyFolder.FormatID;
|
||||
if (_FolderConfig.FormatSelection != null)
|
||||
{
|
||||
ppCmbxFormat.SelectedValue = _FolderConfig.FormatSelection;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -364,7 +364,7 @@ namespace VEPROMS
|
||||
ppCmbxFormat.DataSource = null;
|
||||
ppCmbxFormat.DisplayMember = "FullName";
|
||||
ppCmbxFormat.ValueMember = "FullName";
|
||||
ppCmbxFormat.DataSource = FormatInfoList.SortedFormatInfoList;
|
||||
ppCmbxFormat.DataSource = FormatUtility.GetFilteredFormatList(FormatInfoList.SortedFormatInfoList);
|
||||
if (_SectionConfig.MySection.MySectionInfo.ActiveFormat != null) _cmbxformatOriginal = (int)_SectionConfig.MySection.MySectionInfo.ActiveFormat.FormatID;
|
||||
if (_SectionConfig.FormatSelection != null)
|
||||
ppCmbxFormat.SelectedValue = _SectionConfig.FormatSelection;
|
||||
|
@ -168,7 +168,7 @@ namespace VEPROMS
|
||||
ppCmbxFormat.DataSource = null;
|
||||
ppCmbxFormat.DisplayMember = "FullName";
|
||||
ppCmbxFormat.ValueMember = "FullName";
|
||||
ppCmbxFormat.DataSource = FormatInfoList.SortedFormatInfoList;
|
||||
ppCmbxFormat.DataSource = FormatUtility.GetFilteredFormatList(FormatInfoList.SortedFormatInfoList);
|
||||
_cmbxformatOriginal = _DocVersionConfig.MyDocVersion.FormatID;
|
||||
|
||||
if (_DocVersionConfig.FormatSelection != null)
|
||||
|
@ -192,6 +192,16 @@ namespace VEPROMS.CSLA.Library
|
||||
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;
|
||||
/// <summary>
|
||||
/// Count of FormatContents for this Format
|
||||
@ -518,6 +528,7 @@ namespace VEPROMS.CSLA.Library
|
||||
_FormatDocVersionCount = dr.GetInt32("DocVersionCount");
|
||||
_FormatFolderCount = dr.GetInt32("FolderCount");
|
||||
_ChildFormatCount = dr.GetInt32("ChildCount");
|
||||
_ApplicablePlant = dr.GetInt32("ApplicablePlant");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
61
PROMS/Volian.Controls.Library/FormatUtility.cs
Normal file
61
PROMS/Volian.Controls.Library/FormatUtility.cs
Normal file
@ -0,0 +1,61 @@
|
||||
using Csla;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml;
|
||||
using VEPROMS.CSLA.Library;
|
||||
|
||||
namespace Volian.Controls.Library
|
||||
{
|
||||
public static class FormatUtility
|
||||
{
|
||||
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
//C2023-017: Remove any formats that are not applicable to the current plant
|
||||
public static IList<FormatInfo> GetFilteredFormatList(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;
|
||||
}
|
||||
}
|
||||
}
|
@ -240,6 +240,7 @@
|
||||
<Compile Include="FindReplace.designer.cs">
|
||||
<DependentUpon>FindReplace.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="FormatUtility.cs" />
|
||||
<Compile Include="frmEnhanced.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
|
Loading…
x
Reference in New Issue
Block a user