Added DocPdf field for caching
This commit is contained in:
parent
7312100a51
commit
ec9ac888a0
@ -297,7 +297,7 @@ namespace DataLoader
|
||||
int nBytesRead = fs.Read(ByteArray, 0, (int)len);
|
||||
fs.Close();
|
||||
string t1 = (title == null || title == "") ? null : title;
|
||||
Document doc = Document.MakeDocument(t1, ByteArray, null, ci == null ? null : ci.ToString(), DateTime.Now, "Migration", ".Doc");
|
||||
Document doc = Document.MakeDocument(t1, ByteArray, null, ci == null ? null : ci.ToString(), DateTime.Now, "Migration", ".Doc",null);
|
||||
FileInfo tmpFile = new FileInfo(temppath);
|
||||
string docfile = temppath.Substring(0, temppath.LastIndexOf(".")) + @".doc";
|
||||
if (File.Exists(docfile)) File.Delete(docfile);
|
||||
|
@ -74,7 +74,7 @@ namespace DataLoader
|
||||
SaveSectionDocument(fname, stpseq, SecType, ref Documentid, procitem.DisplayNumber + ":" + (Number == string.Empty ? Title : Number));
|
||||
if (Documentid == 0)
|
||||
{
|
||||
if (MissingDocument==null) MissingDocument = Document.MakeDocument("MISSING FILE IN CONVERSION", null, null, null);
|
||||
if (MissingDocument==null) MissingDocument = Document.MakeDocument("MISSING FILE IN CONVERSION", null, null, null,null);
|
||||
Documentid = MissingDocument.DocID;
|
||||
}
|
||||
}
|
||||
|
@ -402,6 +402,7 @@ CREATE PROCEDURE [dbo].[addDocument]
|
||||
@DTS datetime,
|
||||
@UserID nvarchar(100),
|
||||
@FileExtension nvarchar(10),
|
||||
@DocPdf varbinary(MAX)=null,
|
||||
@newDocID int output,
|
||||
@newLastChanged timestamp output
|
||||
)
|
||||
@ -417,7 +418,8 @@ BEGIN TRY -- Try Block
|
||||
[Config],
|
||||
[DTS],
|
||||
[UserID],
|
||||
[FileExtension]
|
||||
[FileExtension],
|
||||
[DocPdf]
|
||||
)
|
||||
VALUES
|
||||
(
|
||||
@ -427,7 +429,8 @@ BEGIN TRY -- Try Block
|
||||
@Config,
|
||||
@DTS,
|
||||
@UserID,
|
||||
@FileExtension
|
||||
@FileExtension,
|
||||
@DocPdf
|
||||
)
|
||||
SELECT @newDocID= SCOPE_IDENTITY()
|
||||
SELECT @newLastChanged=[LastChanged]
|
||||
@ -1855,10 +1858,10 @@ INSERT INTO [Entries] ([ContentID],[DocID],[DTS],[UserID])
|
||||
SELECT NN.[NewContentID],EE.[DocID],@DTS,@UserID
|
||||
FROM [Entries] EE JOIN @Children NN on NN.ContentID = EE.ContentID
|
||||
JOIN [Documents] DD on EE.[DocID] = DD.[DocID] and Isnull(LibTitle,'') <> ''
|
||||
-- Logic to create new documents for any documents used that do not have libttitles
|
||||
INSERT INTO [Documents] ([LibTitle],[DocContent],[DocAscii],[Config],[DTS],[UserID],[FileExtension])
|
||||
-- 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])
|
||||
OUTPUT CAST(INSERTED.[LibTitle] as INT),INSERTED.[DocID] INTO @NewDocuments
|
||||
SELECT str(DD.[DocID]),[DocContent],[DocAscii],[Config],@DTS,@UserID,[FileExtension]
|
||||
SELECT str(DD.[DocID]),[DocContent],[DocAscii],[Config],@DTS,@UserID,[FileExtension],[DocPdf]
|
||||
FROM [Entries] EE JOIN @Children NN on NN.ContentID = EE.ContentID
|
||||
JOIN [Documents] DD on EE.[DocID] = DD.[DocID] and Isnull(LibTitle,'') = ''
|
||||
UPDATE DD SET LibTitle = ''
|
||||
@ -4622,7 +4625,8 @@ AS
|
||||
[Documents].[Config] [Document_Config],
|
||||
[Documents].[DTS] [Document_DTS],
|
||||
[Documents].[UserID] [Document_UserID],
|
||||
[Documents].[FileExtension] [Document_FileExtension]
|
||||
[Documents].[FileExtension] [Document_FileExtension],
|
||||
[Documents].[DocPdf] [Document_DocPdf]
|
||||
FROM [Entries]
|
||||
JOIN [Documents] ON
|
||||
[Documents].[DocID]=[Entries].[DocID]
|
||||
@ -4910,6 +4914,7 @@ AS
|
||||
[UserID],
|
||||
[LastChanged],
|
||||
[FileExtension],
|
||||
[DocPdf],
|
||||
(SELECT COUNT(*) FROM [Entries] WHERE [Entries].[DocID]=[Documents].[DocID]) [EntryCount]
|
||||
FROM [Documents]
|
||||
WHERE [DocID]=@DocID
|
||||
@ -4959,6 +4964,7 @@ AS
|
||||
[UserID],
|
||||
[LastChanged],
|
||||
[FileExtension],
|
||||
[DocPdf],
|
||||
(SELECT COUNT(*) FROM [Entries] WHERE [Entries].[DocID]=[Documents].[DocID]) [EntryCount]
|
||||
FROM [Documents]
|
||||
RETURN
|
||||
@ -5235,7 +5241,8 @@ AS
|
||||
[Documents].[Config] [Document_Config],
|
||||
[Documents].[DTS] [Document_DTS],
|
||||
[Documents].[UserID] [Document_UserID],
|
||||
[Documents].[FileExtension] [Document_FileExtension]
|
||||
[Documents].[FileExtension] [Document_FileExtension],
|
||||
[Documents].[DocPdf] [Document_DocPdf]
|
||||
FROM [Entries]
|
||||
JOIN [Documents] ON
|
||||
[Documents].[DocID]=[Entries].[DocID]
|
||||
@ -6554,6 +6561,7 @@ SELECT
|
||||
[DTS],
|
||||
[UserID],
|
||||
[LastChanged],
|
||||
[DocPdf],
|
||||
(SELECT COUNT(*) FROM [Entries] WHERE [Entries].[DocID]=[Documents].[DocID]) [EntryCount]
|
||||
FROM [Documents] where [LibTitle] <> '' order by [LibTitle]
|
||||
RETURN
|
||||
@ -9240,6 +9248,7 @@ CREATE PROCEDURE [dbo].[updateDocument]
|
||||
@UserID nvarchar(100),
|
||||
@LastChanged timestamp,
|
||||
@FileExtension nvarchar(10),
|
||||
@DocPdf varbinary(MAX)=null,
|
||||
@newLastChanged timestamp output
|
||||
)
|
||||
WITH EXECUTE AS OWNER
|
||||
@ -9254,7 +9263,8 @@ BEGIN TRY -- Try Block
|
||||
[Config]=@Config,
|
||||
[DTS]=@DTS,
|
||||
[UserID]=@UserID,
|
||||
[FileExtension]=@FileExtension
|
||||
[FileExtension]=@FileExtension,
|
||||
[DocPdf]=@DocPdf
|
||||
WHERE [DocID]=@DocID AND [LastChanged]=@LastChanged
|
||||
IF @@ROWCOUNT = 0
|
||||
BEGIN
|
||||
@ -11966,7 +11976,7 @@ Select * from vefn_GetFormatFieldByStepType('Font')
|
||||
Select * from vefn_GetFormatFieldByStepType('PSADJBNGROW')
|
||||
Select * from vefn_GetFormatFieldByStepType('SectionTitle')
|
||||
Select * from vefn_GetFormatFieldByStepType('PrintNoTitle')
|
||||
Select * from vefn_GetFormatFieldByStepType('Off')
|
||||
Select * from vefn_GetFormatFieldByStepType('Off') where name ='AEP'
|
||||
|
||||
*/
|
||||
|
||||
@ -11994,6 +12004,7 @@ BEGIN
|
||||
case when v3.exist('.') is null THEN '' ELSE v3.value('local-name(.)','varchar(max)') + '/' END +
|
||||
case when v2.exist('.') is null THEN '' ELSE v2.value('local-name(.)','varchar(max)') + '/' END +
|
||||
case when v1.exist('.') is null THEN '' ELSE v1.value('local-name(.)','varchar(max)') + '/' END +
|
||||
.dbo.vefn_XmlPath(v1.query('.')) +
|
||||
+ '@' + v.value('local-name(.)','varchar(max)') Path
|
||||
, coalesce(v.value('../@Type','varchar(255)'),v.value('../../@Type','varchar(255)'),v.value('../../../@Type','varchar(255)')) StepType
|
||||
, v.value('.', 'varchar(255)') Value
|
||||
@ -12020,7 +12031,7 @@ BEGIN
|
||||
case when v4.exist('.') is null THEN '' ELSE v4.value('local-name(.)','varchar(max)') + '/' END +
|
||||
case when v3.exist('.') is null THEN '' ELSE v3.value('local-name(.)','varchar(max)') + '/' END +
|
||||
case when v2.exist('.') is null THEN '' ELSE v2.value('local-name(.)','varchar(max)') + '/' END +
|
||||
case when v1.exist('.') is null THEN '' ELSE v1.value('local-name(.)','varchar(max)') + '/' END +
|
||||
case when v1.exist('.') is null THEN '' ELSE v1.value('local-name(.)','varchar(max)') + coalesce('[' + v1.value('@Index','varchar(255)')+']','') + '/' END +
|
||||
+ v.value('local-name(.)','varchar(max)') Path
|
||||
, coalesce(v.value('../@Type','varchar(255)'),v.value('../../@Type','varchar(255)'),v.value('../../../@Type','varchar(255)')) StepType
|
||||
, '{node}'
|
||||
@ -12044,6 +12055,70 @@ IF (@@Error = 0) PRINT 'TableFunction Creation: vefn_GetFormatFieldByStepType Su
|
||||
ELSE PRINT 'TableFunction Creation: vefn_GetFormatFieldByStepType Error on Creation'
|
||||
GO
|
||||
|
||||
/****** Object: StoredProcedure [vefn_GetFormatFieldByStepType2] ******/
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[vefn_GetFormatFieldByStepType2]') AND OBJECTPROPERTY(id,N'IsTableFunction') = 1)
|
||||
DROP FUNCTION [vefn_GetFormatFieldByStepType2];
|
||||
GO
|
||||
|
||||
/*
|
||||
Select * from vefn_GetFormatFieldByStepType2('Font')
|
||||
Select * from vefn_GetFormatFieldByStepType2('PSADJBNGROW')
|
||||
Select * from vefn_GetFormatFieldByStepType2('SectionTitle')
|
||||
Select * from vefn_GetFormatFieldByStepType2('PrintNoTitle')
|
||||
Select * from vefn_GetFormatFieldByStepType2('Off')
|
||||
|
||||
*/
|
||||
|
||||
CREATE FUNCTION [dbo].[vefn_GetFormatFieldByStepType2](@find varchar(255))
|
||||
RETURNS @FormatFields TABLE
|
||||
(
|
||||
FormatID int
|
||||
,Name varchar(20)
|
||||
,Description varchar(250)
|
||||
,Path varchar(max)
|
||||
,StepType varchar(255)
|
||||
,Indx varchar(255)
|
||||
,Value varchar(255)
|
||||
)
|
||||
WITH EXECUTE AS OWNER
|
||||
AS
|
||||
BEGIN
|
||||
INSERT INTO @FormatFields
|
||||
Select FormatID, Name, Description,
|
||||
.dbo.vefn_XmlPath(v9.query('.')) +
|
||||
.dbo.vefn_XmlPath(v8.query('.')) +
|
||||
.dbo.vefn_XmlPath(v7.query('.')) +
|
||||
.dbo.vefn_XmlPath(v6.query('.')) +
|
||||
.dbo.vefn_XmlPath(v5.query('.')) +
|
||||
.dbo.vefn_XmlPath(v4.query('.')) +
|
||||
.dbo.vefn_XmlPath(v3.query('.')) +
|
||||
.dbo.vefn_XmlPath(v2.query('.')) +
|
||||
.dbo.vefn_XmlPath(v1.query('.')) +
|
||||
+ '@' + v.value('local-name(.)','varchar(max)') Path
|
||||
, coalesce(v.value('../@Type','varchar(255)'),v.value('../../@Type','varchar(255)'),v.value('../../../@Type','varchar(255)')) StepType
|
||||
, coalesce(v1.value('@Index','varchar(255)'),v2.value('@Index','varchar(255)'),v3.value('@Index','varchar(255)')) Indx
|
||||
, v.value('.', 'varchar(255)') Value
|
||||
FROM Formats
|
||||
CROSS APPLY Data.nodes('//*/@*') TempXML(v)
|
||||
OUTER APPLY v.nodes('..') TempXML1(v1)
|
||||
OUTER APPLY v1.nodes('..') TempXML2(v2)
|
||||
OUTER APPLY v2.nodes('..') TempXML3(v3)
|
||||
OUTER APPLY v3.nodes('..') TempXML4(v4)
|
||||
OUTER APPLY v4.nodes('..') TempXML5(v5)
|
||||
OUTER APPLY v5.nodes('..') TempXML6(v6)
|
||||
OUTER APPLY v6.nodes('..') TempXML7(v7)
|
||||
OUTER APPLY v7.nodes('..') TempXML8(v8)
|
||||
OUTER APPLY v8.nodes('..') TempXML9(v9)
|
||||
where v.value('local-name(.)', 'varchar(255)') like '%' + @find + '%'
|
||||
OR v.value('.', 'varchar(255)') like '%' + @find + '%'
|
||||
RETURN
|
||||
END
|
||||
GO
|
||||
-- Display the status of Proc creation
|
||||
IF (@@Error = 0) PRINT 'TableFunction Creation: vefn_GetFormatFieldByStepType2 Succeeded'
|
||||
ELSE PRINT 'TableFunction Creation: vefn_GetFormatFieldByStepType2 Error on Creation'
|
||||
GO
|
||||
|
||||
/****** Object: StoredProcedure [vefn_GetFormatFieldNoValue] ******/
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[vefn_GetFormatFieldNoValue]') AND OBJECTPROPERTY(id,N'IsTableFunction') = 1)
|
||||
DROP FUNCTION [vefn_GetFormatFieldNoValue];
|
||||
@ -12141,6 +12216,37 @@ IF (@@Error = 0) PRINT 'TableFunction Creation: vefn_GetFormatValues Succeeded'
|
||||
ELSE PRINT 'TableFunction Creation: vefn_GetFormatValues Error on Creation'
|
||||
GO
|
||||
|
||||
/****** Object: StoredProcedure [vefn_GetGenMacMacros] ******/
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[vefn_GetGenMacMacros]') AND OBJECTPROPERTY(id,N'IsTableFunction') = 1)
|
||||
DROP FUNCTION [vefn_GetGenMacMacros];
|
||||
GO
|
||||
|
||||
/*
|
||||
Select * from vefn_GetGenMacMacros()
|
||||
*/
|
||||
|
||||
CREATE FUNCTION [dbo].[vefn_GetGenMacMacros]()
|
||||
RETURNS @GenMacMacros TABLE
|
||||
(
|
||||
FormatID int
|
||||
,Name varchar(20)
|
||||
,Description varchar(250)
|
||||
,MacroName varchar(255)
|
||||
)
|
||||
WITH EXECUTE AS OWNER
|
||||
AS
|
||||
BEGIN
|
||||
INSERT INTO @GenMacMacros
|
||||
Select FormatID, Name, Description,v.value('@id','varchar(20)') MacroName
|
||||
FROM Formats CROSS APPLY GenMac.nodes('//g') TempXML(v)
|
||||
RETURN
|
||||
END
|
||||
GO
|
||||
-- Display the status of Proc creation
|
||||
IF (@@Error = 0) PRINT 'TableFunction Creation: vefn_GetGenMacMacros Succeeded'
|
||||
ELSE PRINT 'TableFunction Creation: vefn_GetGenMacMacros Error on Creation'
|
||||
GO
|
||||
|
||||
/****** Object: StoredProcedure [vefn_GetInheritedFormat] ******/
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[vefn_GetInheritedFormat]') AND OBJECTPROPERTY(id,N'IsScalarFunction') = 1)
|
||||
DROP FUNCTION [vefn_GetInheritedFormat];
|
||||
@ -12916,6 +13022,24 @@ IF (@@Error = 0) PRINT 'TableFunction Creation: vefn_SplitROSearch Succeeded'
|
||||
ELSE PRINT 'TableFunction Creation: vefn_SplitROSearch Error on Creation'
|
||||
GO
|
||||
|
||||
/****** Object: StoredProcedure [vefn_XmlPath] ******/
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[vefn_XmlPath]') AND OBJECTPROPERTY(id,N'IsScalarFunction') = 1)
|
||||
DROP FUNCTION [vefn_XmlPath];
|
||||
GO
|
||||
|
||||
CREATE FUNCTION [dbo].[vefn_XmlPath] (@xml XML) RETURNS varchar(255)
|
||||
WITH EXECUTE AS OWNER
|
||||
AS
|
||||
BEGIN
|
||||
return case when @xml.exist('*[1]') is null THEN '' ELSE @xml.value('local-name(*[1])','varchar(max)') +
|
||||
coalesce('[' + @xml.value('*[1]/@Type','varchar(255)')+']','[' + @xml.value('*[1]/@Index','varchar(255)')+']','') + '/' END
|
||||
END;
|
||||
GO
|
||||
-- Display the status of Proc creation
|
||||
IF (@@Error = 0) PRINT 'ScalarFunction Creation: vefn_XmlPath Succeeded'
|
||||
ELSE PRINT 'ScalarFunction Creation: vefn_XmlPath Error on Creation'
|
||||
GO
|
||||
|
||||
/****** Object: StoredProcedure [vesp_CleanUpItems] ******/
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[vesp_CleanUpItems]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||
DROP PROCEDURE [vesp_CleanUpItems];
|
||||
@ -13004,6 +13128,41 @@ IF (@@Error = 0) PRINT 'Procedure Creation: vesp_GetFormatFields Succeeded'
|
||||
ELSE PRINT 'Procedure Creation: vesp_GetFormatFields Error on Creation'
|
||||
GO
|
||||
|
||||
/****** Object: StoredProcedure [vesp_GetFormatFieldsAll] ******/
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[vesp_GetFormatFieldsAll]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||
DROP PROCEDURE [vesp_GetFormatFieldsAll];
|
||||
GO
|
||||
|
||||
/*
|
||||
vesp_GetFormatFieldsAll 'PrintNoTitle'
|
||||
vesp_GetFormatFieldsAll 'Sep'
|
||||
vesp_GetFormatFieldsAll 'TabFormat'
|
||||
vesp_GetFormatFieldsAll 'ShowSectionTitles'
|
||||
vesp_GetFormatFieldsAll 'Caution'
|
||||
vesp_GetFormatFieldsAll 'Ident'
|
||||
*/
|
||||
|
||||
CREATE PROCEDURE [dbo].[vesp_GetFormatFieldsAll]
|
||||
(
|
||||
@find varchar(255)
|
||||
)
|
||||
WITH EXECUTE AS OWNER
|
||||
AS
|
||||
BEGIN
|
||||
declare @pivotlist varchar(max)
|
||||
select @pivotlist = stuff((select distinct ',[' + [Name] + ']' from Formats
|
||||
order by ',[' + [Name] + ']' for xml path('')),1,1,'')
|
||||
DECLARE @query VARCHAR(max)
|
||||
SET @query = 'SELECT * FROM (Select Name,Path,Value From vefn_GetFormatField(''' + @find + ''')) T1 PIVOT ( Count(Name) FOR [Name] IN (' + @pivotlist + ') ) AS Pivot1 ORDER BY PATH,VALUE'
|
||||
print @Query
|
||||
EXECUTE(@query)
|
||||
END
|
||||
GO
|
||||
-- Display the status of Proc creation
|
||||
IF (@@Error = 0) PRINT 'Procedure Creation: vesp_GetFormatFieldsAll Succeeded'
|
||||
ELSE PRINT 'Procedure Creation: vesp_GetFormatFieldsAll Error on Creation'
|
||||
GO
|
||||
|
||||
/****** Object: StoredProcedure [vesp_GetFormatFieldsByStepType] ******/
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[vesp_GetFormatFieldsByStepType]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||
DROP PROCEDURE [vesp_GetFormatFieldsByStepType];
|
||||
@ -13044,6 +13203,46 @@ IF (@@Error = 0) PRINT 'Procedure Creation: vesp_GetFormatFieldsByStepType Succe
|
||||
ELSE PRINT 'Procedure Creation: vesp_GetFormatFieldsByStepType Error on Creation'
|
||||
GO
|
||||
|
||||
/****** Object: StoredProcedure [vesp_GetFormatFieldsByStepType2] ******/
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[vesp_GetFormatFieldsByStepType2]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||
DROP PROCEDURE [vesp_GetFormatFieldsByStepType2];
|
||||
GO
|
||||
|
||||
/*
|
||||
vesp_GetFormatFieldsByStepType2 'PrintNoTitle'
|
||||
vesp_GetFormatFieldsByStepType2 'Sep'
|
||||
vesp_GetFormatFieldsByStepType2 'TabFormat'
|
||||
vesp_GetFormatFieldsByStepType2 'ShowSectionTitles'
|
||||
vesp_GetFormatFieldsByStepType2 'Caution'
|
||||
vesp_GetFormatFieldsByStepType2 'Ident'
|
||||
vesp_GetFormatFieldsByStepType2 'Off'
|
||||
*/
|
||||
|
||||
Create PROCEDURE [dbo].[vesp_GetFormatFieldsByStepType2]
|
||||
(
|
||||
@find varchar(255)
|
||||
)
|
||||
WITH EXECUTE AS OWNER
|
||||
AS
|
||||
BEGIN
|
||||
declare @pivotlist varchar(max)
|
||||
select @pivotlist = stuff((select distinct ',[' + [Name] + ']' from vefn_GetFormatFieldByStepType2(@find)
|
||||
order by ',[' + [Name] + ']' for xml path('')),1,1,'')
|
||||
DECLARE @query VARCHAR(max)
|
||||
SET @query = 'SELECT * FROM (Select Name,''Format Description'' Path,'''' StepType, '''' Value, Description From Formats) T1 PIVOT ( Max(Description) FOR [Name] IN (' + @pivotlist + ') ) As Pivot2'
|
||||
EXECUTE(@query)
|
||||
SET @query = 'SELECT * FROM (Select Name,''FormatID'' Path, '''' StepType,'''' Value, FormatID From Formats) T1 PIVOT ( Max(FormatID) FOR [Name] IN (' + @pivotlist + ') ) As Pivot2'
|
||||
EXECUTE(@query)
|
||||
SET @query = 'SELECT * FROM (Select Name,Path,StepType,Value From vefn_GetFormatFieldByStepType2(''' + @find + ''')) T1 PIVOT ( Count(Name) FOR [Name] IN (' + @pivotlist + ') ) AS Pivot1 ORDER BY PATH,StepType,VALUE'
|
||||
print @Query
|
||||
EXECUTE(@query)
|
||||
END
|
||||
GO
|
||||
-- Display the status of Proc creation
|
||||
IF (@@Error = 0) PRINT 'Procedure Creation: vesp_GetFormatFieldsByStepType2 Succeeded'
|
||||
ELSE PRINT 'Procedure Creation: vesp_GetFormatFieldsByStepType2 Error on Creation'
|
||||
GO
|
||||
|
||||
/****** Object: StoredProcedure [vesp_GetFormatFieldsNoValue] ******/
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[vesp_GetFormatFieldsNoValue]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||
DROP PROCEDURE [vesp_GetFormatFieldsNoValue];
|
||||
@ -13194,6 +13393,37 @@ IF (@@Error = 0) PRINT 'Procedure Creation: vesp_GetFormatGroupFieldsNoValues Su
|
||||
ELSE PRINT 'Procedure Creation: vesp_GetFormatGroupFieldsNoValues Error on Creation'
|
||||
GO
|
||||
|
||||
/****** Object: StoredProcedure [vesp_GetGenMacMacros] ******/
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[vesp_GetGenMacMacros]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||
DROP PROCEDURE [vesp_GetGenMacMacros];
|
||||
GO
|
||||
|
||||
/*
|
||||
vesp_GetGenMacMacros
|
||||
*/
|
||||
|
||||
CREATE PROCEDURE [dbo].[vesp_GetGenMacMacros]
|
||||
WITH EXECUTE AS OWNER
|
||||
AS
|
||||
BEGIN
|
||||
declare @pivotlist varchar(max)
|
||||
select @pivotlist = stuff((select distinct ',[' + [Name] + ']' from vefn_GetGenMacMacros()
|
||||
order by ',[' + [Name] + ']' for xml path('')),1,1,'')
|
||||
DECLARE @query VARCHAR(max)
|
||||
SET @query = 'SELECT * FROM (Select Name,''Format Description'' Path, Description From Formats) T1 PIVOT ( Max(Description) FOR [Name] IN (' + @pivotlist + ') ) As Pivot2'
|
||||
EXECUTE(@query)
|
||||
SET @query = 'SELECT * FROM (Select Name,''FormatID'' Path, FormatID From Formats) T1 PIVOT ( Max(FormatID) FOR [Name] IN (' + @pivotlist + ') ) As Pivot2'
|
||||
EXECUTE(@query)
|
||||
SET @query = 'SELECT * FROM (Select Name,MacroName From vefn_GetGenMacMacros()) T1 PIVOT ( Count(Name) FOR [Name] IN (' + @pivotlist + ') ) AS Pivot1 ORDER BY MacroName'
|
||||
print @Query
|
||||
EXECUTE(@query)
|
||||
END
|
||||
GO
|
||||
-- Display the status of Proc creation
|
||||
IF (@@Error = 0) PRINT 'Procedure Creation: vesp_GetGenMacMacros Succeeded'
|
||||
ELSE PRINT 'Procedure Creation: vesp_GetGenMacMacros Error on Creation'
|
||||
GO
|
||||
|
||||
/****** Object: StoredProcedure [vesp_ListChildren] ******/
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[vesp_ListChildren]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||
DROP PROCEDURE [vesp_ListChildren];
|
||||
|
@ -415,7 +415,7 @@ namespace VEPROMS
|
||||
{
|
||||
// make new document with 'no' libtitle - use libtitle for the doc title. Then link this
|
||||
// to the item...
|
||||
Document doc = Document.MakeDocument(null, doclibinfo.DocContent, null, null);
|
||||
Document doc = Document.MakeDocument(null, doclibinfo.DocContent, null, null, null);
|
||||
_SectionConfig.MySection.MyContent.MyEntry.MyDocument = doc;
|
||||
}
|
||||
ppCmbxLibDoc.Items.Clear();
|
||||
|
@ -271,6 +271,26 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
}
|
||||
}
|
||||
private byte[] _DocPdf;
|
||||
public byte[] DocPdf
|
||||
{
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("DocPdf", true);
|
||||
return _DocPdf;
|
||||
}
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
set
|
||||
{
|
||||
CanWriteProperty("DocPdf", true);
|
||||
if (_DocPdf != value)
|
||||
{
|
||||
_DocPdf = value;
|
||||
PropertyHasChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
private int _DocumentEntryCount = 0;
|
||||
/// <summary>
|
||||
/// Count of DocumentEntries for this Document
|
||||
@ -439,6 +459,7 @@ namespace VEPROMS.CSLA.Library
|
||||
//AuthorizationRules.AllowRead(DTS, "<Role(s)>");
|
||||
//AuthorizationRules.AllowRead(UserID, "<Role(s)>");
|
||||
//AuthorizationRules.AllowRead(FileExtension, "<Role(s)>");
|
||||
//AuthorizationRules.AllowRead(DocPdf, "<Role(s)>");
|
||||
//AuthorizationRules.AllowWrite(LibTitle, "<Role(s)>");
|
||||
//AuthorizationRules.AllowWrite(DocContent, "<Role(s)>");
|
||||
//AuthorizationRules.AllowWrite(DocAscii, "<Role(s)>");
|
||||
@ -446,6 +467,7 @@ namespace VEPROMS.CSLA.Library
|
||||
//AuthorizationRules.AllowWrite(DTS, "<Role(s)>");
|
||||
//AuthorizationRules.AllowWrite(UserID, "<Role(s)>");
|
||||
//AuthorizationRules.AllowWrite(FileExtension, "<Role(s)>");
|
||||
//AuthorizationRules.AllowWrite(DocPdf, "<Role(s)>");
|
||||
_DocumentExtension.AddAuthorizationRules(AuthorizationRules);
|
||||
}
|
||||
protected override void AddInstanceAuthorizationRules()
|
||||
@ -534,7 +556,7 @@ namespace VEPROMS.CSLA.Library
|
||||
throw new DbCslaException("Error on Document.New", ex);
|
||||
}
|
||||
}
|
||||
public static Document New(string libTitle, byte[] docContent, string docAscii, string config, DateTime dts, string userID, string fileExtension)
|
||||
public static Document New(string libTitle, byte[] docContent, string docAscii, string config, DateTime dts, string userID, string fileExtension, byte[] docPdf)
|
||||
{
|
||||
Document tmp = Document.New();
|
||||
tmp.LibTitle = libTitle;
|
||||
@ -544,11 +566,12 @@ namespace VEPROMS.CSLA.Library
|
||||
tmp.DTS = dts;
|
||||
tmp.UserID = userID;
|
||||
tmp.FileExtension = fileExtension;
|
||||
tmp.DocPdf = docPdf;
|
||||
return tmp;
|
||||
}
|
||||
public static Document MakeDocument(string libTitle, byte[] docContent, string docAscii, string config, DateTime dts, string userID, string fileExtension)
|
||||
public static Document MakeDocument(string libTitle, byte[] docContent, string docAscii, string config, DateTime dts, string userID, string fileExtension, byte[] docPdf)
|
||||
{
|
||||
Document tmp = Document.New(libTitle, docContent, docAscii, config, dts, userID, fileExtension);
|
||||
Document tmp = Document.New(libTitle, docContent, docAscii, config, dts, userID, fileExtension, docPdf);
|
||||
if (tmp.IsSavable)
|
||||
{
|
||||
Document tmp2 = tmp;
|
||||
@ -566,18 +589,19 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
return tmp;
|
||||
}
|
||||
public static Document New(string libTitle, byte[] docContent, string docAscii, string config)
|
||||
public static Document New(string libTitle, byte[] docContent, string docAscii, string config, byte[] docPdf)
|
||||
{
|
||||
Document tmp = Document.New();
|
||||
tmp.LibTitle = libTitle;
|
||||
tmp.DocContent = docContent;
|
||||
tmp.DocAscii = docAscii;
|
||||
tmp.Config = config;
|
||||
tmp.DocPdf = docPdf;
|
||||
return tmp;
|
||||
}
|
||||
public static Document MakeDocument(string libTitle, byte[] docContent, string docAscii, string config)
|
||||
public static Document MakeDocument(string libTitle, byte[] docContent, string docAscii, string config, byte[] docPdf)
|
||||
{
|
||||
Document tmp = Document.New(libTitle, docContent, docAscii, config);
|
||||
Document tmp = Document.New(libTitle, docContent, docAscii, config, docPdf);
|
||||
if (tmp.IsSavable)
|
||||
{
|
||||
Document tmp2 = tmp;
|
||||
@ -702,6 +726,7 @@ namespace VEPROMS.CSLA.Library
|
||||
_UserID = dr.GetString("UserID");
|
||||
dr.GetBytes("LastChanged", 0, _LastChanged, 0, 8);
|
||||
_FileExtension = dr.GetString("FileExtension");
|
||||
_DocPdf = (byte[])dr.GetValue("DocPdf");
|
||||
_DocumentEntryCount = dr.GetInt32("EntryCount");
|
||||
MarkOld();
|
||||
}
|
||||
@ -794,6 +819,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (_DTS.Year >= 1753 && _DTS.Year <= 9999) cm.Parameters.AddWithValue("@DTS", _DTS);
|
||||
cm.Parameters.AddWithValue("@UserID", _UserID);
|
||||
cm.Parameters.AddWithValue("@FileExtension", _FileExtension);
|
||||
cm.Parameters.AddWithValue("@DocPdf", _DocPdf);
|
||||
// Output Calculated Columns
|
||||
SqlParameter param_DocID = new SqlParameter("@newDocID", SqlDbType.Int);
|
||||
param_DocID.Direction = ParameterDirection.Output;
|
||||
@ -820,7 +846,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
}
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
public static byte[] Add(SqlConnection cn, ref int docID, string libTitle, byte[] docContent, string docAscii, string config, DateTime dts, string userID, string fileExtension)
|
||||
public static byte[] Add(SqlConnection cn, ref int docID, string libTitle, byte[] docContent, string docAscii, string config, DateTime dts, string userID, string fileExtension, byte[] docPdf)
|
||||
{
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Document.Add", 0);
|
||||
try
|
||||
@ -837,6 +863,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (dts.Year >= 1753 && dts.Year <= 9999) cm.Parameters.AddWithValue("@DTS", dts);
|
||||
cm.Parameters.AddWithValue("@UserID", userID);
|
||||
cm.Parameters.AddWithValue("@FileExtension", fileExtension);
|
||||
cm.Parameters.AddWithValue("@DocPdf", docPdf);
|
||||
// Output Calculated Columns
|
||||
SqlParameter param_DocID = new SqlParameter("@newDocID", SqlDbType.Int);
|
||||
param_DocID.Direction = ParameterDirection.Output;
|
||||
@ -904,6 +931,7 @@ namespace VEPROMS.CSLA.Library
|
||||
cm.Parameters.AddWithValue("@UserID", _UserID);
|
||||
cm.Parameters.AddWithValue("@LastChanged", _LastChanged);
|
||||
cm.Parameters.AddWithValue("@FileExtension", _FileExtension);
|
||||
cm.Parameters.AddWithValue("@DocPdf", _DocPdf);
|
||||
// Output Calculated Columns
|
||||
SqlParameter param_LastChanged = new SqlParameter("@newLastChanged", SqlDbType.Timestamp);
|
||||
param_LastChanged.Direction = ParameterDirection.Output;
|
||||
@ -932,15 +960,15 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
|
||||
if (IsNew)
|
||||
_LastChanged = Document.Add(cn, ref _DocID, _LibTitle, _DocContent, _DocAscii, _Config, _DTS, _UserID, _FileExtension);
|
||||
_LastChanged = Document.Add(cn, ref _DocID, _LibTitle, _DocContent, _DocAscii, _Config, _DTS, _UserID, _FileExtension, _DocPdf);
|
||||
else
|
||||
_LastChanged = Document.Update(cn, ref _DocID, _LibTitle, _DocContent, _DocAscii, _Config, _DTS, _UserID, ref _LastChanged, _FileExtension);
|
||||
_LastChanged = Document.Update(cn, ref _DocID, _LibTitle, _DocContent, _DocAscii, _Config, _DTS, _UserID, ref _LastChanged, _FileExtension, _DocPdf);
|
||||
MarkOld();
|
||||
}
|
||||
if (_DocumentEntries != null) _DocumentEntries.Update(this);
|
||||
}
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
public static byte[] Update(SqlConnection cn, ref int docID, string libTitle, byte[] docContent, string docAscii, string config, DateTime dts, string userID, ref byte[] lastChanged, string fileExtension)
|
||||
public static byte[] Update(SqlConnection cn, ref int docID, string libTitle, byte[] docContent, string docAscii, string config, DateTime dts, string userID, ref byte[] lastChanged, string fileExtension, byte[] docPdf)
|
||||
{
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Document.Update", 0);
|
||||
try
|
||||
@ -959,6 +987,7 @@ namespace VEPROMS.CSLA.Library
|
||||
cm.Parameters.AddWithValue("@UserID", userID);
|
||||
cm.Parameters.AddWithValue("@LastChanged", lastChanged);
|
||||
cm.Parameters.AddWithValue("@FileExtension", fileExtension);
|
||||
cm.Parameters.AddWithValue("@DocPdf", docPdf);
|
||||
// Output Calculated Columns
|
||||
SqlParameter param_LastChanged = new SqlParameter("@newLastChanged", SqlDbType.Timestamp);
|
||||
param_LastChanged.Direction = ParameterDirection.Output;
|
||||
|
@ -177,6 +177,16 @@ namespace VEPROMS.CSLA.Library
|
||||
return _FileExtension;
|
||||
}
|
||||
}
|
||||
private byte[] _DocPdf;
|
||||
public byte[] DocPdf
|
||||
{
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("DocPdf", true);
|
||||
return _DocPdf;
|
||||
}
|
||||
}
|
||||
private int _DocumentEntryCount = 0;
|
||||
/// <summary>
|
||||
/// Count of DocumentEntries for this Document
|
||||
@ -275,6 +285,7 @@ namespace VEPROMS.CSLA.Library
|
||||
_DTS = tmp.DTS;
|
||||
_UserID = tmp.UserID;
|
||||
_FileExtension = tmp.FileExtension;
|
||||
_DocPdf = tmp.DocPdf;
|
||||
_DocumentInfoExtension.Refresh(this);
|
||||
OnChange();// raise an event
|
||||
}
|
||||
@ -341,6 +352,7 @@ namespace VEPROMS.CSLA.Library
|
||||
_DTS = dr.GetDateTime("DTS");
|
||||
_UserID = dr.GetString("UserID");
|
||||
_FileExtension = dr.GetString("FileExtension");
|
||||
_DocPdf = (byte[])dr.GetValue("DocPdf");
|
||||
_DocumentEntryCount = dr.GetInt32("EntryCount");
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
@ -227,7 +227,7 @@ namespace Volian.Controls.Library
|
||||
int nBytesRead = fs.Read(ByteArray, 0, (int)len);
|
||||
fs.Close();
|
||||
string t1 = (title == null || title == "") ? null : title;
|
||||
Document doc = Document.MakeDocument(t1, ByteArray, null, null); //, DateTime.Now, "Migration");
|
||||
Document doc = Document.MakeDocument(t1, ByteArray, null, null, null); //, DateTime.Now, "Migration");
|
||||
return doc.DocID;
|
||||
}
|
||||
// for an io exception, keep trying
|
||||
|
@ -1003,7 +1003,7 @@ namespace Volian.Controls.Library
|
||||
Content cont = Content.Get(sectinfo.MyContent.ContentID);
|
||||
|
||||
Byte[] tstbyte = System.Text.Encoding.Default.GetBytes("{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033\\uc1 }\r\n");
|
||||
Document doc = Document.MakeDocument(null, tstbyte, null, null);
|
||||
Document doc = Document.MakeDocument(null, tstbyte, null, null, null);
|
||||
Entry entry = cont.MyEntry;
|
||||
entry.MyDocument = Document.Get(doc.DocID);
|
||||
cont.Save().Dispose();
|
||||
|
Loading…
x
Reference in New Issue
Block a user