From 1941ab1f2b2d57c850271a872d48ba1149eadcf4 Mon Sep 17 00:00:00 2001 From: Rich Date: Tue, 9 Apr 2013 14:20:58 +0000 Subject: [PATCH] Fixed Search Annoations. The code was looking for Items which contained annotations rather than looking for the annotations. The results would list all of the annotations for items that matched the search criteria rather than just the annotations that matched the search criteria. The stored procedure "DeleteAnnotationType" was changed to delete any related records in the table tblAnnotations. This allows the user to delete annotation types that are no longer is use. The drag function for Folders, Procedures, Sections and Steps was changed to require the user to press the Control and Shift keys when dragging, thus making it more difficult to accidently move items in the Tree View. --- PROMS/DataLoader/PROMSFixes.Sql | 41 ++++++++++++++++++-- PROMS/Volian.Controls.Library/vlnTreeView.cs | 6 +-- 2 files changed, 41 insertions(+), 6 deletions(-) diff --git a/PROMS/DataLoader/PROMSFixes.Sql b/PROMS/DataLoader/PROMSFixes.Sql index 49995e1c..8a0a2011 100644 --- a/PROMS/DataLoader/PROMSFixes.Sql +++ b/PROMS/DataLoader/PROMSFixes.Sql @@ -1644,12 +1644,12 @@ select * from [FindAnnotations]('12','',0,'') CREATE FUNCTION [dbo].[FindAnnotations](@AnnotationTypeList varchar(MAX), @SearchString varchar(MAX), @CaseSensitive int, @StepTypeList varchar(MAX)) RETURNS @Results TABLE ( - ItemID int Primary Key + AnnotationID int Primary Key ) WITH EXECUTE AS OWNER BEGIN insert into @Results - select Distinct I.ItemID from Items I + select Distinct A.AnnotationID from Items I join Contents C on I.ContentID = C.ContentID left Join Parts P on P.ItemID = I.ItemID join Annotations A on A.ItemID = I.ItemID @@ -1786,7 +1786,7 @@ select DvPath, Path, I.[Level],I.[FromType],I.[Ordinal], I.[ParentID], I.[ItemID join Annotations A on A.ItemID = I.ItemID join vefn_AnnotationTypeSplit(@AnnotationTypeList) TT on TT.TypeID=A.TypeID where - I.ItemID in(select ItemID from [FindAnnotations](@AnnotationTypeList, @SearchString, @CaseSensitive, @StepTypeList)) + A.AnnotationID in(select AnnotationID from [FindAnnotations](@AnnotationTypeList, @SearchString, @CaseSensitive, @StepTypeList)) order by DvPath,OrdinalPath OPTION (MAXRECURSION 10000) END @@ -6743,3 +6743,38 @@ IF (@@Error = 0) PRINT 'Procedure Creation: getAffectedDRoUsages Succeeded' ELSE PRINT 'Procedure Creation: getAffectedDRoUsages Error on Creation' GO +/****** Object: StoredProcedure [deleteAnnotationType] ******/ +IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[deleteAnnotationType]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1) + DROP PROCEDURE [deleteAnnotationType]; +GO + +/***************************************************************************** + Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE + Copyright 2012 - Volian Enterprises, Inc. All rights reserved. +*****************************************************************************/ +CREATE PROCEDURE [dbo].[deleteAnnotationType] + +( + @TypeID int +) +WITH EXECUTE AS OWNER +AS +BEGIN TRY -- Try Block + BEGIN TRANSACTION + DELETE [tblAnnotations] + WHERE [TypeID]=@TypeID + DELETE [AnnotationTypes] + WHERE [TypeID] = @TypeID + IF( @@TRANCOUNT > 0 ) COMMIT +END TRY +BEGIN CATCH -- Catch Block + IF( @@TRANCOUNT = 1 ) ROLLBACK -- Only rollback if top level + ELSE IF( @@TRANCOUNT > 1 ) COMMIT -- Otherwise commit. Top level will rollback + EXEC vlnErrorHandler +END CATCH +GO +-- Display the status of Proc creation +IF (@@Error = 0) PRINT 'Procedure Creation: deleteAnnotationType Succeeded' +ELSE PRINT 'Procedure Creation: deleteAnnotationType Error on Creation' +GO + diff --git a/PROMS/Volian.Controls.Library/vlnTreeView.cs b/PROMS/Volian.Controls.Library/vlnTreeView.cs index 4c71a4d3..c1915dc2 100644 --- a/PROMS/Volian.Controls.Library/vlnTreeView.cs +++ b/PROMS/Volian.Controls.Library/vlnTreeView.cs @@ -1945,10 +1945,10 @@ namespace Volian.Controls.Library else { DragDropEffects ee = e.Effect; - if ((e.KeyState & 8) == 8) - ee = DragDropEffects.None; // Don't allow copy this way - Copy it + if (e.KeyState == 13) // Shift and Control Keys to do a move. + ee = DragDropEffects.Move; else - ee = DragDropEffects.Move; // Move it + ee = DragDropEffects.None; // Default - Do nothing if (IsChild(dragNode, dl.DropNode)) // Don't copy or move to a child node ee = DragDropEffects.None; else if (IsDocVersion((VETreeNode)dragNode)) // Don't move docversions