B2017-230 Added a stored procedure and function to check for the usage of a given applicability.
B2017-230 added references to working draft property page to all applicability usage check results to appear in the Search panel results pane. B2017-230 Added a check for the usage of the applicability that the user wants to remove.
This commit is contained in:
parent
e5938b1815
commit
bd265442d3
@ -5286,7 +5286,68 @@ GO
|
|||||||
IF (@@Error = 0) PRINT 'Function: ve_GetItemDerivedApplicability Succeeded'
|
IF (@@Error = 0) PRINT 'Function: ve_GetItemDerivedApplicability Succeeded'
|
||||||
ELSE PRINT 'Function: ve_GetItemDerivedApplicability Error on Creation'
|
ELSE PRINT 'Function: ve_GetItemDerivedApplicability Error on Creation'
|
||||||
GO
|
GO
|
||||||
|
-------
|
||||||
|
|
||||||
|
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[ve_GetItemAppliedApplicability]') AND OBJECTPROPERTY(id,N'IsScalarFunction') = 1)
|
||||||
|
DROP FUNCTION [ve_GetItemAppliedApplicability];
|
||||||
|
GO
|
||||||
|
|
||||||
|
/****** Object: UserDefinedFunction [dbo].[ve_GetItemAppliedApplicability] Script Date: 09/17/2018 ******/
|
||||||
|
SET ANSI_NULLS ON
|
||||||
|
GO
|
||||||
|
SET QUOTED_IDENTIFIER ON
|
||||||
|
GO
|
||||||
|
/*
|
||||||
|
select [dbo].[ve_GetItemAppliedApplicability](48)
|
||||||
|
*/
|
||||||
|
/*****************************************************************************
|
||||||
|
Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
|
||||||
|
Copyright 2018 - Volian Enterprises, Inc. All rights reserved.
|
||||||
|
*****************************************************************************/
|
||||||
|
CREATE FUNCTION [dbo].[ve_GetItemAppliedApplicability] (@ItemID int) RETURNS varchar(max)
|
||||||
|
WITH EXECUTE AS OWNER
|
||||||
|
AS
|
||||||
|
BEGIN
|
||||||
|
declare @apple varchar(max)
|
||||||
|
select @apple = dbo.ve_getitemapplicability(@ItemID)
|
||||||
|
if(@apple is null)Set @Apple=''
|
||||||
|
/***
|
||||||
|
begin
|
||||||
|
declare @ParentID int
|
||||||
|
select @ParentID = dbo.ve_getparentitem(@ItemID)
|
||||||
|
if @parentid is not null
|
||||||
|
set @apple = dbo.ve_GetItemDerivedApplicability(@ParentID)
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
select @apple = coalesce(@apple + ',','') + r2.value('@index','varchar(max)') from
|
||||||
|
(select cast(config as xml) xconfig from docversions
|
||||||
|
where versionid = dbo.vefn_GetVersionIDByItemID(@ItemID)) ah
|
||||||
|
cross apply xconfig.nodes('//Slave') t2(r2)
|
||||||
|
if(@apple is null) -- Non PC P/C Item
|
||||||
|
BEGIN -- Get maximum Applicabilty
|
||||||
|
declare @n int
|
||||||
|
select @n=max(xSlave.value('@index','int')) from (
|
||||||
|
select versionID, Cast(config as xml) xConfig from DocVersions) t1
|
||||||
|
cross apply xconfig.nodes('//Slave') tSlave(xSlave)
|
||||||
|
if(@n is not null)
|
||||||
|
begin -- Build a list based upon the maximum
|
||||||
|
with cte(ii) as (select 1 ii union all select ii+1 from cte where ii < @n)
|
||||||
|
select @apple = coalesce(@apple+',','') + cast(ii as varchar(max)) from cte
|
||||||
|
end
|
||||||
|
if(@apple is null)Set @Apple=''
|
||||||
|
END
|
||||||
|
end
|
||||||
|
end
|
||||||
|
***/
|
||||||
|
return @apple
|
||||||
|
END
|
||||||
|
GO
|
||||||
|
-- Display the status of TableFunction creation
|
||||||
|
IF (@@Error = 0) PRINT 'Function: ve_GetItemDerivedApplicability Succeeded'
|
||||||
|
ELSE PRINT 'Function: ve_GetItemDerivedApplicability Error on Creation'
|
||||||
|
GO
|
||||||
|
|
||||||
|
-------
|
||||||
/****** Object: UserDefinedFunction [dbo].[vefn_GetParentItem] Script Date: 03/28/2012 17:58:48 ******/
|
/****** Object: UserDefinedFunction [dbo].[vefn_GetParentItem] Script Date: 03/28/2012 17:58:48 ******/
|
||||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[ve_GetParentItem]') AND OBJECTPROPERTY(id,N'IsScalarFunction') = 1)
|
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[ve_GetParentItem]') AND OBJECTPROPERTY(id,N'IsScalarFunction') = 1)
|
||||||
DROP FUNCTION [ve_GetParentItem];
|
DROP FUNCTION [ve_GetParentItem];
|
||||||
@ -13883,6 +13944,91 @@ GO
|
|||||||
IF (@@Error = 0) PRINT 'Procedure Creation: getAllFormats Succeeded'
|
IF (@@Error = 0) PRINT 'Procedure Creation: getAllFormats Succeeded'
|
||||||
ELSE PRINT 'Procedure Creation: getAllFormats Error on Creation'
|
ELSE PRINT 'Procedure Creation: getAllFormats Error on Creation'
|
||||||
GO
|
GO
|
||||||
|
-----
|
||||||
|
/****** Object: StoredProcedure [vesp_SearchSepcifiedApplicability] ******/
|
||||||
|
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[vesp_SearchSepcifiedApplicability]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||||
|
DROP PROCEDURE [vesp_SearchSepcifiedApplicability];
|
||||||
|
GO
|
||||||
|
|
||||||
|
/*
|
||||||
|
exec vesp_SearchSepcifiedApplicability '16','','',0,0,0,0,'','3'
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
|
||||||
|
Copyright 2018 - Volian Enterprises, Inc. All rights reserved.
|
||||||
|
*****************************************************************************/
|
||||||
|
CREATE PROCEDURE [dbo].[vesp_SearchSepcifiedApplicability] (@DocVersionList varchar(MAX), @StepTypeList varchar(MAX),
|
||||||
|
@SearchString varchar(MAX), @CaseSensitive as int, @IncludeLinks as int, @IncludeRtfFormatting as int, @IncludeSpecialCharacters as int, @UnitPrefix as varchar(MAX), @ApplicSetting varchar(MAX))
|
||||||
|
WITH EXECUTE AS OWNER
|
||||||
|
AS
|
||||||
|
select ZZ.DvPath, ZZ.Path, ZZ.[Level],ZZ.[FromType],ZZ.[Ordinal], ZZ.[ParentID], ZZ.[ItemID],ZZ.[PreviousID],ZZ.[ContentID],ZZ.[DTS],ZZ.[UserID]
|
||||||
|
,II.[LastChanged]
|
||||||
|
,CC.[Number],CC.[Text],CC.[Type],CC.[FormatID],CC.[Config],CC.[DTS] [cDTS],CC.[UserID] [cUserID]
|
||||||
|
,CC.[LastChanged] [cLastChanged],
|
||||||
|
PP.[ContentID] [pContentID], PP.[DTS] [pDTS],PP.[UserID] [pUserID], PP.[LastChanged] [pLastChanged],
|
||||||
|
(SELECT COUNT(*) FROM [Annotations] WHERE [Annotations].[ItemID]=ZZ.[ItemID]) [AnnotationCount],
|
||||||
|
(SELECT COUNT(*) FROM [DocVersions] WHERE [DocVersions].[ItemID]=ZZ.[ItemID]) [DocVersionCount],
|
||||||
|
(SELECT COUNT(*) FROM [Items] [Next] WHERE [Next].[PreviousID]=ZZ.[ItemID]) [NextCount],
|
||||||
|
(SELECT COUNT(*) FROM [Parts] WHERE [Parts].[ItemID]=ZZ.[ItemID]) [PartCount],
|
||||||
|
(SELECT COUNT(*) FROM [Transitions] WHERE [Transitions].[RangeID]=ZZ.[ItemID]) [Transition_RangeIDCount],
|
||||||
|
(SELECT COUNT(*) FROM [Transitions] WHERE [Transitions].[ToID]=ZZ.[ItemID]) [Transition_ToIDCount],
|
||||||
|
(SELECT COUNT(*) FROM [Details] WHERE [Details].[ContentID]=CC.[ContentID]) [DetailCount],
|
||||||
|
(SELECT COUNT(*) FROM [Entries] WHERE [Entries].[ContentID]=CC.[ContentID]) [EntryCount],
|
||||||
|
(SELECT COUNT(*) FROM [Grids] WHERE [Grids].[ContentID]=CC.[ContentID]) [GridCount],
|
||||||
|
(SELECT COUNT(*) FROM [Images] WHERE [Images].[ContentID]=CC.[ContentID]) [ImageCount],
|
||||||
|
(SELECT COUNT(*) FROM [Items] WHERE [Items].[ContentID]=CC.[ContentID]) [ItemCount],
|
||||||
|
(SELECT COUNT(*) FROM [Parts] WHERE [Parts].[ContentID]=CC.[ContentID]) [cPartCount],
|
||||||
|
(SELECT COUNT(*) FROM [RoUsages] WHERE [RoUsages].[ContentID]=CC.[ContentID]) [RoUsageCount],
|
||||||
|
(SELECT COUNT(*) FROM [Transitions] WHERE [Transitions].[FromID]=CC.[ContentID]) [TransitionCount],
|
||||||
|
(SELECT COUNT(*) FROM [ZContents] WHERE [ZContents].[ContentID]=CC.[ContentID]) [ZContentCount]
|
||||||
|
from vefn_SiblingAndChildrenItems(@DocVersionList, @UnitPrefix) ZZ
|
||||||
|
Join Items II on ZZ.ItemID=II.ItemID
|
||||||
|
Left Join Parts PP on ZZ.PContentID=PP.ContentID and ZZ.FromType = PP.FromType
|
||||||
|
Join Contents CC on CC.ContentID=ZZ.ContentID
|
||||||
|
where ZZ.ContentID in (select ContentID from vefn_FindSpecificApplicUsage(@DocVersionList, @ApplicSetting))
|
||||||
|
order by DvPath,OrdinalPath
|
||||||
|
GO
|
||||||
|
IF (@@Error = 0) PRINT 'Procedure Creation: vesp_SearchSepcifiedApplicability Succeeded'
|
||||||
|
ELSE PRINT 'Procedure Creation: vesp_SearchSepcifiedApplicability Error on Creation'
|
||||||
|
GO
|
||||||
|
-----
|
||||||
|
/****** Object: StoredProcedure [vefn_FindSpecificApplicUsage] ******/
|
||||||
|
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[vefn_FindSpecificApplicUsage]') AND OBJECTPROPERTY(id,N'IsTableFunction') = 1)
|
||||||
|
DROP FUNCTION [vefn_FindSpecificApplicUsage];
|
||||||
|
GO
|
||||||
|
|
||||||
|
/*
|
||||||
|
exec vefn_FindSpecificApplicUsage '16','3'
|
||||||
|
*/
|
||||||
|
/*****************************************************************************
|
||||||
|
Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
|
||||||
|
Copyright 2018 - Volian Enterprises, Inc. All rights reserved.
|
||||||
|
*****************************************************************************/
|
||||||
|
CREATE FUNCTION [dbo].[vefn_FindSpecificApplicUsage](
|
||||||
|
@DocVersionList nvarchar(MAX)
|
||||||
|
,@ApplicSetting varchar(MAX))
|
||||||
|
RETURNS @FoundContents TABLE
|
||||||
|
(
|
||||||
|
ContentID int PRIMARY KEY
|
||||||
|
)
|
||||||
|
WITH EXECUTE AS OWNER
|
||||||
|
AS
|
||||||
|
BEGIN
|
||||||
|
insert into @FoundContents
|
||||||
|
select C.ContentID from (select * from Contents where ContentID in(select ContentID from vefn_DVContent(@DocVersionList))) C
|
||||||
|
join
|
||||||
|
items ii
|
||||||
|
on ii.ContentID = C.ContentID
|
||||||
|
where ','+ dbo.ve_GetItemAppliedApplicability(ii.ItemID ) + ',' like '%,' + @ApplicSetting + ',%'
|
||||||
|
RETURN
|
||||||
|
END
|
||||||
|
|
||||||
|
GO
|
||||||
|
-- Display the status of Proc creation
|
||||||
|
IF (@@Error = 0) PRINT 'Procedure Creation: vefn_FindSpecificApplicUsage Succeeded'
|
||||||
|
ELSE PRINT 'Procedure Creation: vefn_FindSpecificApplicUsage Error on Creation'
|
||||||
|
GO
|
||||||
|
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
/*
|
/*
|
||||||
@ -13909,8 +14055,8 @@ BEGIN TRY -- Try Block
|
|||||||
set nocount on
|
set nocount on
|
||||||
DECLARE @RevDate varchar(255)
|
DECLARE @RevDate varchar(255)
|
||||||
DECLARE @RevDescription varchar(255)
|
DECLARE @RevDescription varchar(255)
|
||||||
set @RevDate = '6/15/2018 09:37 AM'
|
set @RevDate = '9/27/2018 10:09 AM'
|
||||||
set @RevDescription = 'Fixed embedded degree characters'
|
set @RevDescription = 'added vesp_SearchSepcifiedApplicability'
|
||||||
Select cast(@RevDate as datetime) RevDate, @RevDescription RevDescription
|
Select cast(@RevDate as datetime) RevDate, @RevDescription RevDescription
|
||||||
PRINT 'SQL Code Revision ' + @RevDate + ' - ' + @RevDescription
|
PRINT 'SQL Code Revision ' + @RevDate + ' - ' + @RevDescription
|
||||||
IF( @@TRANCOUNT > 0 ) COMMIT
|
IF( @@TRANCOUNT > 0 ) COMMIT
|
||||||
|
@ -2675,7 +2675,13 @@ namespace VEPROMS
|
|||||||
int ownerID = MySessionInfo.CheckOutItem(args.DocVersionConfig.MyDocVersion.VersionID, CheckOutType.DocVersion);
|
int ownerID = MySessionInfo.CheckOutItem(args.DocVersionConfig.MyDocVersion.VersionID, CheckOutType.DocVersion);
|
||||||
frmVersionsProperties frmver = new frmVersionsProperties(args.DocVersionConfig);
|
frmVersionsProperties frmver = new frmVersionsProperties(args.DocVersionConfig);
|
||||||
frmver.ProgressBar = bottomProgBar;
|
frmver.ProgressBar = bottomProgBar;
|
||||||
|
frmver.DisplaySearch1 = displaySearch1; //B2017-230 provide access to global search
|
||||||
dr = frmver.ShowDialog();
|
dr = frmver.ShowDialog();
|
||||||
|
if (frmver._showApplicSearchResults) //B2017-230 open global search with places that specifiy the applicabilty that the user tried to delete
|
||||||
|
{
|
||||||
|
toolsPanel.Expanded = true;
|
||||||
|
toolsTabs.SelectedTab = toolstabResults;
|
||||||
|
}
|
||||||
MySessionInfo.CheckInItem(ownerID);
|
MySessionInfo.CheckInItem(ownerID);
|
||||||
}
|
}
|
||||||
else if (args.ProcedureConfig != null)
|
else if (args.ProcedureConfig != null)
|
||||||
|
@ -39,6 +39,14 @@ namespace VEPROMS
|
|||||||
private string _DefaultChgBarUsrMsg2 = null;
|
private string _DefaultChgBarUsrMsg2 = null;
|
||||||
private bool _DefaultDisableDuplex = false;
|
private bool _DefaultDisableDuplex = false;
|
||||||
|
|
||||||
|
private DisplaySearch _DisplaySearch1 = null;
|
||||||
|
|
||||||
|
public DisplaySearch DisplaySearch1
|
||||||
|
{
|
||||||
|
get { return _DisplaySearch1; }
|
||||||
|
set { _DisplaySearch1 = value; }
|
||||||
|
}
|
||||||
|
|
||||||
// For the initial release, we are assuming there will be only one rofst for a docversion. Changes
|
// For the initial release, we are assuming there will be only one rofst for a docversion. Changes
|
||||||
// will be needed here if more than 1.
|
// will be needed here if more than 1.
|
||||||
private ROFstInfo _SelectedROFst;
|
private ROFstInfo _SelectedROFst;
|
||||||
@ -1376,10 +1384,34 @@ namespace VEPROMS
|
|||||||
bsApples.DataSource = _Apples;
|
bsApples.DataSource = _Apples;
|
||||||
lbApplicabilities.SelectedItem = cfg;
|
lbApplicabilities.SelectedItem = cfg;
|
||||||
}
|
}
|
||||||
|
public bool _showApplicSearchResults = false;
|
||||||
|
private bool ApplicIsUsed(MiniConfig cfg) // B2017-230 - don't allow user to remove an applicability that is being used (specified)
|
||||||
|
{
|
||||||
|
if (_showApplicSearchResults)
|
||||||
|
{
|
||||||
|
_showApplicSearchResults = false;
|
||||||
|
_DisplaySearch1.SearchResults = null;
|
||||||
|
}
|
||||||
|
Cursor.Current = Cursors.WaitCursor;
|
||||||
|
ItemInfoList placesUsed = ItemInfoList.GetListFromApplicabilitySearch(_DocVersionConfig.MyDocVersion.VersionID.ToString(), "", "", 0, ItemSearchIncludeLinks.Nothing, false, false, "", cfg.Index.ToString());
|
||||||
|
Cursor.Current = Cursors.Default;
|
||||||
|
if (placesUsed != null && placesUsed.Count > 0)
|
||||||
|
{ // B2017-230 give user option to save the locations in Global Search results
|
||||||
|
if (MessageBox.Show(string.Format("Cannot remove an Applicability that is being use in {0} places.\n\nDo you want to view locations via Search Results?\n\nThe Search panel will open when you exit the property page.",placesUsed.Count), "Applicability In Use", MessageBoxButtons.YesNo) == DialogResult.Yes)
|
||||||
|
{
|
||||||
|
_showApplicSearchResults = true;
|
||||||
|
_DisplaySearch1.SearchResults = placesUsed;
|
||||||
|
_DisplaySearch1.ReportTitle = string.Format("{0} Applicability", cfg.Name);
|
||||||
|
_DisplaySearch1.TypesSelected = string.Format("These Locations Specify The \"{0}\" Applicability", cfg.Name);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
private void btnDelApple_Click(object sender, EventArgs e)
|
private void btnDelApple_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
MiniConfig cfg = bsApples.Current as MiniConfig;
|
MiniConfig cfg = bsApples.Current as MiniConfig;
|
||||||
if (MessageBox.Show(string.Format("Are you sure you want to delete {0}", cfg.Name), "Confirm Delete", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question) == DialogResult.Yes)
|
if (!ApplicIsUsed(cfg) && MessageBox.Show(string.Format("Are you sure you want to delete {0}", cfg.Name), "Confirm Delete", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||||
{
|
{
|
||||||
if (_DeletedApples == null)
|
if (_DeletedApples == null)
|
||||||
_DeletedApples = new List<MiniConfig>();
|
_DeletedApples = new List<MiniConfig>();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user