Added DebugStatus to MSWordToPDF Class
Moved DocPDF from Documents to new PDFs table
This commit is contained in:
parent
f959f883d3
commit
dd9bc9e0dc
@ -194,9 +194,15 @@ namespace DataLoader
|
|||||||
// if in debug mode, pdf output is red (checkbox1 is what controls this).
|
// if in debug mode, pdf output is red (checkbox1 is what controls this).
|
||||||
checkBox1.Checked = VlnSettings.DebugMode;
|
checkBox1.Checked = VlnSettings.DebugMode;
|
||||||
if (checkBox1.Checked)
|
if (checkBox1.Checked)
|
||||||
|
{
|
||||||
|
MSWordToPDF.DebugStatus = 1;
|
||||||
Loader.OverrideColor = Color.Red;
|
Loader.OverrideColor = Color.Red;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
MSWordToPDF.DebugStatus = 0;
|
||||||
Loader.OverrideColor = Color.Empty;
|
Loader.OverrideColor = Color.Empty;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
private void btnConvertSelected_Click(object sender, EventArgs e)
|
private void btnConvertSelected_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
@ -667,9 +673,15 @@ namespace DataLoader
|
|||||||
{
|
{
|
||||||
VlnSettings.DebugMode = checkBox1.Checked;
|
VlnSettings.DebugMode = checkBox1.Checked;
|
||||||
if (checkBox1.Checked)
|
if (checkBox1.Checked)
|
||||||
|
{
|
||||||
|
MSWordToPDF.DebugStatus = 1;
|
||||||
Loader.OverrideColor = Color.Red;
|
Loader.OverrideColor = Color.Red;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
MSWordToPDF.DebugStatus = 0;
|
||||||
Loader.OverrideColor = Color.Empty;
|
Loader.OverrideColor = Color.Empty;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -402,7 +402,6 @@ CREATE PROCEDURE [dbo].[addDocument]
|
|||||||
@DTS datetime,
|
@DTS datetime,
|
||||||
@UserID nvarchar(100),
|
@UserID nvarchar(100),
|
||||||
@FileExtension nvarchar(10),
|
@FileExtension nvarchar(10),
|
||||||
@DocPdf varbinary(MAX)=null,
|
|
||||||
@newDocID int output,
|
@newDocID int output,
|
||||||
@newLastChanged timestamp output
|
@newLastChanged timestamp output
|
||||||
)
|
)
|
||||||
@ -418,8 +417,7 @@ BEGIN TRY -- Try Block
|
|||||||
[Config],
|
[Config],
|
||||||
[DTS],
|
[DTS],
|
||||||
[UserID],
|
[UserID],
|
||||||
[FileExtension],
|
[FileExtension]
|
||||||
[DocPdf]
|
|
||||||
)
|
)
|
||||||
VALUES
|
VALUES
|
||||||
(
|
(
|
||||||
@ -429,8 +427,7 @@ BEGIN TRY -- Try Block
|
|||||||
@Config,
|
@Config,
|
||||||
@DTS,
|
@DTS,
|
||||||
@UserID,
|
@UserID,
|
||||||
@FileExtension,
|
@FileExtension
|
||||||
@DocPdf
|
|
||||||
)
|
)
|
||||||
SELECT @newDocID= SCOPE_IDENTITY()
|
SELECT @newDocID= SCOPE_IDENTITY()
|
||||||
SELECT @newLastChanged=[LastChanged]
|
SELECT @newLastChanged=[LastChanged]
|
||||||
@ -1375,6 +1372,72 @@ IF (@@Error = 0) PRINT 'Procedure Creation: addPart Succeeded'
|
|||||||
ELSE PRINT 'Procedure Creation: addPart Error on Creation'
|
ELSE PRINT 'Procedure Creation: addPart Error on Creation'
|
||||||
GO
|
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];
|
||||||
|
GO
|
||||||
|
|
||||||
|
CREATE PROCEDURE [dbo].[addPdf]
|
||||||
|
|
||||||
|
(
|
||||||
|
@DocID int,
|
||||||
|
@DebugStatus int,
|
||||||
|
@TopRow int,
|
||||||
|
@PageLength int,
|
||||||
|
@LeftMargin int,
|
||||||
|
@PageWidth int,
|
||||||
|
@PageCount float,
|
||||||
|
@DocPdf varbinary(MAX)=null,
|
||||||
|
@DTS datetime,
|
||||||
|
@UserID nvarchar(100),
|
||||||
|
@newLastChanged timestamp output
|
||||||
|
)
|
||||||
|
WITH EXECUTE AS OWNER
|
||||||
|
AS
|
||||||
|
BEGIN TRY -- Try Block
|
||||||
|
BEGIN TRANSACTION
|
||||||
|
INSERT INTO [Pdfs]
|
||||||
|
(
|
||||||
|
[DocID],
|
||||||
|
[DebugStatus],
|
||||||
|
[TopRow],
|
||||||
|
[PageLength],
|
||||||
|
[LeftMargin],
|
||||||
|
[PageWidth],
|
||||||
|
[PageCount],
|
||||||
|
[DocPdf],
|
||||||
|
[DTS],
|
||||||
|
[UserID]
|
||||||
|
)
|
||||||
|
VALUES
|
||||||
|
(
|
||||||
|
@DocID,
|
||||||
|
@DebugStatus,
|
||||||
|
@TopRow,
|
||||||
|
@PageLength,
|
||||||
|
@LeftMargin,
|
||||||
|
@PageWidth,
|
||||||
|
@PageCount,
|
||||||
|
@DocPdf,
|
||||||
|
@DTS,
|
||||||
|
@UserID
|
||||||
|
)
|
||||||
|
|
||||||
|
SELECT @newLastChanged=[LastChanged]
|
||||||
|
FROM [Pdfs] WHERE [DocID]=@DocID AND [DebugStatus]=@DebugStatus AND [TopRow]=@TopRow AND [PageLength]=@PageLength AND [LeftMargin]=@LeftMargin AND [PageWidth]=@PageWidth
|
||||||
|
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: addPdf Succeeded'
|
||||||
|
ELSE PRINT 'Procedure Creation: addPdf Error on Creation'
|
||||||
|
GO
|
||||||
|
|
||||||
/****** Object: StoredProcedure [addPermission] ******/
|
/****** Object: StoredProcedure [addPermission] ******/
|
||||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[addPermission]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[addPermission]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||||
DROP PROCEDURE [addPermission];
|
DROP PROCEDURE [addPermission];
|
||||||
@ -2048,9 +2111,9 @@ INSERT INTO [Entries] ([ContentID],[DocID],[DTS],[UserID])
|
|||||||
FROM [Entries] EE JOIN @Children NN on NN.ContentID = EE.ContentID
|
FROM [Entries] EE JOIN @Children NN on NN.ContentID = EE.ContentID
|
||||||
JOIN [Documents] DD on EE.[DocID] = DD.[DocID] and Isnull(LibTitle,'') <> ''
|
JOIN [Documents] DD on EE.[DocID] = DD.[DocID] and Isnull(LibTitle,'') <> ''
|
||||||
-- Logic to create new documents for any documents used that do not have libtitles
|
-- Logic to create new documents for any documents used that do not have libtitles
|
||||||
INSERT INTO [Documents] ([LibTitle],[DocContent],[DocAscii],[Config],[DTS],[UserID],[FileExtension],[DocPdf])
|
INSERT INTO [Documents] ([LibTitle],[DocContent],[DocAscii],[Config],[DTS],[UserID],[FileExtension])
|
||||||
OUTPUT CAST(INSERTED.[LibTitle] as INT),INSERTED.[DocID] INTO @NewDocuments
|
OUTPUT CAST(INSERTED.[LibTitle] as INT),INSERTED.[DocID] INTO @NewDocuments
|
||||||
SELECT str(DD.[DocID]),[DocContent],[DocAscii],[Config],@DTS,@UserID,[FileExtension],[DocPdf]
|
SELECT str(DD.[DocID]),[DocContent],[DocAscii],[Config],@DTS,@UserID,[FileExtension]
|
||||||
FROM [Entries] EE JOIN @Children NN on NN.ContentID = EE.ContentID
|
FROM [Entries] EE JOIN @Children NN on NN.ContentID = EE.ContentID
|
||||||
JOIN [Documents] DD on EE.[DocID] = DD.[DocID] and Isnull(LibTitle,'') = ''
|
JOIN [Documents] DD on EE.[DocID] = DD.[DocID] and Isnull(LibTitle,'') = ''
|
||||||
UPDATE DD SET LibTitle = ''
|
UPDATE DD SET LibTitle = ''
|
||||||
@ -2196,6 +2259,35 @@ IF (@@Error = 0) PRINT 'Procedure Creation: CopyItemAndChildren Succeeded'
|
|||||||
ELSE PRINT 'Procedure Creation: CopyItemAndChildren Error on Creation'
|
ELSE PRINT 'Procedure Creation: CopyItemAndChildren Error on Creation'
|
||||||
GO
|
GO
|
||||||
|
|
||||||
|
/****** Object: StoredProcedure [deleteAllPdfs] ******/
|
||||||
|
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[deleteAllPdfs]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||||
|
DROP PROCEDURE [deleteAllPdfs];
|
||||||
|
GO
|
||||||
|
|
||||||
|
CREATE PROCEDURE [dbo].[deleteAllPdfs]
|
||||||
|
|
||||||
|
(
|
||||||
|
@DocID int
|
||||||
|
)
|
||||||
|
WITH EXECUTE AS OWNER
|
||||||
|
AS
|
||||||
|
BEGIN TRY -- Try Block
|
||||||
|
BEGIN TRANSACTION
|
||||||
|
DELETE [Pdfs]
|
||||||
|
WHERE [DocID] = @DocID
|
||||||
|
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: deleteAllPdfs Succeeded'
|
||||||
|
ELSE PRINT 'Procedure Creation: deleteAllPdfs Error on Creation'
|
||||||
|
GO
|
||||||
|
|
||||||
/****** Object: StoredProcedure [deleteAnnotation] ******/
|
/****** Object: StoredProcedure [deleteAnnotation] ******/
|
||||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[deleteAnnotation]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[deleteAnnotation]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||||
DROP PROCEDURE [deleteAnnotation];
|
DROP PROCEDURE [deleteAnnotation];
|
||||||
@ -2439,6 +2531,8 @@ BEGIN TRY -- Try Block
|
|||||||
WHERE [DocID]=@DocID
|
WHERE [DocID]=@DocID
|
||||||
DELETE [Entries]
|
DELETE [Entries]
|
||||||
WHERE [DocID]=@DocID
|
WHERE [DocID]=@DocID
|
||||||
|
DELETE [Pdfs]
|
||||||
|
WHERE [DocID]=@DocID
|
||||||
DELETE [Documents]
|
DELETE [Documents]
|
||||||
WHERE [DocID] = @DocID
|
WHERE [DocID] = @DocID
|
||||||
IF( @@TRANCOUNT > 0 ) COMMIT
|
IF( @@TRANCOUNT > 0 ) COMMIT
|
||||||
@ -3122,6 +3216,40 @@ IF (@@Error = 0) PRINT 'Procedure Creation: deletePart Succeeded'
|
|||||||
ELSE PRINT 'Procedure Creation: deletePart Error on Creation'
|
ELSE PRINT 'Procedure Creation: deletePart Error on Creation'
|
||||||
GO
|
GO
|
||||||
|
|
||||||
|
/****** Object: StoredProcedure [deletePdf] ******/
|
||||||
|
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[deletePdf]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||||
|
DROP PROCEDURE [deletePdf];
|
||||||
|
GO
|
||||||
|
|
||||||
|
CREATE PROCEDURE [dbo].[deletePdf]
|
||||||
|
|
||||||
|
(
|
||||||
|
@DocID int,
|
||||||
|
@DebugStatus int,
|
||||||
|
@TopRow int,
|
||||||
|
@PageLength int,
|
||||||
|
@LeftMargin int,
|
||||||
|
@PageWidth int
|
||||||
|
)
|
||||||
|
WITH EXECUTE AS OWNER
|
||||||
|
AS
|
||||||
|
BEGIN TRY -- Try Block
|
||||||
|
BEGIN TRANSACTION
|
||||||
|
DELETE [Pdfs]
|
||||||
|
WHERE [DocID] = @DocID AND [DebugStatus] = @DebugStatus AND [TopRow] = @TopRow AND [PageLength] = @PageLength AND [LeftMargin] = @LeftMargin AND [PageWidth] = @PageWidth
|
||||||
|
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: deletePdf Succeeded'
|
||||||
|
ELSE PRINT 'Procedure Creation: deletePdf Error on Creation'
|
||||||
|
GO
|
||||||
|
|
||||||
/****** Object: StoredProcedure [deletePermission] ******/
|
/****** Object: StoredProcedure [deletePermission] ******/
|
||||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[deletePermission]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[deletePermission]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||||
DROP PROCEDURE [deletePermission];
|
DROP PROCEDURE [deletePermission];
|
||||||
@ -3855,6 +3983,32 @@ IF (@@Error = 0) PRINT 'Procedure Creation: existsPart Succeeded'
|
|||||||
ELSE PRINT 'Procedure Creation: existsPart Error on Creation'
|
ELSE PRINT 'Procedure Creation: existsPart Error on Creation'
|
||||||
GO
|
GO
|
||||||
|
|
||||||
|
/****** Object: StoredProcedure [existsPdf] ******/
|
||||||
|
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[existsPdf]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||||
|
DROP PROCEDURE [existsPdf];
|
||||||
|
GO
|
||||||
|
|
||||||
|
CREATE PROCEDURE [dbo].[existsPdf]
|
||||||
|
|
||||||
|
(
|
||||||
|
@DocID int,
|
||||||
|
@DebugStatus int,
|
||||||
|
@TopRow int,
|
||||||
|
@PageLength int,
|
||||||
|
@LeftMargin int,
|
||||||
|
@PageWidth int
|
||||||
|
)
|
||||||
|
WITH EXECUTE AS OWNER
|
||||||
|
AS
|
||||||
|
SELECT COUNT(*)
|
||||||
|
FROM [Pdfs] WHERE [DocID]=@DocID AND [DebugStatus]=@DebugStatus AND [TopRow]=@TopRow AND [PageLength]=@PageLength AND [LeftMargin]=@LeftMargin AND [PageWidth]=@PageWidth
|
||||||
|
RETURN
|
||||||
|
GO
|
||||||
|
-- Display the status of Proc creation
|
||||||
|
IF (@@Error = 0) PRINT 'Procedure Creation: existsPdf Succeeded'
|
||||||
|
ELSE PRINT 'Procedure Creation: existsPdf Error on Creation'
|
||||||
|
GO
|
||||||
|
|
||||||
/****** Object: StoredProcedure [existsPermission] ******/
|
/****** Object: StoredProcedure [existsPermission] ******/
|
||||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[existsPermission]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[existsPermission]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||||
DROP PROCEDURE [existsPermission];
|
DROP PROCEDURE [existsPermission];
|
||||||
@ -4109,8 +4263,7 @@ AS
|
|||||||
[Documents].[Config] [Document_Config],
|
[Documents].[Config] [Document_Config],
|
||||||
[Documents].[DTS] [Document_DTS],
|
[Documents].[DTS] [Document_DTS],
|
||||||
[Documents].[UserID] [Document_UserID],
|
[Documents].[UserID] [Document_UserID],
|
||||||
[Documents].[FileExtension] [Document_FileExtension],
|
[Documents].[FileExtension] [Document_FileExtension]
|
||||||
[Documents].[DocPdf] [Document_DocPdf]
|
|
||||||
FROM [DRoUsages]
|
FROM [DRoUsages]
|
||||||
JOIN [Documents] ON
|
JOIN [Documents] ON
|
||||||
[Documents].[DocID]=[DROUsages].[DocID]
|
[Documents].[DocID]=[DROUsages].[DocID]
|
||||||
@ -5070,8 +5223,7 @@ AS
|
|||||||
[Documents].[Config] [Document_Config],
|
[Documents].[Config] [Document_Config],
|
||||||
[Documents].[DTS] [Document_DTS],
|
[Documents].[DTS] [Document_DTS],
|
||||||
[Documents].[UserID] [Document_UserID],
|
[Documents].[UserID] [Document_UserID],
|
||||||
[Documents].[FileExtension] [Document_FileExtension],
|
[Documents].[FileExtension] [Document_FileExtension]
|
||||||
[Documents].[DocPdf] [Document_DocPdf]
|
|
||||||
FROM [Entries]
|
FROM [Entries]
|
||||||
JOIN [Documents] ON
|
JOIN [Documents] ON
|
||||||
[Documents].[DocID]=[Entries].[DocID]
|
[Documents].[DocID]=[Entries].[DocID]
|
||||||
@ -5390,9 +5542,9 @@ AS
|
|||||||
[UserID],
|
[UserID],
|
||||||
[LastChanged],
|
[LastChanged],
|
||||||
[FileExtension],
|
[FileExtension],
|
||||||
[DocPdf],
|
|
||||||
(SELECT COUNT(*) FROM [DROUsages] WHERE [DROUsages].[DocID]=[Documents].[DocID]) [DROUsageCount],
|
(SELECT COUNT(*) FROM [DROUsages] WHERE [DROUsages].[DocID]=[Documents].[DocID]) [DROUsageCount],
|
||||||
(SELECT COUNT(*) FROM [Entries] WHERE [Entries].[DocID]=[Documents].[DocID]) [EntryCount]
|
(SELECT COUNT(*) FROM [Entries] WHERE [Entries].[DocID]=[Documents].[DocID]) [EntryCount],
|
||||||
|
(SELECT COUNT(*) FROM [Pdfs] WHERE [Pdfs].[DocID]=[Documents].[DocID]) [PdfCount]
|
||||||
FROM [Documents]
|
FROM [Documents]
|
||||||
WHERE [DocID]=@DocID
|
WHERE [DocID]=@DocID
|
||||||
|
|
||||||
@ -5437,6 +5589,23 @@ AS
|
|||||||
WHERE
|
WHERE
|
||||||
[Entries].[DocID]=@DocID
|
[Entries].[DocID]=@DocID
|
||||||
|
|
||||||
|
|
||||||
|
SELECT
|
||||||
|
[Pdfs].[DocID],
|
||||||
|
[Pdfs].[DebugStatus],
|
||||||
|
[Pdfs].[TopRow],
|
||||||
|
[Pdfs].[PageLength],
|
||||||
|
[Pdfs].[LeftMargin],
|
||||||
|
[Pdfs].[PageWidth],
|
||||||
|
[Pdfs].[PageCount],
|
||||||
|
[Pdfs].[DocPdf],
|
||||||
|
[Pdfs].[DTS],
|
||||||
|
[Pdfs].[UserID],
|
||||||
|
[Pdfs].[LastChanged]
|
||||||
|
FROM [Pdfs]
|
||||||
|
WHERE
|
||||||
|
[Pdfs].[DocID]=@DocID
|
||||||
|
|
||||||
RETURN
|
RETURN
|
||||||
GO
|
GO
|
||||||
-- Display the status of Proc creation
|
-- Display the status of Proc creation
|
||||||
@ -5463,9 +5632,9 @@ AS
|
|||||||
[UserID],
|
[UserID],
|
||||||
[LastChanged],
|
[LastChanged],
|
||||||
[FileExtension],
|
[FileExtension],
|
||||||
[DocPdf],
|
|
||||||
(SELECT COUNT(*) FROM [DROUsages] WHERE [DROUsages].[DocID]=[Documents].[DocID]) [DROUsageCount],
|
(SELECT COUNT(*) FROM [DROUsages] WHERE [DROUsages].[DocID]=[Documents].[DocID]) [DROUsageCount],
|
||||||
(SELECT COUNT(*) FROM [Entries] WHERE [Entries].[DocID]=[Documents].[DocID]) [EntryCount]
|
(SELECT COUNT(*) FROM [Entries] WHERE [Entries].[DocID]=[Documents].[DocID]) [EntryCount],
|
||||||
|
(SELECT COUNT(*) FROM [Pdfs] WHERE [Pdfs].[DocID]=[Documents].[DocID]) [PdfCount]
|
||||||
FROM [Documents]
|
FROM [Documents]
|
||||||
RETURN
|
RETURN
|
||||||
GO
|
GO
|
||||||
@ -5818,8 +5987,7 @@ AS
|
|||||||
[Documents].[Config] [Document_Config],
|
[Documents].[Config] [Document_Config],
|
||||||
[Documents].[DTS] [Document_DTS],
|
[Documents].[DTS] [Document_DTS],
|
||||||
[Documents].[UserID] [Document_UserID],
|
[Documents].[UserID] [Document_UserID],
|
||||||
[Documents].[FileExtension] [Document_FileExtension],
|
[Documents].[FileExtension] [Document_FileExtension]
|
||||||
[Documents].[DocPdf] [Document_DocPdf]
|
|
||||||
FROM [DROUsages]
|
FROM [DROUsages]
|
||||||
JOIN [Documents] ON
|
JOIN [Documents] ON
|
||||||
[Documents].[DocID]=[DROUsages].[DocID]
|
[Documents].[DocID]=[DROUsages].[DocID]
|
||||||
@ -5881,8 +6049,7 @@ AS
|
|||||||
[Documents].[Config] [Document_Config],
|
[Documents].[Config] [Document_Config],
|
||||||
[Documents].[DTS] [Document_DTS],
|
[Documents].[DTS] [Document_DTS],
|
||||||
[Documents].[UserID] [Document_UserID],
|
[Documents].[UserID] [Document_UserID],
|
||||||
[Documents].[FileExtension] [Document_FileExtension],
|
[Documents].[FileExtension] [Document_FileExtension]
|
||||||
[Documents].[DocPdf] [Document_DocPdf]
|
|
||||||
FROM [Entries]
|
FROM [Entries]
|
||||||
JOIN [Documents] ON
|
JOIN [Documents] ON
|
||||||
[Documents].[DocID]=[Entries].[DocID]
|
[Documents].[DocID]=[Entries].[DocID]
|
||||||
@ -7379,7 +7546,6 @@ SELECT
|
|||||||
[DTS],
|
[DTS],
|
||||||
[UserID],
|
[UserID],
|
||||||
[LastChanged],
|
[LastChanged],
|
||||||
[DocPdf],
|
|
||||||
(SELECT COUNT(*) FROM [DROUsages] WHERE [DROUsages].[DocID]=[Documents].[DocID]) [DROUsageCount],
|
(SELECT COUNT(*) FROM [DROUsages] WHERE [DROUsages].[DocID]=[Documents].[DocID]) [DROUsageCount],
|
||||||
(SELECT COUNT(*) FROM [Entries] WHERE [Entries].[DocID]=[Documents].[DocID]) [EntryCount]
|
(SELECT COUNT(*) FROM [Entries] WHERE [Entries].[DocID]=[Documents].[DocID]) [EntryCount]
|
||||||
FROM [Documents] where [LibTitle] <> '' order by [LibTitle]
|
FROM [Documents] where [LibTitle] <> '' order by [LibTitle]
|
||||||
@ -7805,6 +7971,109 @@ IF (@@Error = 0) PRINT 'Procedure Creation: getPastedAffectedTransitions Succeed
|
|||||||
ELSE PRINT 'Procedure Creation: getPastedAffectedTransitions Error on Creation'
|
ELSE PRINT 'Procedure Creation: getPastedAffectedTransitions Error on Creation'
|
||||||
GO
|
GO
|
||||||
|
|
||||||
|
/****** Object: StoredProcedure [getPdf] ******/
|
||||||
|
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[getPdf]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||||
|
DROP PROCEDURE [getPdf];
|
||||||
|
GO
|
||||||
|
|
||||||
|
CREATE PROCEDURE [dbo].[getPdf]
|
||||||
|
|
||||||
|
(
|
||||||
|
@DocID int,
|
||||||
|
@DebugStatus int,
|
||||||
|
@TopRow int,
|
||||||
|
@PageLength int,
|
||||||
|
@LeftMargin int,
|
||||||
|
@PageWidth int
|
||||||
|
)
|
||||||
|
WITH EXECUTE AS OWNER
|
||||||
|
AS
|
||||||
|
SELECT
|
||||||
|
[DocID],
|
||||||
|
[DebugStatus],
|
||||||
|
[TopRow],
|
||||||
|
[PageLength],
|
||||||
|
[LeftMargin],
|
||||||
|
[PageWidth],
|
||||||
|
[PageCount],
|
||||||
|
[DocPdf],
|
||||||
|
[DTS],
|
||||||
|
[UserID],
|
||||||
|
[LastChanged]
|
||||||
|
FROM [Pdfs]
|
||||||
|
WHERE [DocID]=@DocID AND [DebugStatus]=@DebugStatus AND [TopRow]=@TopRow AND [PageLength]=@PageLength AND [LeftMargin]=@LeftMargin AND [PageWidth]=@PageWidth
|
||||||
|
RETURN
|
||||||
|
GO
|
||||||
|
-- Display the status of Proc creation
|
||||||
|
IF (@@Error = 0) PRINT 'Procedure Creation: getPdf Succeeded'
|
||||||
|
ELSE PRINT 'Procedure Creation: getPdf Error on Creation'
|
||||||
|
GO
|
||||||
|
|
||||||
|
/****** Object: StoredProcedure [getPdfs] ******/
|
||||||
|
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[getPdfs]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||||
|
DROP PROCEDURE [getPdfs];
|
||||||
|
GO
|
||||||
|
|
||||||
|
CREATE PROCEDURE [dbo].[getPdfs]
|
||||||
|
|
||||||
|
WITH EXECUTE AS OWNER
|
||||||
|
AS
|
||||||
|
SELECT
|
||||||
|
[DocID],
|
||||||
|
[DebugStatus],
|
||||||
|
[TopRow],
|
||||||
|
[PageLength],
|
||||||
|
[LeftMargin],
|
||||||
|
[PageWidth],
|
||||||
|
[PageCount],
|
||||||
|
[DocPdf],
|
||||||
|
[DTS],
|
||||||
|
[UserID],
|
||||||
|
[LastChanged]
|
||||||
|
FROM [Pdfs]
|
||||||
|
RETURN
|
||||||
|
GO
|
||||||
|
-- Display the status of Proc creation
|
||||||
|
IF (@@Error = 0) PRINT 'Procedure Creation: getPdfs Succeeded'
|
||||||
|
ELSE PRINT 'Procedure Creation: getPdfs Error on Creation'
|
||||||
|
GO
|
||||||
|
|
||||||
|
/****** Object: StoredProcedure [getPdfsByDocID] ******/
|
||||||
|
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[getPdfsByDocID]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||||
|
DROP PROCEDURE [getPdfsByDocID];
|
||||||
|
GO
|
||||||
|
|
||||||
|
CREATE PROCEDURE [dbo].[getPdfsByDocID]
|
||||||
|
|
||||||
|
(
|
||||||
|
@DocID int
|
||||||
|
)
|
||||||
|
WITH EXECUTE AS OWNER
|
||||||
|
AS
|
||||||
|
|
||||||
|
SELECT
|
||||||
|
[Pdfs].[DocID],
|
||||||
|
[Pdfs].[DebugStatus],
|
||||||
|
[Pdfs].[TopRow],
|
||||||
|
[Pdfs].[PageLength],
|
||||||
|
[Pdfs].[LeftMargin],
|
||||||
|
[Pdfs].[PageWidth],
|
||||||
|
[Pdfs].[PageCount],
|
||||||
|
[Pdfs].[DocPdf],
|
||||||
|
[Pdfs].[DTS],
|
||||||
|
[Pdfs].[UserID],
|
||||||
|
[Pdfs].[LastChanged]
|
||||||
|
FROM [Pdfs]
|
||||||
|
WHERE
|
||||||
|
[Pdfs].[DocID]=@DocID
|
||||||
|
|
||||||
|
RETURN
|
||||||
|
GO
|
||||||
|
-- Display the status of Proc creation
|
||||||
|
IF (@@Error = 0) PRINT 'Procedure Creation: getPdfsByDocID Succeeded'
|
||||||
|
ELSE PRINT 'Procedure Creation: getPdfsByDocID Error on Creation'
|
||||||
|
GO
|
||||||
|
|
||||||
/****** Object: StoredProcedure [getPermission] ******/
|
/****** Object: StoredProcedure [getPermission] ******/
|
||||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[getPermission]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[getPermission]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||||
DROP PROCEDURE [getPermission];
|
DROP PROCEDURE [getPermission];
|
||||||
@ -7983,8 +8252,7 @@ AS
|
|||||||
[Documents].[Config] [Document_Config],
|
[Documents].[Config] [Document_Config],
|
||||||
[Documents].[DTS] [Document_DTS],
|
[Documents].[DTS] [Document_DTS],
|
||||||
[Documents].[UserID] [Document_UserID],
|
[Documents].[UserID] [Document_UserID],
|
||||||
[Documents].[FileExtension] [Document_FileExtension],
|
[Documents].[FileExtension] [Document_FileExtension]
|
||||||
[Documents].[DocPdf] [Document_DocPdf]
|
|
||||||
FROM [DROUsages]
|
FROM [DROUsages]
|
||||||
JOIN [Documents] ON
|
JOIN [Documents] ON
|
||||||
[Documents].[DocID]=[DROUsages].[DocID]
|
[Documents].[DocID]=[DROUsages].[DocID]
|
||||||
@ -9695,6 +9963,7 @@ BEGIN TRY -- Try Block
|
|||||||
delete from [Memberships]
|
delete from [Memberships]
|
||||||
dbcc checkident([Memberships],reseed,0)
|
dbcc checkident([Memberships],reseed,0)
|
||||||
delete from [Parts]
|
delete from [Parts]
|
||||||
|
delete from [Pdfs]
|
||||||
delete from [Permissions]
|
delete from [Permissions]
|
||||||
dbcc checkident([Permissions],reseed,0)
|
dbcc checkident([Permissions],reseed,0)
|
||||||
delete from [ROFsts]
|
delete from [ROFsts]
|
||||||
@ -10142,7 +10411,6 @@ CREATE PROCEDURE [dbo].[updateDocument]
|
|||||||
@UserID nvarchar(100),
|
@UserID nvarchar(100),
|
||||||
@LastChanged timestamp,
|
@LastChanged timestamp,
|
||||||
@FileExtension nvarchar(10),
|
@FileExtension nvarchar(10),
|
||||||
@DocPdf varbinary(MAX)=null,
|
|
||||||
@newLastChanged timestamp output
|
@newLastChanged timestamp output
|
||||||
)
|
)
|
||||||
WITH EXECUTE AS OWNER
|
WITH EXECUTE AS OWNER
|
||||||
@ -10157,8 +10425,7 @@ BEGIN TRY -- Try Block
|
|||||||
[Config]=@Config,
|
[Config]=@Config,
|
||||||
[DTS]=@DTS,
|
[DTS]=@DTS,
|
||||||
[UserID]=@UserID,
|
[UserID]=@UserID,
|
||||||
[FileExtension]=@FileExtension,
|
[FileExtension]=@FileExtension
|
||||||
[DocPdf]=@DocPdf
|
|
||||||
WHERE [DocID]=@DocID AND [LastChanged]=@LastChanged
|
WHERE [DocID]=@DocID AND [LastChanged]=@LastChanged
|
||||||
IF @@ROWCOUNT = 0
|
IF @@ROWCOUNT = 0
|
||||||
BEGIN
|
BEGIN
|
||||||
@ -10839,6 +11106,62 @@ IF (@@Error = 0) PRINT 'Procedure Creation: updatePart Succeeded'
|
|||||||
ELSE PRINT 'Procedure Creation: updatePart Error on Creation'
|
ELSE PRINT 'Procedure Creation: updatePart Error on Creation'
|
||||||
GO
|
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];
|
||||||
|
GO
|
||||||
|
|
||||||
|
CREATE PROCEDURE [dbo].[updatePdf]
|
||||||
|
|
||||||
|
(
|
||||||
|
@DocID int,
|
||||||
|
@DebugStatus int,
|
||||||
|
@TopRow int,
|
||||||
|
@PageLength int,
|
||||||
|
@LeftMargin int,
|
||||||
|
@PageWidth int,
|
||||||
|
@PageCount float,
|
||||||
|
@DocPdf varbinary(MAX)=null,
|
||||||
|
@DTS datetime,
|
||||||
|
@UserID nvarchar(100),
|
||||||
|
@LastChanged timestamp,
|
||||||
|
@newLastChanged timestamp output
|
||||||
|
)
|
||||||
|
WITH EXECUTE AS OWNER
|
||||||
|
AS
|
||||||
|
BEGIN TRY -- Try Block
|
||||||
|
BEGIN TRANSACTION
|
||||||
|
UPDATE [Pdfs]
|
||||||
|
SET
|
||||||
|
[PageCount]=@PageCount,
|
||||||
|
[DocPdf]=@DocPdf,
|
||||||
|
[DTS]=@DTS,
|
||||||
|
[UserID]=@UserID
|
||||||
|
WHERE [DocID]=@DocID AND [DebugStatus]=@DebugStatus AND [TopRow]=@TopRow AND [PageLength]=@PageLength AND [LeftMargin]=@LeftMargin AND [PageWidth]=@PageWidth AND [LastChanged]=@LastChanged
|
||||||
|
IF @@ROWCOUNT = 0
|
||||||
|
BEGIN
|
||||||
|
IF NOT exists(select * from [Pdfs] WHERE [DocID]=@DocID AND [DebugStatus]=@DebugStatus AND [TopRow]=@TopRow AND [PageLength]=@PageLength AND [LeftMargin]=@LeftMargin AND [PageWidth]=@PageWidth)
|
||||||
|
RAISERROR('Pdf record has been deleted by another user', 16, 1)
|
||||||
|
ELSE
|
||||||
|
RAISERROR('Pdf has been edited by another user', 16, 1)
|
||||||
|
END
|
||||||
|
|
||||||
|
SELECT @newLastChanged=[LastChanged]
|
||||||
|
FROM [Pdfs] WHERE [DocID]=@DocID AND [DebugStatus]=@DebugStatus AND [TopRow]=@TopRow AND [PageLength]=@PageLength AND [LeftMargin]=@LeftMargin AND [PageWidth]=@PageWidth
|
||||||
|
|
||||||
|
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: updatePdf Succeeded'
|
||||||
|
ELSE PRINT 'Procedure Creation: updatePdf Error on Creation'
|
||||||
|
GO
|
||||||
|
|
||||||
/****** Object: StoredProcedure [updatePermission] ******/
|
/****** Object: StoredProcedure [updatePermission] ******/
|
||||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[updatePermission]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[updatePermission]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||||
DROP PROCEDURE [updatePermission];
|
DROP PROCEDURE [updatePermission];
|
||||||
@ -13031,6 +13354,33 @@ IF (@@Error = 0) PRINT 'ScalarFunction Creation: vefn_FixTransitionTextForCopy S
|
|||||||
ELSE PRINT 'ScalarFunction Creation: vefn_FixTransitionTextForCopy Error on Creation'
|
ELSE PRINT 'ScalarFunction Creation: vefn_FixTransitionTextForCopy Error on Creation'
|
||||||
GO
|
GO
|
||||||
|
|
||||||
|
/****** Object: StoredProcedure [vefn_GetDocumentPageLength] ******/
|
||||||
|
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[vefn_GetDocumentPageLength]') AND OBJECTPROPERTY(id,N'IsScalarFunction') = 1)
|
||||||
|
DROP FUNCTION [vefn_GetDocumentPageLength];
|
||||||
|
GO
|
||||||
|
|
||||||
|
/*
|
||||||
|
print .dbo.[vefn_GetDocumentPageLength](1)
|
||||||
|
select DocID, .dbo.[vefn_GetDocumentPageLength](DocID) PageLength from Documents
|
||||||
|
*/
|
||||||
|
|
||||||
|
CREATE FUNCTION [dbo].[vefn_GetDocumentPageLength] (@DocID int) RETURNS float
|
||||||
|
WITH EXECUTE AS OWNER
|
||||||
|
AS
|
||||||
|
BEGIN
|
||||||
|
DECLARE @PageLength float
|
||||||
|
SET @PageLength = (select top 1 v.value('.', 'nvarchar(100)') [Length]
|
||||||
|
from (select DocID, cast (Config as xml) ConfigXML from Documents) T1
|
||||||
|
CROSS APPLY ConfigXML.nodes('//@Length') TempXML(v)
|
||||||
|
WHERE DocID = @DocID)
|
||||||
|
return @PageLength
|
||||||
|
END;
|
||||||
|
GO
|
||||||
|
-- Display the status of Proc creation
|
||||||
|
IF (@@Error = 0) PRINT 'ScalarFunction Creation: vefn_GetDocumentPageLength Succeeded'
|
||||||
|
ELSE PRINT 'ScalarFunction Creation: vefn_GetDocumentPageLength Error on Creation'
|
||||||
|
GO
|
||||||
|
|
||||||
/****** Object: StoredProcedure [vefn_GetFormatField] ******/
|
/****** Object: StoredProcedure [vefn_GetFormatField] ******/
|
||||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[vefn_GetFormatField]') AND OBJECTPROPERTY(id,N'IsTableFunction') = 1)
|
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[vefn_GetFormatField]') AND OBJECTPROPERTY(id,N'IsTableFunction') = 1)
|
||||||
DROP FUNCTION [vefn_GetFormatField];
|
DROP FUNCTION [vefn_GetFormatField];
|
||||||
@ -13851,6 +14201,65 @@ IF (@@Error = 0) PRINT 'ScalarFunction Creation: vefn_RemoveRange Succeeded'
|
|||||||
ELSE PRINT 'ScalarFunction Creation: vefn_RemoveRange Error on Creation'
|
ELSE PRINT 'ScalarFunction Creation: vefn_RemoveRange Error on Creation'
|
||||||
GO
|
GO
|
||||||
|
|
||||||
|
/****** Object: StoredProcedure [vefn_SectionFormats] ******/
|
||||||
|
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[vefn_SectionFormats]') AND OBJECTPROPERTY(id,N'IsTableFunction') = 1)
|
||||||
|
DROP FUNCTION [vefn_SectionFormats];
|
||||||
|
GO
|
||||||
|
|
||||||
|
--select FormatID
|
||||||
|
--,10000 + v.value('../@Index', 'int') [SectionType]
|
||||||
|
--,[Name]
|
||||||
|
--,v.value('../@Name', 'varchar(255)') [SectionFormatName]
|
||||||
|
--,v.value('@TopRow', 'int') TopRow
|
||||||
|
--,v.value('@PageLength', 'int') PageLength
|
||||||
|
--,v.value('@FooterLength', 'int') FooterLength
|
||||||
|
--,v.value('@LeftMargin', 'int') LeftMargin
|
||||||
|
--,v.value('@PageWidth', 'int') PageWidth
|
||||||
|
--from Formats
|
||||||
|
--CROSS APPLY Data.nodes('//DocStyle/Layout') TempXML(v)
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
select * from vefn_SectionFormats() where Name = 'OHLP'
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
CREATE FUNCTION [dbo].[vefn_SectionFormats]()
|
||||||
|
RETURNS @SectionFormats TABLE
|
||||||
|
(
|
||||||
|
[FormatID] int
|
||||||
|
,[SectionType] int
|
||||||
|
,[Name] nvarchar(20)
|
||||||
|
,[SectionFormatName] nvarchar(max)
|
||||||
|
,[TopRow] int
|
||||||
|
,[PageLength] int
|
||||||
|
,[FooterLength] int
|
||||||
|
,[LeftMargin] int
|
||||||
|
,[PageWidth] int
|
||||||
|
)
|
||||||
|
WITH EXECUTE AS OWNER
|
||||||
|
AS
|
||||||
|
BEGIN
|
||||||
|
Insert into @SectionFormats
|
||||||
|
select FormatID
|
||||||
|
,10000 + v.value('../@Index', 'int') [SectionType]
|
||||||
|
,[Name]
|
||||||
|
,v.value('../@Name', 'varchar(255)') [SectionFormatName]
|
||||||
|
,v.value('@TopRow', 'int') TopRow
|
||||||
|
,v.value('@PageLength', 'int') PageLength
|
||||||
|
,v.value('@FooterLength', 'int') FooterLength
|
||||||
|
,v.value('@LeftMargin', 'int') LeftMargin
|
||||||
|
,v.value('@PageWidth', 'int') PageWidth
|
||||||
|
from Formats
|
||||||
|
CROSS APPLY Data.nodes('//DocStyle/Layout') TempXML(v)
|
||||||
|
RETURN
|
||||||
|
END
|
||||||
|
GO
|
||||||
|
-- Display the status of Proc creation
|
||||||
|
IF (@@Error = 0) PRINT 'TableFunction Creation: vefn_SectionFormats Succeeded'
|
||||||
|
ELSE PRINT 'TableFunction Creation: vefn_SectionFormats Error on Creation'
|
||||||
|
GO
|
||||||
|
|
||||||
/****** Object: StoredProcedure [vefn_SiblingAndChildrenItems] ******/
|
/****** Object: StoredProcedure [vefn_SiblingAndChildrenItems] ******/
|
||||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[vefn_SiblingAndChildrenItems]') AND OBJECTPROPERTY(id,N'IsTableFunction') = 1)
|
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[vefn_SiblingAndChildrenItems]') AND OBJECTPROPERTY(id,N'IsTableFunction') = 1)
|
||||||
DROP FUNCTION [vefn_SiblingAndChildrenItems];
|
DROP FUNCTION [vefn_SiblingAndChildrenItems];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user