new settings to control conversion of approved data
fixed handling of this set only deleted developer mode add master slave menu item (under development) add loading of approved data to complete processing remove background double-click event handler added menu item for loading approved data added menu item for master slave (under development) added stored procedures and functions removed from BuildVEPROMS.sql added purging of tables to support master slave (under development)
This commit is contained in:
parent
f673a0a119
commit
bcf31cdfa2
@ -41,6 +41,37 @@ IF (@@Error = 0) PRINT 'Table Creation: DeleteLog Succeeded'
|
||||
ELSE PRINT 'Table Creation: DeleteLog Error on Creation'
|
||||
GO
|
||||
|
||||
/****** Object: StoredProcedure [vlnErrorHandler] ******/
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[vlnErrorHandler]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||
DROP PROCEDURE [vlnErrorHandler];
|
||||
GO
|
||||
|
||||
CREATE PROCEDURE [dbo].[vlnErrorHandler]
|
||||
(@ExpectedCount int=-1
|
||||
,@MessageFormat nvarchar(512)=N'Expected RowCount (%d) not met (%d)')
|
||||
WITH EXECUTE AS OWNER
|
||||
AS
|
||||
BEGIN
|
||||
DECLARE @ErrorMessage NVARCHAR(4000), @ErrorNumber INT, @ErrorSeverity INT, @ErrorState INT, @ErrorProcedure NVARCHAR(126)
|
||||
, @ErrorLine INT, @RowCount INT;
|
||||
SELECT @ErrorMessage = ERROR_MESSAGE(), @ErrorSeverity = ERROR_SEVERITY(), @ErrorState = ERROR_STATE(),@ErrorNumber = ERROR_NUMBER()
|
||||
, @ErrorLine = ERROR_LINE(), @ErrorProcedure = ERROR_PROCEDURE(), @RowCount = @@RowCount;
|
||||
IF @ErrorNumber > 0
|
||||
BEGIN
|
||||
IF @ErrorProcedure = OBJECT_NAME(@@PROCID) -- If the Procedure is the current procedure just pass the error message
|
||||
RAISERROR (@ErrorMessage, @ErrorSeverity, @ErrorState)
|
||||
ELSE -- Add in the procedure name and line as well as the error number
|
||||
RAISERROR (N'%s[%d] - (%d) %s', @ErrorSeverity, @ErrorState, @ErrorProcedure, @ErrorLine, @ErrorNumber, @ErrorMessage)
|
||||
END
|
||||
ELSE IF @ExpectedCount <> -1 AND @ExpectedCount <> @RowCount
|
||||
RAISERROR (@MessageFormat, 16, 1, @ExpectedCount, @RowCount)
|
||||
END
|
||||
GO
|
||||
-- Display the status of Proc creation
|
||||
IF (@@Error = 0) PRINT 'Procedure Creation: vlnErrorHandler Succeeded'
|
||||
ELSE PRINT 'Procedure Creation: vlnErrorHandler Error on Creation'
|
||||
GO
|
||||
|
||||
/****** Object: StoredProcedure [addAnnotation] ******/
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[addAnnotation]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||
DROP PROCEDURE [addAnnotation];
|
||||
@ -1086,6 +1117,264 @@ GO
|
||||
IF (@@Error = 0) PRINT 'Procedure Creation: addItem Succeeded'
|
||||
ELSE PRINT 'Procedure Creation: addItem Error on Creation'
|
||||
GO
|
||||
--HERE
|
||||
/****** Object: StoredProcedure [addPart] ******/
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[addPart]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||
DROP PROCEDURE [addPart];
|
||||
GO
|
||||
|
||||
CREATE PROCEDURE [dbo].[addPart]
|
||||
|
||||
(
|
||||
@ContentID int,
|
||||
@FromType int,
|
||||
@ItemID int,
|
||||
@DTS datetime,
|
||||
@UserID nvarchar(100),
|
||||
@newLastChanged timestamp output
|
||||
)
|
||||
WITH EXECUTE AS OWNER
|
||||
AS
|
||||
BEGIN TRY -- Try Block
|
||||
BEGIN TRANSACTION
|
||||
INSERT INTO [Parts]
|
||||
(
|
||||
[ContentID],
|
||||
[FromType],
|
||||
[ItemID],
|
||||
[DTS],
|
||||
[UserID]
|
||||
)
|
||||
VALUES
|
||||
(
|
||||
@ContentID,
|
||||
@FromType,
|
||||
@ItemID,
|
||||
@DTS,
|
||||
@UserID
|
||||
)
|
||||
|
||||
SELECT @newLastChanged=[LastChanged]
|
||||
FROM [Parts] WHERE [ContentID]=@ContentID AND [FromType]=@FromType
|
||||
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: addPart Succeeded'
|
||||
ELSE PRINT 'Procedure Creation: addPart Error on Creation'
|
||||
GO
|
||||
|
||||
/****** Object: StoredProcedure [updatePart] ******/
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[updatePart]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||
DROP PROCEDURE [updatePart];
|
||||
GO
|
||||
|
||||
CREATE PROCEDURE [dbo].[updatePart]
|
||||
|
||||
(
|
||||
@ContentID int,
|
||||
@FromType int,
|
||||
@ItemID int,
|
||||
@DTS datetime,
|
||||
@UserID nvarchar(100),
|
||||
@LastChanged timestamp,
|
||||
@newLastChanged timestamp output
|
||||
)
|
||||
WITH EXECUTE AS OWNER
|
||||
AS
|
||||
BEGIN TRY -- Try Block
|
||||
BEGIN TRANSACTION
|
||||
UPDATE [Parts]
|
||||
SET
|
||||
[ItemID]=@ItemID,
|
||||
[DTS]=@DTS,
|
||||
[UserID]=@UserID
|
||||
WHERE [ContentID]=@ContentID AND [FromType]=@FromType AND [LastChanged]=@LastChanged
|
||||
IF @@ROWCOUNT = 0
|
||||
BEGIN
|
||||
IF NOT exists(select * from [Parts] WHERE [ContentID]=@ContentID AND [FromType]=@FromType)
|
||||
RAISERROR('Part record has been deleted by another user', 16, 1)
|
||||
ELSE
|
||||
RAISERROR('Part has been edited by another user', 16, 1)
|
||||
END
|
||||
|
||||
SELECT @newLastChanged=[LastChanged]
|
||||
FROM [Parts] WHERE [ContentID]=@ContentID AND [FromType]=@FromType
|
||||
|
||||
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: updatePart Succeeded'
|
||||
ELSE PRINT 'Procedure Creation: updatePart Error on Creation'
|
||||
GO
|
||||
|
||||
/****** Object: StoredProcedure [getItem] ******/
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[getItem]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||
DROP PROCEDURE [getItem];
|
||||
GO
|
||||
|
||||
CREATE PROCEDURE [dbo].[getItem]
|
||||
|
||||
(
|
||||
@ItemID int
|
||||
)
|
||||
WITH EXECUTE AS OWNER
|
||||
AS
|
||||
SELECT
|
||||
[ItemID],
|
||||
[PreviousID],
|
||||
[ContentID],
|
||||
[DTS],
|
||||
[UserID],
|
||||
[LastChanged],
|
||||
(SELECT COUNT(*) FROM [Annotations] WHERE [Annotations].[ItemID]=[Items].[ItemID]) [AnnotationCount],
|
||||
(SELECT COUNT(*) FROM [DocVersions] WHERE [DocVersions].[ItemID]=[Items].[ItemID]) [DocVersionCount],
|
||||
(SELECT COUNT(*) FROM [Items] [Next] WHERE [Next].[PreviousID]=[Items].[ItemID]) [NextCount],
|
||||
(SELECT COUNT(*) FROM [Parts] WHERE [Parts].[ItemID]=[Items].[ItemID]) [PartCount],
|
||||
(SELECT COUNT(*) FROM [Transitions] WHERE [Transitions].[RangeID]=[Items].[ItemID]) [Transition_RangeIDCount],
|
||||
(SELECT COUNT(*) FROM [Transitions] WHERE [Transitions].[ToID]=[Items].[ItemID]) [Transition_ToIDCount]
|
||||
FROM [Items]
|
||||
WHERE [ItemID]=@ItemID
|
||||
|
||||
SELECT
|
||||
[Annotations].[AnnotationID],
|
||||
[Annotations].[ItemID],
|
||||
[Annotations].[TypeID],
|
||||
[Annotations].[RtfText],
|
||||
[Annotations].[SearchText],
|
||||
[Annotations].[Config],
|
||||
[Annotations].[DTS],
|
||||
[Annotations].[UserID],
|
||||
[Annotations].[LastChanged],
|
||||
[AnnotationTypes].[Name] [AnnotationType_Name],
|
||||
[AnnotationTypes].[Config] [AnnotationType_Config],
|
||||
[AnnotationTypes].[DTS] [AnnotationType_DTS],
|
||||
[AnnotationTypes].[UserID] [AnnotationType_UserID]
|
||||
FROM [Annotations]
|
||||
JOIN [AnnotationTypes] ON
|
||||
[AnnotationTypes].[TypeID]=[Annotations].[TypeID]
|
||||
WHERE
|
||||
[Annotations].[ItemID]=@ItemID
|
||||
|
||||
|
||||
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].[ItemID]=@ItemID
|
||||
|
||||
|
||||
SELECT
|
||||
[Parts].[ContentID],
|
||||
[Parts].[FromType],
|
||||
[Parts].[ItemID],
|
||||
[Parts].[DTS],
|
||||
[Parts].[UserID],
|
||||
[Parts].[LastChanged],
|
||||
[Contents].[Number] [Content_Number],
|
||||
[Contents].[Text] [Content_Text],
|
||||
[Contents].[Type] [Content_Type],
|
||||
[Contents].[FormatID] [Content_FormatID],
|
||||
[Contents].[Config] [Content_Config],
|
||||
[Contents].[DTS] [Content_DTS],
|
||||
[Contents].[UserID] [Content_UserID]
|
||||
FROM [Parts]
|
||||
JOIN [Contents] ON
|
||||
[Contents].[ContentID]=[Parts].[ContentID]
|
||||
WHERE
|
||||
[Parts].[ItemID]=@ItemID
|
||||
|
||||
|
||||
SELECT
|
||||
[Transitions].[TransitionID],
|
||||
[Transitions].[FromID],
|
||||
[Transitions].[ToID],
|
||||
[Transitions].[RangeID],
|
||||
[Transitions].[IsRange],
|
||||
[Transitions].[TranType],
|
||||
[Transitions].[Config],
|
||||
[Transitions].[DTS],
|
||||
[Transitions].[UserID],
|
||||
[Transitions].[LastChanged],
|
||||
[Contents].[Number] [Content_Number],
|
||||
[Contents].[Text] [Content_Text],
|
||||
[Contents].[Type] [Content_Type],
|
||||
[Contents].[FormatID] [Content_FormatID],
|
||||
[Contents].[Config] [Content_Config],
|
||||
[Contents].[DTS] [Content_DTS],
|
||||
[Contents].[UserID] [Content_UserID]
|
||||
FROM [Transitions]
|
||||
JOIN [Contents] ON
|
||||
[Contents].[ContentID]=[Transitions].[FromID]
|
||||
WHERE
|
||||
[Transitions].[RangeID]=@ItemID
|
||||
|
||||
|
||||
SELECT
|
||||
[Transitions].[TransitionID],
|
||||
[Transitions].[FromID],
|
||||
[Transitions].[ToID],
|
||||
[Transitions].[RangeID],
|
||||
[Transitions].[IsRange],
|
||||
[Transitions].[TranType],
|
||||
[Transitions].[Config],
|
||||
[Transitions].[DTS],
|
||||
[Transitions].[UserID],
|
||||
[Transitions].[LastChanged],
|
||||
[Contents].[Number] [Content_Number],
|
||||
[Contents].[Text] [Content_Text],
|
||||
[Contents].[Type] [Content_Type],
|
||||
[Contents].[FormatID] [Content_FormatID],
|
||||
[Contents].[Config] [Content_Config],
|
||||
[Contents].[DTS] [Content_DTS],
|
||||
[Contents].[UserID] [Content_UserID]
|
||||
FROM [Transitions]
|
||||
JOIN [Contents] ON
|
||||
[Contents].[ContentID]=[Transitions].[FromID]
|
||||
WHERE
|
||||
[Transitions].[ToID]=@ItemID
|
||||
|
||||
RETURN
|
||||
GO
|
||||
-- Display the status of Proc creation
|
||||
IF (@@Error = 0) PRINT 'Procedure Creation: getItem Succeeded'
|
||||
ELSE PRINT 'Procedure Creation: getItem Error on Creation'
|
||||
GO
|
||||
|
||||
--HERE
|
||||
|
||||
/****** Object: StoredProcedure [addItemChild] ******/
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[addItemChild]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||
@ -1410,57 +1699,6 @@ IF (@@Error = 0) PRINT 'Procedure Creation: addMembership Succeeded'
|
||||
ELSE PRINT 'Procedure Creation: addMembership Error on Creation'
|
||||
GO
|
||||
|
||||
/****** Object: StoredProcedure [addPart] ******/
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[addPart]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||
DROP PROCEDURE [addPart];
|
||||
GO
|
||||
|
||||
CREATE PROCEDURE [dbo].[addPart]
|
||||
|
||||
(
|
||||
@ContentID int,
|
||||
@FromType int,
|
||||
@ItemID int,
|
||||
@DTS datetime,
|
||||
@UserID nvarchar(100),
|
||||
@newLastChanged timestamp output
|
||||
)
|
||||
WITH EXECUTE AS OWNER
|
||||
AS
|
||||
BEGIN TRY -- Try Block
|
||||
BEGIN TRANSACTION
|
||||
INSERT INTO [Parts]
|
||||
(
|
||||
[ContentID],
|
||||
[FromType],
|
||||
[ItemID],
|
||||
[DTS],
|
||||
[UserID]
|
||||
)
|
||||
VALUES
|
||||
(
|
||||
@ContentID,
|
||||
@FromType,
|
||||
@ItemID,
|
||||
@DTS,
|
||||
@UserID
|
||||
)
|
||||
|
||||
SELECT @newLastChanged=[LastChanged]
|
||||
FROM [Parts] WHERE [ContentID]=@ContentID AND [FromType]=@FromType
|
||||
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: addPart Succeeded'
|
||||
ELSE PRINT 'Procedure Creation: addPart Error on Creation'
|
||||
GO
|
||||
|
||||
/****** Object: StoredProcedure [addPdf] ******/
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[addPdf]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||
DROP PROCEDURE [addPdf];
|
||||
@ -2341,7 +2579,6 @@ BEGIN CATCH -- Catch Block
|
||||
EXEC vlnErrorHandler
|
||||
END CATCH
|
||||
|
||||
--USE MASTER
|
||||
GO
|
||||
-- Display the status of Proc creation
|
||||
IF (@@Error = 0) PRINT 'Procedure Creation: CopyItemAndChildren Succeeded'
|
||||
@ -7812,161 +8049,6 @@ IF (@@Error = 0) PRINT 'Procedure Creation: getImagesByContentID Succeeded'
|
||||
ELSE PRINT 'Procedure Creation: getImagesByContentID Error on Creation'
|
||||
GO
|
||||
|
||||
/****** Object: StoredProcedure [getItem] ******/
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[getItem]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||
DROP PROCEDURE [getItem];
|
||||
GO
|
||||
|
||||
CREATE PROCEDURE [dbo].[getItem]
|
||||
|
||||
(
|
||||
@ItemID int
|
||||
)
|
||||
WITH EXECUTE AS OWNER
|
||||
AS
|
||||
SELECT
|
||||
[ItemID],
|
||||
[PreviousID],
|
||||
[ContentID],
|
||||
[DTS],
|
||||
[UserID],
|
||||
[LastChanged],
|
||||
(SELECT COUNT(*) FROM [Annotations] WHERE [Annotations].[ItemID]=[Items].[ItemID]) [AnnotationCount],
|
||||
(SELECT COUNT(*) FROM [DocVersions] WHERE [DocVersions].[ItemID]=[Items].[ItemID]) [DocVersionCount],
|
||||
(SELECT COUNT(*) FROM [Items] [Next] WHERE [Next].[PreviousID]=[Items].[ItemID]) [NextCount],
|
||||
(SELECT COUNT(*) FROM [Parts] WHERE [Parts].[ItemID]=[Items].[ItemID]) [PartCount],
|
||||
(SELECT COUNT(*) FROM [Transitions] WHERE [Transitions].[RangeID]=[Items].[ItemID]) [Transition_RangeIDCount],
|
||||
(SELECT COUNT(*) FROM [Transitions] WHERE [Transitions].[ToID]=[Items].[ItemID]) [Transition_ToIDCount]
|
||||
FROM [Items]
|
||||
WHERE [ItemID]=@ItemID
|
||||
|
||||
SELECT
|
||||
[Annotations].[AnnotationID],
|
||||
[Annotations].[ItemID],
|
||||
[Annotations].[TypeID],
|
||||
[Annotations].[RtfText],
|
||||
[Annotations].[SearchText],
|
||||
[Annotations].[Config],
|
||||
[Annotations].[DTS],
|
||||
[Annotations].[UserID],
|
||||
[Annotations].[LastChanged],
|
||||
[AnnotationTypes].[Name] [AnnotationType_Name],
|
||||
[AnnotationTypes].[Config] [AnnotationType_Config],
|
||||
[AnnotationTypes].[DTS] [AnnotationType_DTS],
|
||||
[AnnotationTypes].[UserID] [AnnotationType_UserID]
|
||||
FROM [Annotations]
|
||||
JOIN [AnnotationTypes] ON
|
||||
[AnnotationTypes].[TypeID]=[Annotations].[TypeID]
|
||||
WHERE
|
||||
[Annotations].[ItemID]=@ItemID
|
||||
|
||||
|
||||
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].[ItemID]=@ItemID
|
||||
|
||||
|
||||
SELECT
|
||||
[Parts].[ContentID],
|
||||
[Parts].[FromType],
|
||||
[Parts].[ItemID],
|
||||
[Parts].[DTS],
|
||||
[Parts].[UserID],
|
||||
[Parts].[LastChanged],
|
||||
[Contents].[Number] [Content_Number],
|
||||
[Contents].[Text] [Content_Text],
|
||||
[Contents].[Type] [Content_Type],
|
||||
[Contents].[FormatID] [Content_FormatID],
|
||||
[Contents].[Config] [Content_Config],
|
||||
[Contents].[DTS] [Content_DTS],
|
||||
[Contents].[UserID] [Content_UserID]
|
||||
FROM [Parts]
|
||||
JOIN [Contents] ON
|
||||
[Contents].[ContentID]=[Parts].[ContentID]
|
||||
WHERE
|
||||
[Parts].[ItemID]=@ItemID
|
||||
|
||||
|
||||
SELECT
|
||||
[Transitions].[TransitionID],
|
||||
[Transitions].[FromID],
|
||||
[Transitions].[ToID],
|
||||
[Transitions].[RangeID],
|
||||
[Transitions].[IsRange],
|
||||
[Transitions].[TranType],
|
||||
[Transitions].[Config],
|
||||
[Transitions].[DTS],
|
||||
[Transitions].[UserID],
|
||||
[Transitions].[LastChanged],
|
||||
[Contents].[Number] [Content_Number],
|
||||
[Contents].[Text] [Content_Text],
|
||||
[Contents].[Type] [Content_Type],
|
||||
[Contents].[FormatID] [Content_FormatID],
|
||||
[Contents].[Config] [Content_Config],
|
||||
[Contents].[DTS] [Content_DTS],
|
||||
[Contents].[UserID] [Content_UserID]
|
||||
FROM [Transitions]
|
||||
JOIN [Contents] ON
|
||||
[Contents].[ContentID]=[Transitions].[FromID]
|
||||
WHERE
|
||||
[Transitions].[RangeID]=@ItemID
|
||||
|
||||
|
||||
SELECT
|
||||
[Transitions].[TransitionID],
|
||||
[Transitions].[FromID],
|
||||
[Transitions].[ToID],
|
||||
[Transitions].[RangeID],
|
||||
[Transitions].[IsRange],
|
||||
[Transitions].[TranType],
|
||||
[Transitions].[Config],
|
||||
[Transitions].[DTS],
|
||||
[Transitions].[UserID],
|
||||
[Transitions].[LastChanged],
|
||||
[Contents].[Number] [Content_Number],
|
||||
[Contents].[Text] [Content_Text],
|
||||
[Contents].[Type] [Content_Type],
|
||||
[Contents].[FormatID] [Content_FormatID],
|
||||
[Contents].[Config] [Content_Config],
|
||||
[Contents].[DTS] [Content_DTS],
|
||||
[Contents].[UserID] [Content_UserID]
|
||||
FROM [Transitions]
|
||||
JOIN [Contents] ON
|
||||
[Contents].[ContentID]=[Transitions].[FromID]
|
||||
WHERE
|
||||
[Transitions].[ToID]=@ItemID
|
||||
|
||||
RETURN
|
||||
GO
|
||||
-- Display the status of Proc creation
|
||||
IF (@@Error = 0) PRINT 'Procedure Creation: getItem Succeeded'
|
||||
ELSE PRINT 'Procedure Creation: getItem Error on Creation'
|
||||
GO
|
||||
|
||||
/****** Object: StoredProcedure [getItemAndChildren] ******/
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[getItemAndChildren]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||
DROP PROCEDURE [getItemAndChildren];
|
||||
@ -10978,12 +11060,15 @@ BEGIN TRY -- Try Block
|
||||
dbcc checkident([RODbs],reseed,0)
|
||||
delete from [Transitions]
|
||||
dbcc checkident([Transitions],reseed,0)
|
||||
delete from [Applicabilities]
|
||||
delete from [Items]
|
||||
dbcc checkident([Items],reseed,0)
|
||||
delete from [Contents]
|
||||
dbcc checkident([Contents],reseed,0)
|
||||
delete from [Formats]
|
||||
dbcc checkident([Formats],reseed,0)
|
||||
delete from [Scopes]
|
||||
dbcc checkident([Scopes],reseed,0)
|
||||
IF( @@TRANCOUNT > 0 ) COMMIT
|
||||
END TRY
|
||||
BEGIN CATCH -- Catch Block
|
||||
@ -12081,56 +12166,6 @@ IF (@@Error = 0) PRINT 'Procedure Creation: updateMembership Succeeded'
|
||||
ELSE PRINT 'Procedure Creation: updateMembership Error on Creation'
|
||||
GO
|
||||
|
||||
/****** Object: StoredProcedure [updatePart] ******/
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[updatePart]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||
DROP PROCEDURE [updatePart];
|
||||
GO
|
||||
|
||||
CREATE PROCEDURE [dbo].[updatePart]
|
||||
|
||||
(
|
||||
@ContentID int,
|
||||
@FromType int,
|
||||
@ItemID int,
|
||||
@DTS datetime,
|
||||
@UserID nvarchar(100),
|
||||
@LastChanged timestamp,
|
||||
@newLastChanged timestamp output
|
||||
)
|
||||
WITH EXECUTE AS OWNER
|
||||
AS
|
||||
BEGIN TRY -- Try Block
|
||||
BEGIN TRANSACTION
|
||||
UPDATE [Parts]
|
||||
SET
|
||||
[ItemID]=@ItemID,
|
||||
[DTS]=@DTS,
|
||||
[UserID]=@UserID
|
||||
WHERE [ContentID]=@ContentID AND [FromType]=@FromType AND [LastChanged]=@LastChanged
|
||||
IF @@ROWCOUNT = 0
|
||||
BEGIN
|
||||
IF NOT exists(select * from [Parts] WHERE [ContentID]=@ContentID AND [FromType]=@FromType)
|
||||
RAISERROR('Part record has been deleted by another user', 16, 1)
|
||||
ELSE
|
||||
RAISERROR('Part has been edited by another user', 16, 1)
|
||||
END
|
||||
|
||||
SELECT @newLastChanged=[LastChanged]
|
||||
FROM [Parts] WHERE [ContentID]=@ContentID AND [FromType]=@FromType
|
||||
|
||||
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: updatePart Succeeded'
|
||||
ELSE PRINT 'Procedure Creation: updatePart Error on Creation'
|
||||
GO
|
||||
|
||||
/****** Object: StoredProcedure [updatePdf] ******/
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[updatePdf]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||
DROP PROCEDURE [updatePdf];
|
||||
@ -16932,33 +16967,3 @@ IF (@@Error = 0) PRINT 'Procedure Creation: vesp_SearchROItemAndChildren Succeed
|
||||
ELSE PRINT 'Procedure Creation: vesp_SearchROItemAndChildren Error on Creation'
|
||||
GO
|
||||
|
||||
/****** Object: StoredProcedure [vlnErrorHandler] ******/
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[vlnErrorHandler]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||
DROP PROCEDURE [vlnErrorHandler];
|
||||
GO
|
||||
|
||||
CREATE PROCEDURE [dbo].[vlnErrorHandler]
|
||||
(@ExpectedCount int=-1
|
||||
,@MessageFormat nvarchar(512)=N'Expected RowCount (%d) not met (%d)')
|
||||
WITH EXECUTE AS OWNER
|
||||
AS
|
||||
BEGIN
|
||||
DECLARE @ErrorMessage NVARCHAR(4000), @ErrorNumber INT, @ErrorSeverity INT, @ErrorState INT, @ErrorProcedure NVARCHAR(126)
|
||||
, @ErrorLine INT, @RowCount INT;
|
||||
SELECT @ErrorMessage = ERROR_MESSAGE(), @ErrorSeverity = ERROR_SEVERITY(), @ErrorState = ERROR_STATE(),@ErrorNumber = ERROR_NUMBER()
|
||||
, @ErrorLine = ERROR_LINE(), @ErrorProcedure = ERROR_PROCEDURE(), @RowCount = @@RowCount;
|
||||
IF @ErrorNumber > 0
|
||||
BEGIN
|
||||
IF @ErrorProcedure = OBJECT_NAME(@@PROCID) -- If the Procedure is the current procedure just pass the error message
|
||||
RAISERROR (@ErrorMessage, @ErrorSeverity, @ErrorState)
|
||||
ELSE -- Add in the procedure name and line as well as the error number
|
||||
RAISERROR (N'%s[%d] - (%d) %s', @ErrorSeverity, @ErrorState, @ErrorProcedure, @ErrorLine, @ErrorNumber, @ErrorMessage)
|
||||
END
|
||||
ELSE IF @ExpectedCount <> -1 AND @ExpectedCount <> @RowCount
|
||||
RAISERROR (@MessageFormat, 16, 1, @ExpectedCount, @RowCount)
|
||||
END
|
||||
GO
|
||||
-- Display the status of Proc creation
|
||||
IF (@@Error = 0) PRINT 'Procedure Creation: vlnErrorHandler Succeeded'
|
||||
ELSE PRINT 'Procedure Creation: vlnErrorHandler Error on Creation'
|
||||
GO
|
||||
|
23
PROMS/DataLoader/frmLoader.Designer.cs
generated
23
PROMS/DataLoader/frmLoader.Designer.cs
generated
@ -58,6 +58,7 @@ namespace DataLoader
|
||||
this.fixTransitionsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.convertToChangeManagerToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.convertToApprovalToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.load16BitApprovalToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.settingsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.oldToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.convertSecurityToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
@ -69,6 +70,7 @@ namespace DataLoader
|
||||
this.countTokensToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripMenuItem3 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.convertDbfSelectedInTreeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.scopesApplicabilitiesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.sc.Panel1.SuspendLayout();
|
||||
this.sc.Panel2.SuspendLayout();
|
||||
this.sc.SuspendLayout();
|
||||
@ -95,7 +97,6 @@ namespace DataLoader
|
||||
this.sc.Panel1.Controls.Add(this.lblStep);
|
||||
this.sc.Panel1.Controls.Add(this.lblSection);
|
||||
this.sc.Panel1.Controls.Add(this.lblProc);
|
||||
this.sc.Panel1.DoubleClick += new System.EventHandler(this.sc_Panel1_DoubleClick);
|
||||
//
|
||||
// sc.Panel2
|
||||
//
|
||||
@ -267,7 +268,9 @@ namespace DataLoader
|
||||
this.convertDBToolStripMenuItem,
|
||||
this.fixTransitionsToolStripMenuItem,
|
||||
this.convertToChangeManagerToolStripMenuItem,
|
||||
this.convertToApprovalToolStripMenuItem});
|
||||
this.convertToApprovalToolStripMenuItem,
|
||||
this.load16BitApprovalToolStripMenuItem,
|
||||
this.scopesApplicabilitiesToolStripMenuItem});
|
||||
this.processToolStripMenuItem.Name = "processToolStripMenuItem";
|
||||
this.processToolStripMenuItem.Size = new System.Drawing.Size(59, 20);
|
||||
this.processToolStripMenuItem.Text = "&Process";
|
||||
@ -324,6 +327,13 @@ namespace DataLoader
|
||||
this.convertToApprovalToolStripMenuItem.Text = "Convert to Approval";
|
||||
this.convertToApprovalToolStripMenuItem.Click += new System.EventHandler(this.convertToApprovalToolStripMenuItem_Click);
|
||||
//
|
||||
// load16BitApprovalToolStripMenuItem
|
||||
//
|
||||
this.load16BitApprovalToolStripMenuItem.Name = "load16BitApprovalToolStripMenuItem";
|
||||
this.load16BitApprovalToolStripMenuItem.Size = new System.Drawing.Size(224, 22);
|
||||
this.load16BitApprovalToolStripMenuItem.Text = "Load 16-Bit Approval";
|
||||
this.load16BitApprovalToolStripMenuItem.Click += new System.EventHandler(this.load16BitApprovalToolStripMenuItem_Click);
|
||||
//
|
||||
// settingsToolStripMenuItem
|
||||
//
|
||||
this.settingsToolStripMenuItem.Name = "settingsToolStripMenuItem";
|
||||
@ -406,6 +416,13 @@ namespace DataLoader
|
||||
this.convertDbfSelectedInTreeToolStripMenuItem.Text = "Convert Dbf Selected In Tree";
|
||||
this.convertDbfSelectedInTreeToolStripMenuItem.Click += new System.EventHandler(this.convertDbfSelectedInTreeToolStripMenuItem_Click);
|
||||
//
|
||||
// scopesApplicabilitiesToolStripMenuItem
|
||||
//
|
||||
this.scopesApplicabilitiesToolStripMenuItem.Name = "scopesApplicabilitiesToolStripMenuItem";
|
||||
this.scopesApplicabilitiesToolStripMenuItem.Size = new System.Drawing.Size(224, 22);
|
||||
this.scopesApplicabilitiesToolStripMenuItem.Text = "Scopes && Applicabilities";
|
||||
this.scopesApplicabilitiesToolStripMenuItem.Click += new System.EventHandler(this.scopesApplicabilitiesToolStripMenuItem_Click);
|
||||
//
|
||||
// frmLoader
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
@ -472,5 +489,7 @@ namespace DataLoader
|
||||
private System.Windows.Forms.ToolStripMenuItem convertDbfSelectedInTreeToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem3;
|
||||
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem4;
|
||||
private System.Windows.Forms.ToolStripMenuItem load16BitApprovalToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem scopesApplicabilitiesToolStripMenuItem;
|
||||
}
|
||||
}
|
@ -320,14 +320,13 @@ namespace DataLoader
|
||||
}
|
||||
if (success)
|
||||
{
|
||||
bool allSets = !_DeveloperMode || !MySettings.OnlyThisSet;
|
||||
TimeSpan ts = new TimeSpan();
|
||||
DocVersionInfoList vl = DocVersionInfoList.Get();
|
||||
DocVersion v = null;
|
||||
MyInfo = "Computer Name: " + SystemInformation.ComputerName.ToUpper();
|
||||
foreach (DocVersionInfo vi in vl)
|
||||
{
|
||||
if (allSets || (MySettings.OnlyThisSet && vi.Title.ToUpper() == MySettings.ProcedureSetPath.ToUpper())) // is this the procedure set we want to convert?
|
||||
if (!MySettings.OnlyThisSet || (vi.Title.ToUpper() == MySettings.ProcedureSetPath.ToUpper())) // is this the procedure set we want to convert?
|
||||
{
|
||||
v = DocVersion.Get(vi.VersionID);
|
||||
Status = "Load " + v.Title + " - " + v.Name;
|
||||
@ -356,7 +355,7 @@ namespace DataLoader
|
||||
}
|
||||
}
|
||||
|
||||
private void RunScript(string scriptName, string dbName)
|
||||
public void RunScript(string scriptName, string dbName)
|
||||
{
|
||||
Status = String.Format("Running Script '{0}'", scriptName);
|
||||
string script = GetScript(scriptName);
|
||||
@ -520,6 +519,8 @@ namespace DataLoader
|
||||
MySettings.Phase3Suffix = Properties.Settings.Default.Phase3;
|
||||
MySettings.FormatFolder = Properties.Settings.Default.FormatFolder;
|
||||
MySettings.GenMacFolder = Properties.Settings.Default.GenMacFolder;
|
||||
MySettings.LoadApproved = Properties.Settings.Default.LoadApproved;
|
||||
MySettings.Phase4Suffix = Properties.Settings.Default.Phase4;
|
||||
|
||||
string validity = MySettings.ValidityCheck;
|
||||
if (validity != "")
|
||||
@ -573,6 +574,8 @@ namespace DataLoader
|
||||
Properties.Settings.Default.Phase3 = MySettings.Phase3Suffix;
|
||||
Properties.Settings.Default.FormatFolder = MySettings.FormatFolder;
|
||||
Properties.Settings.Default.GenMacFolder = MySettings.GenMacFolder;
|
||||
Properties.Settings.Default.LoadApproved = MySettings.LoadApproved;
|
||||
Properties.Settings.Default.Phase4 = MySettings.Phase4Suffix;
|
||||
Properties.Settings.Default.Save();
|
||||
}
|
||||
private void frmLoader_Load(object sender, EventArgs e)
|
||||
@ -604,20 +607,6 @@ namespace DataLoader
|
||||
{
|
||||
Status = args.MyStatus;
|
||||
}
|
||||
private bool _DeveloperMode = false;
|
||||
private void ToggleDeveloperMode()
|
||||
{
|
||||
DialogResult dr = MessageBox.Show((_DeveloperMode)?"Make the User Interface Less Confusing?":"Make the User Interface More Confusing?", "DataLoader UI", MessageBoxButtons.YesNo,MessageBoxIcon.Question);
|
||||
if (dr == DialogResult.Yes)
|
||||
{
|
||||
_DeveloperMode = !_DeveloperMode;
|
||||
}
|
||||
}
|
||||
|
||||
private void sc_Panel1_DoubleClick(object sender, EventArgs e)
|
||||
{
|
||||
ToggleDeveloperMode();
|
||||
}
|
||||
private bool _DidLogPathCheck = false;
|
||||
//private string _LogFilePath = "";
|
||||
|
||||
@ -725,7 +714,16 @@ namespace DataLoader
|
||||
//Phase 4 - Convert to Approval Version
|
||||
ConvertToApproval();
|
||||
mb.Append("Conversion to Approval Complete");
|
||||
Status = "Backing up Phase 4 Data";
|
||||
if (MySettings.LoadApproved)
|
||||
{
|
||||
Status = "Backing up Phase 4 Data";
|
||||
Backup("_" + MySettings.Phase4Suffix);
|
||||
mb.Append("Phase 4 Backup Complete");
|
||||
//Phase 5 - Load Approved Data
|
||||
LoadApprovedData();
|
||||
mb.Append("Conversion of Approved Data Complete");
|
||||
}
|
||||
Status = "Backing up Data";
|
||||
Backup("");
|
||||
mb.Append("Backup Complete");
|
||||
Status = "Processing Complete";
|
||||
@ -766,6 +764,25 @@ namespace DataLoader
|
||||
ProcessTime = DateTime.Now;
|
||||
ConvertToApproval();
|
||||
}
|
||||
private void load16BitApprovalToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
LoadApprovedData();
|
||||
}
|
||||
|
||||
private void LoadApprovedData()
|
||||
{
|
||||
Status = "Converting 16-Bit Approved Data";
|
||||
Database.VEPROMS_Connection = MySettings.ConnectionString.Replace("{DBName}", MySettings.DBName);
|
||||
bool ok = ldr.BuildApprovedRevision();
|
||||
Status = "Conversion " + (ok ? "Succeeded" : "Failed");
|
||||
}
|
||||
private void scopesApplicabilitiesToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
Status = "Building Scopes and Applicabilities";
|
||||
Database.VEPROMS_Connection = MySettings.ConnectionString.Replace("{DBName}", MySettings.DBName);
|
||||
bool ok = ldr.BuildScopeApplicability();
|
||||
Status = Status + " " + (ok ? "Succeeded" : "Failed");
|
||||
}
|
||||
#endregion
|
||||
#region Settings Menu Items
|
||||
private void settingsToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
@ -803,6 +820,7 @@ namespace DataLoader
|
||||
btnConvertSelected_Click(this, new EventArgs());
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
public class MessageBuilder
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user