From cce75c249732079b888b0959b8f59c84f51d5b0b Mon Sep 17 00:00:00 2001 From: Rich Date: Tue, 18 Jan 2011 21:06:09 +0000 Subject: [PATCH] Added Grids and Images --- PROMS/SQL/PROMS2010.SQL | 524 ++++++++++++++++++ .../VEPROMS.CSLA.Library/Generated/Content.cs | 78 ++- .../Generated/ContentInfo.cs | 96 ++++ .../Generated/PropertyDescriptor.cs | 8 + 4 files changed, 704 insertions(+), 2 deletions(-) diff --git a/PROMS/SQL/PROMS2010.SQL b/PROMS/SQL/PROMS2010.SQL index 56cefcf7..cba8022b 100644 --- a/PROMS/SQL/PROMS2010.SQL +++ b/PROMS/SQL/PROMS2010.SQL @@ -737,6 +737,57 @@ IF (@@Error = 0) PRINT 'Procedure Creation: addFormat Succeeded' ELSE PRINT 'Procedure Creation: addFormat Error on Creation' GO +/****** Object: StoredProcedure [addGrid] ******/ +IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[addGrid]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1) + DROP PROCEDURE [addGrid]; +GO + +CREATE PROCEDURE [dbo].[addGrid] + +( + @ContentID int, + @Data xml, + @Config xml=null, + @DTS datetime, + @UserID nvarchar(100), + @newLastChanged timestamp output +) +WITH EXECUTE AS OWNER +AS +BEGIN TRY -- Try Block + BEGIN TRANSACTION + INSERT INTO [Grids] + ( + [ContentID], + [Data], + [Config], + [DTS], + [UserID] + ) + VALUES + ( + @ContentID, + @Data, + @Config, + @DTS, + @UserID + ) + + SELECT @newLastChanged=[LastChanged] + FROM [Grids] WHERE [ContentID]=@ContentID + 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: addGrid Succeeded' +ELSE PRINT 'Procedure Creation: addGrid Error on Creation' +GO + /****** Object: StoredProcedure [addGroup] ******/ IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[addGroup]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1) DROP PROCEDURE [addGroup]; @@ -789,6 +840,63 @@ IF (@@Error = 0) PRINT 'Procedure Creation: addGroup Succeeded' ELSE PRINT 'Procedure Creation: addGroup Error on Creation' GO +/****** Object: StoredProcedure [addImage] ******/ +IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[addImage]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1) + DROP PROCEDURE [addImage]; +GO + +CREATE PROCEDURE [dbo].[addImage] + +( + @ContentID int, + @ImageType int, + @FileName nvarchar(255), + @Data varbinary(MAX), + @Config xml=null, + @DTS datetime, + @UserID nvarchar(100), + @newLastChanged timestamp output +) +WITH EXECUTE AS OWNER +AS +BEGIN TRY -- Try Block + BEGIN TRANSACTION + INSERT INTO [Images] + ( + [ContentID], + [ImageType], + [FileName], + [Data], + [Config], + [DTS], + [UserID] + ) + VALUES + ( + @ContentID, + @ImageType, + @FileName, + @Data, + @Config, + @DTS, + @UserID + ) + + SELECT @newLastChanged=[LastChanged] + FROM [Images] WHERE [ContentID]=@ContentID + 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: addImage Succeeded' +ELSE PRINT 'Procedure Creation: addImage Error on Creation' +GO + /****** Object: StoredProcedure [addItem] ******/ IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[addItem]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1) DROP PROCEDURE [addItem]; @@ -2144,6 +2252,10 @@ BEGIN TRY -- Try Block WHERE [ContentID]=@ContentID DELETE [Entries] WHERE [ContentID]=@ContentID + DELETE [Grids] + WHERE [ContentID]=@ContentID + DELETE [Images] + WHERE [ContentID]=@ContentID DELETE [Items] WHERE [ContentID]=@ContentID DELETE [Parts] @@ -2386,6 +2498,35 @@ IF (@@Error = 0) PRINT 'Procedure Creation: deleteFormat Succeeded' ELSE PRINT 'Procedure Creation: deleteFormat Error on Creation' GO +/****** Object: StoredProcedure [deleteGrid] ******/ +IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[deleteGrid]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1) + DROP PROCEDURE [deleteGrid]; +GO + +CREATE PROCEDURE [dbo].[deleteGrid] + +( + @ContentID int +) +WITH EXECUTE AS OWNER +AS +BEGIN TRY -- Try Block + BEGIN TRANSACTION + DELETE [Grids] + WHERE [ContentID] = @ContentID + 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: deleteGrid Succeeded' +ELSE PRINT 'Procedure Creation: deleteGrid Error on Creation' +GO + /****** Object: StoredProcedure [deleteGroup] ******/ IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[deleteGroup]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1) DROP PROCEDURE [deleteGroup]; @@ -2419,6 +2560,35 @@ IF (@@Error = 0) PRINT 'Procedure Creation: deleteGroup Succeeded' ELSE PRINT 'Procedure Creation: deleteGroup Error on Creation' GO +/****** Object: StoredProcedure [deleteImage] ******/ +IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[deleteImage]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1) + DROP PROCEDURE [deleteImage]; +GO + +CREATE PROCEDURE [dbo].[deleteImage] + +( + @ContentID int +) +WITH EXECUTE AS OWNER +AS +BEGIN TRY -- Try Block + BEGIN TRANSACTION + DELETE [Images] + WHERE [ContentID] = @ContentID + 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: deleteImage Succeeded' +ELSE PRINT 'Procedure Creation: deleteImage Error on Creation' +GO + /****** Object: StoredProcedure [deleteItem] ******/ IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[deleteItem]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1) DROP PROCEDURE [deleteItem]; @@ -3389,6 +3559,27 @@ IF (@@Error = 0) PRINT 'Procedure Creation: existsFormat Succeeded' ELSE PRINT 'Procedure Creation: existsFormat Error on Creation' GO +/****** Object: StoredProcedure [existsGrid] ******/ +IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[existsGrid]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1) + DROP PROCEDURE [existsGrid]; +GO + +CREATE PROCEDURE [dbo].[existsGrid] + +( + @ContentID int +) +WITH EXECUTE AS OWNER +AS + SELECT COUNT(*) + FROM [Grids] WHERE [ContentID]=@ContentID + RETURN +GO +-- Display the status of Proc creation +IF (@@Error = 0) PRINT 'Procedure Creation: existsGrid Succeeded' +ELSE PRINT 'Procedure Creation: existsGrid Error on Creation' +GO + /****** Object: StoredProcedure [existsGroup] ******/ IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[existsGroup]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1) DROP PROCEDURE [existsGroup]; @@ -3410,6 +3601,27 @@ IF (@@Error = 0) PRINT 'Procedure Creation: existsGroup Succeeded' ELSE PRINT 'Procedure Creation: existsGroup Error on Creation' GO +/****** Object: StoredProcedure [existsImage] ******/ +IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[existsImage]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1) + DROP PROCEDURE [existsImage]; +GO + +CREATE PROCEDURE [dbo].[existsImage] + +( + @ContentID int +) +WITH EXECUTE AS OWNER +AS + SELECT COUNT(*) + FROM [Images] WHERE [ContentID]=@ContentID + RETURN +GO +-- Display the status of Proc creation +IF (@@Error = 0) PRINT 'Procedure Creation: existsImage Succeeded' +ELSE PRINT 'Procedure Creation: existsImage Error on Creation' +GO + /****** Object: StoredProcedure [existsItem] ******/ IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[existsItem]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1) DROP PROCEDURE [existsItem]; @@ -4595,6 +4807,8 @@ AS [LastChanged], (SELECT COUNT(*) FROM [Details] WHERE [Details].[ContentID]=[Contents].[ContentID]) [DetailCount], (SELECT COUNT(*) FROM [Entries] WHERE [Entries].[ContentID]=[Contents].[ContentID]) [EntryCount], + (SELECT COUNT(*) FROM [Grids] WHERE [Grids].[ContentID]=[Contents].[ContentID]) [GridCount], + (SELECT COUNT(*) FROM [Images] WHERE [Images].[ContentID]=[Contents].[ContentID]) [ImageCount], (SELECT COUNT(*) FROM [Items] WHERE [Items].[ContentID]=[Contents].[ContentID]) [ItemCount], (SELECT COUNT(*) FROM [Parts] WHERE [Parts].[ContentID]=[Contents].[ContentID]) [PartCount], (SELECT COUNT(*) FROM [RoUsages] WHERE [RoUsages].[ContentID]=[Contents].[ContentID]) [RoUsageCount], @@ -4638,6 +4852,32 @@ AS [Entries].[ContentID]=@ContentID + SELECT + [Grids].[ContentID], + [Grids].[Data], + [Grids].[Config], + [Grids].[DTS], + [Grids].[UserID], + [Grids].[LastChanged] + FROM [Grids] + WHERE + [Grids].[ContentID]=@ContentID + + + SELECT + [Images].[ContentID], + [Images].[ImageType], + [Images].[FileName], + [Images].[Data], + [Images].[Config], + [Images].[DTS], + [Images].[UserID], + [Images].[LastChanged] + FROM [Images] + WHERE + [Images].[ContentID]=@ContentID + + SELECT [Items].[ItemID], [Items].[PreviousID], @@ -4754,6 +4994,8 @@ AS [LastChanged], (SELECT COUNT(*) FROM [Details] WHERE [Details].[ContentID]=[Contents].[ContentID]) [DetailCount], (SELECT COUNT(*) FROM [Entries] WHERE [Entries].[ContentID]=[Contents].[ContentID]) [EntryCount], + (SELECT COUNT(*) FROM [Grids] WHERE [Grids].[ContentID]=[Contents].[ContentID]) [GridCount], + (SELECT COUNT(*) FROM [Images] WHERE [Images].[ContentID]=[Contents].[ContentID]) [ImageCount], (SELECT COUNT(*) FROM [Items] WHERE [Items].[ContentID]=[Contents].[ContentID]) [ItemCount], (SELECT COUNT(*) FROM [Parts] WHERE [Parts].[ContentID]=[Contents].[ContentID]) [PartCount], (SELECT COUNT(*) FROM [RoUsages] WHERE [RoUsages].[ContentID]=[Contents].[ContentID]) [RoUsageCount], @@ -4792,6 +5034,8 @@ AS [Contents].[LastChanged], (SELECT COUNT(*) FROM [Details] WHERE [Details].[ContentID]=[Contents].[ContentID]) [DetailCount], (SELECT COUNT(*) FROM [Entries] WHERE [Entries].[ContentID]=[Contents].[ContentID]) [EntryCount], + (SELECT COUNT(*) FROM [Grids] WHERE [Grids].[ContentID]=[Contents].[ContentID]) [GridCount], + (SELECT COUNT(*) FROM [Images] WHERE [Images].[ContentID]=[Contents].[ContentID]) [ImageCount], (SELECT COUNT(*) FROM [Items] WHERE [Items].[ContentID]=[Contents].[ContentID]) [ItemCount], (SELECT COUNT(*) FROM [Parts] WHERE [Parts].[ContentID]=[Contents].[ContentID]) [PartCount], (SELECT COUNT(*) FROM [RoUsages] WHERE [RoUsages].[ContentID]=[Contents].[ContentID]) [RoUsageCount], @@ -5975,6 +6219,89 @@ IF (@@Error = 0) PRINT 'Procedure Creation: getFormats Succeeded' ELSE PRINT 'Procedure Creation: getFormats Error on Creation' GO +/****** Object: StoredProcedure [getGrid] ******/ +IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[getGrid]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1) + DROP PROCEDURE [getGrid]; +GO + +CREATE PROCEDURE [dbo].[getGrid] + +( + @ContentID int +) +WITH EXECUTE AS OWNER +AS + SELECT + [ContentID], + [Data], + [Config], + [DTS], + [UserID], + [LastChanged] + FROM [Grids] + WHERE [ContentID]=@ContentID + RETURN +GO +-- Display the status of Proc creation +IF (@@Error = 0) PRINT 'Procedure Creation: getGrid Succeeded' +ELSE PRINT 'Procedure Creation: getGrid Error on Creation' +GO + +/****** Object: StoredProcedure [getGrids] ******/ +IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[getGrids]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1) + DROP PROCEDURE [getGrids]; +GO + +CREATE PROCEDURE [dbo].[getGrids] + +WITH EXECUTE AS OWNER +AS + SELECT + [ContentID], + [Data], + [Config], + [DTS], + [UserID], + [LastChanged] + FROM [Grids] + RETURN +GO +-- Display the status of Proc creation +IF (@@Error = 0) PRINT 'Procedure Creation: getGrids Succeeded' +ELSE PRINT 'Procedure Creation: getGrids Error on Creation' +GO + +/****** Object: StoredProcedure [getGridsByContentID] ******/ +IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[getGridsByContentID]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1) + DROP PROCEDURE [getGridsByContentID]; +GO + +CREATE PROCEDURE [dbo].[getGridsByContentID] + +( + @ContentID int +) +WITH EXECUTE AS OWNER +AS + + SELECT + [Grids].[ContentID], + [Grids].[Data], + [Grids].[Config], + [Grids].[DTS], + [Grids].[UserID], + [Grids].[LastChanged] + FROM [Grids] + WHERE + [Grids].[ContentID]=@ContentID + + RETURN +GO +-- Display the status of Proc creation +IF (@@Error = 0) PRINT 'Procedure Creation: getGridsByContentID Succeeded' +ELSE PRINT 'Procedure Creation: getGridsByContentID Error on Creation' +GO + /****** Object: StoredProcedure [getGroup] ******/ IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[getGroup]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1) DROP PROCEDURE [getGroup]; @@ -6126,6 +6453,95 @@ IF (@@Error = 0) PRINT 'Procedure Creation: getGroups Succeeded' ELSE PRINT 'Procedure Creation: getGroups Error on Creation' GO +/****** Object: StoredProcedure [getImage] ******/ +IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[getImage]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1) + DROP PROCEDURE [getImage]; +GO + +CREATE PROCEDURE [dbo].[getImage] + +( + @ContentID int +) +WITH EXECUTE AS OWNER +AS + SELECT + [ContentID], + [ImageType], + [FileName], + [Data], + [Config], + [DTS], + [UserID], + [LastChanged] + FROM [Images] + WHERE [ContentID]=@ContentID + RETURN +GO +-- Display the status of Proc creation +IF (@@Error = 0) PRINT 'Procedure Creation: getImage Succeeded' +ELSE PRINT 'Procedure Creation: getImage Error on Creation' +GO + +/****** Object: StoredProcedure [getImages] ******/ +IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[getImages]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1) + DROP PROCEDURE [getImages]; +GO + +CREATE PROCEDURE [dbo].[getImages] + +WITH EXECUTE AS OWNER +AS + SELECT + [ContentID], + [ImageType], + [FileName], + [Data], + [Config], + [DTS], + [UserID], + [LastChanged] + FROM [Images] + RETURN +GO +-- Display the status of Proc creation +IF (@@Error = 0) PRINT 'Procedure Creation: getImages Succeeded' +ELSE PRINT 'Procedure Creation: getImages Error on Creation' +GO + +/****** Object: StoredProcedure [getImagesByContentID] ******/ +IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[getImagesByContentID]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1) + DROP PROCEDURE [getImagesByContentID]; +GO + +CREATE PROCEDURE [dbo].[getImagesByContentID] + +( + @ContentID int +) +WITH EXECUTE AS OWNER +AS + + SELECT + [Images].[ContentID], + [Images].[ImageType], + [Images].[FileName], + [Images].[Data], + [Images].[Config], + [Images].[DTS], + [Images].[UserID], + [Images].[LastChanged] + FROM [Images] + WHERE + [Images].[ContentID]=@ContentID + + RETURN +GO +-- Display the status of Proc creation +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]; @@ -8812,6 +9228,8 @@ BEGIN TRY -- Try Block dbcc checkident([Figures],reseed,0) delete from [Folders] dbcc checkident([Folders],reseed,0) + delete from [Grids] + delete from [Images] delete from [Memberships] dbcc checkident([Memberships],reseed,0) delete from [Parts] @@ -9587,6 +10005,57 @@ IF (@@Error = 0) PRINT 'Procedure Creation: updateFormat Succeeded' ELSE PRINT 'Procedure Creation: updateFormat Error on Creation' GO +/****** Object: StoredProcedure [updateGrid] ******/ +IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[updateGrid]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1) + DROP PROCEDURE [updateGrid]; +GO + +CREATE PROCEDURE [dbo].[updateGrid] + +( + @ContentID int, + @Data xml, + @Config xml=null, + @DTS datetime, + @UserID nvarchar(100), + @LastChanged timestamp, + @newLastChanged timestamp output +) +WITH EXECUTE AS OWNER +AS +BEGIN TRY -- Try Block + BEGIN TRANSACTION + UPDATE [Grids] + SET + [Data]=@Data, + [Config]=@Config, + [DTS]=@DTS, + [UserID]=@UserID + WHERE [ContentID]=@ContentID AND [LastChanged]=@LastChanged + IF @@ROWCOUNT = 0 + BEGIN + IF NOT exists(select * from [Grids] WHERE [ContentID]=@ContentID) + RAISERROR('Grid record has been deleted by another user', 16, 1) + ELSE + RAISERROR('Grid has been edited by another user', 16, 1) + END + + SELECT @newLastChanged=[LastChanged] + FROM [Grids] WHERE [ContentID]=@ContentID + + 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: updateGrid Succeeded' +ELSE PRINT 'Procedure Creation: updateGrid Error on Creation' +GO + /****** Object: StoredProcedure [updateGroup] ******/ IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[updateGroup]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1) DROP PROCEDURE [updateGroup]; @@ -9640,6 +10109,61 @@ IF (@@Error = 0) PRINT 'Procedure Creation: updateGroup Succeeded' ELSE PRINT 'Procedure Creation: updateGroup Error on Creation' GO +/****** Object: StoredProcedure [updateImage] ******/ +IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[updateImage]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1) + DROP PROCEDURE [updateImage]; +GO + +CREATE PROCEDURE [dbo].[updateImage] + +( + @ContentID int, + @ImageType int, + @FileName nvarchar(255), + @Data varbinary(MAX), + @Config xml=null, + @DTS datetime, + @UserID nvarchar(100), + @LastChanged timestamp, + @newLastChanged timestamp output +) +WITH EXECUTE AS OWNER +AS +BEGIN TRY -- Try Block + BEGIN TRANSACTION + UPDATE [Images] + SET + [ImageType]=@ImageType, + [FileName]=@FileName, + [Data]=@Data, + [Config]=@Config, + [DTS]=@DTS, + [UserID]=@UserID + WHERE [ContentID]=@ContentID AND [LastChanged]=@LastChanged + IF @@ROWCOUNT = 0 + BEGIN + IF NOT exists(select * from [Images] WHERE [ContentID]=@ContentID) + RAISERROR('Image record has been deleted by another user', 16, 1) + ELSE + RAISERROR('Image has been edited by another user', 16, 1) + END + + SELECT @newLastChanged=[LastChanged] + FROM [Images] WHERE [ContentID]=@ContentID + + 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: updateImage Succeeded' +ELSE PRINT 'Procedure Creation: updateImage Error on Creation' +GO + /****** Object: StoredProcedure [updateItem] ******/ IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[updateItem]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1) DROP PROCEDURE [updateItem]; diff --git a/PROMS/VEPROMS.CSLA.Library/Generated/Content.cs b/PROMS/VEPROMS.CSLA.Library/Generated/Content.cs index afccfb4e..da815ab3 100644 --- a/PROMS/VEPROMS.CSLA.Library/Generated/Content.cs +++ b/PROMS/VEPROMS.CSLA.Library/Generated/Content.cs @@ -400,6 +400,62 @@ namespace VEPROMS.CSLA.Library return _MyEntry; } } + private int _ContentGridCount = 0; + /// + /// Count of ContentGrids for this Content + /// + public int ContentGridCount + { + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)] + get + { + CanReadProperty("ContentGridCount", true); + return _ContentGridCount; + } + } + private Grid _MyGrid = null; + /// + /// Related Field + /// + [TypeConverter(typeof(GridConverter))] + public Grid MyGrid + { + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)] + get + { + CanReadProperty("MyGrid", true); + if (_MyGrid == null) _MyGrid = Grid.New(this); + return _MyGrid; + } + } + private int _ContentImageCount = 0; + /// + /// Count of ContentImages for this Content + /// + public int ContentImageCount + { + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)] + get + { + CanReadProperty("ContentImageCount", true); + return _ContentImageCount; + } + } + private Image _MyImage = null; + /// + /// Related Field + /// + [TypeConverter(typeof(ImageConverter))] + public Image MyImage + { + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)] + get + { + CanReadProperty("MyImage", true); + if (_MyImage == null) _MyImage = Image.New(this); + return _MyImage; + } + } private int _ContentItemCount = 0; /// /// Count of ContentItems for this Content @@ -590,7 +646,7 @@ namespace VEPROMS.CSLA.Library if (base.IsDirty || list.Contains(this)) return base.IsDirty; list.Add(this); - return base.IsDirty || (_ContentDetails == null ? false : _ContentDetails.IsDirtyList(list)) || (_MyEntry == null ? false : _MyEntry.IsDirtyList(list)) || (_ContentItems == null ? false : _ContentItems.IsDirtyList(list)) || (_ContentParts == null ? false : _ContentParts.IsDirtyList(list)) || (_ContentRoUsages == null ? false : _ContentRoUsages.IsDirtyList(list)) || (_ContentTransitions == null ? false : _ContentTransitions.IsDirtyList(list)) || (_MyZContent == null ? false : _MyZContent.IsDirtyList(list)) || (_MyFormat == null ? false : _MyFormat.IsDirtyList(list)); + return base.IsDirty || (_ContentDetails == null ? false : _ContentDetails.IsDirtyList(list)) || (_MyEntry == null ? false : _MyEntry.IsDirtyList(list)) || (_MyGrid == null ? false : _MyGrid.IsDirtyList(list)) || (_MyImage == null ? false : _MyImage.IsDirtyList(list)) || (_ContentItems == null ? false : _ContentItems.IsDirtyList(list)) || (_ContentParts == null ? false : _ContentParts.IsDirtyList(list)) || (_ContentRoUsages == null ? false : _ContentRoUsages.IsDirtyList(list)) || (_ContentTransitions == null ? false : _ContentTransitions.IsDirtyList(list)) || (_MyZContent == null ? false : _MyZContent.IsDirtyList(list)) || (_MyFormat == null ? false : _MyFormat.IsDirtyList(list)); } public override bool IsValid { @@ -601,7 +657,7 @@ namespace VEPROMS.CSLA.Library if(list.Contains(this)) return (IsNew && !IsDirty) ? true : base.IsValid; list.Add(this); - return ((IsNew && !IsDirty) ? true : base.IsValid) && (_ContentDetails == null ? true : _ContentDetails.IsValidList(list)) && (_MyEntry == null ? true : _MyEntry.IsValidList(list)) && (_ContentItems == null ? true : _ContentItems.IsValidList(list)) && (_ContentParts == null ? true : _ContentParts.IsValidList(list)) && (_ContentRoUsages == null ? true : _ContentRoUsages.IsValidList(list)) && (_ContentTransitions == null ? true : _ContentTransitions.IsValidList(list)) && (_MyZContent == null ? true : _MyZContent.IsValidList(list)) && (_MyFormat == null ? true : _MyFormat.IsValidList(list)); + return ((IsNew && !IsDirty) ? true : base.IsValid) && (_ContentDetails == null ? true : _ContentDetails.IsValidList(list)) && (_MyEntry == null ? true : _MyEntry.IsValidList(list)) && (_MyGrid == null ? true : _MyGrid.IsValidList(list)) && (_MyImage == null ? true : _MyImage.IsValidList(list)) && (_ContentItems == null ? true : _ContentItems.IsValidList(list)) && (_ContentParts == null ? true : _ContentParts.IsValidList(list)) && (_ContentRoUsages == null ? true : _ContentRoUsages.IsValidList(list)) && (_ContentTransitions == null ? true : _ContentTransitions.IsValidList(list)) && (_MyZContent == null ? true : _MyZContent.IsValidList(list)) && (_MyFormat == null ? true : _MyFormat.IsValidList(list)); } // CSLATODO: Replace base Content.ToString function as necessary /// @@ -638,6 +694,8 @@ namespace VEPROMS.CSLA.Library if (_ContentItems != null && (hasBrokenRules = _ContentItems.HasBrokenRules) != null) return hasBrokenRules; if (_ContentDetails != null && (hasBrokenRules = _ContentDetails.HasBrokenRules) != null) return hasBrokenRules; if (_MyEntry != null && (hasBrokenRules = _MyEntry.HasBrokenRules) != null) return hasBrokenRules; + if (_MyGrid != null && (hasBrokenRules = _MyGrid.HasBrokenRules) != null) return hasBrokenRules; + if (_MyImage != null && (hasBrokenRules = _MyImage.HasBrokenRules) != null) return hasBrokenRules; if (_ContentParts != null && (hasBrokenRules = _ContentParts.HasBrokenRules) != null) return hasBrokenRules; if (_ContentRoUsages != null && (hasBrokenRules = _ContentRoUsages.HasBrokenRules) != null) return hasBrokenRules; if (_ContentTransitions != null && (hasBrokenRules = _ContentTransitions.HasBrokenRules) != null) return hasBrokenRules; @@ -754,6 +812,8 @@ namespace VEPROMS.CSLA.Library int usedByCount = 0; usedByCount += _ContentDetailCount; usedByCount += _ContentEntryCount; + usedByCount += _ContentGridCount; + usedByCount += _ContentImageCount; usedByCount += _ContentItemCount; usedByCount += _ContentPartCount; usedByCount += _ContentRoUsageCount; @@ -980,6 +1040,8 @@ namespace VEPROMS.CSLA.Library dr.GetBytes("LastChanged", 0, _LastChanged, 0, 8); _ContentDetailCount = dr.GetInt32("DetailCount"); _ContentEntryCount = dr.GetInt32("EntryCount"); + _ContentGridCount = dr.GetInt32("GridCount"); + _ContentImageCount = dr.GetInt32("ImageCount"); _ContentItemCount = dr.GetInt32("ItemCount"); _ContentPartCount = dr.GetInt32("PartCount"); _ContentRoUsageCount = dr.GetInt32("RoUsageCount"); @@ -1023,6 +1085,12 @@ namespace VEPROMS.CSLA.Library _MyEntry = Entry.Get(dr); // load child objects dr.NextResult(); + _MyGrid = Grid.Get(dr); + // load child objects + dr.NextResult(); + _MyImage = Image.Get(dr); + // load child objects + dr.NextResult(); _ContentItems = ContentItems.Get(dr); // load child objects dr.NextResult(); @@ -1113,6 +1181,8 @@ namespace VEPROMS.CSLA.Library if (_ContentItems != null) _ContentItems.Update(this); if (_ContentDetails != null) _ContentDetails.Update(this); if (_MyEntry != null) _MyEntry.Update(this); + if (_MyGrid != null) _MyGrid.Update(this); + if (_MyImage != null) _MyImage.Update(this); if (_ContentParts != null) _ContentParts.Update(this); if (_ContentRoUsages != null) _ContentRoUsages.Update(this); if (_ContentTransitions != null) _ContentTransitions.Update(this); @@ -1227,6 +1297,8 @@ namespace VEPROMS.CSLA.Library if (_ContentItems != null) _ContentItems.Update(this); if (_ContentDetails != null) _ContentDetails.Update(this); if (_MyEntry != null) _MyEntry.Update(this); + if (_MyGrid != null) _MyGrid.Update(this); + if (_MyImage != null) _MyImage.Update(this); if (_ContentParts != null) _ContentParts.Update(this); if (_ContentRoUsages != null) _ContentRoUsages.Update(this); if (_ContentTransitions != null) _ContentTransitions.Update(this); @@ -1254,6 +1326,8 @@ namespace VEPROMS.CSLA.Library if (_ContentItems != null) _ContentItems.Update(this); if (_ContentDetails != null) _ContentDetails.Update(this); if (_MyEntry != null) _MyEntry.Update(this); + if (_MyGrid != null) _MyGrid.Update(this); + if (_MyImage != null) _MyImage.Update(this); if (_ContentParts != null) _ContentParts.Update(this); if (_ContentRoUsages != null) _ContentRoUsages.Update(this); if (_ContentTransitions != null) _ContentTransitions.Update(this); diff --git a/PROMS/VEPROMS.CSLA.Library/Generated/ContentInfo.cs b/PROMS/VEPROMS.CSLA.Library/Generated/ContentInfo.cs index 5517185e..539218da 100644 --- a/PROMS/VEPROMS.CSLA.Library/Generated/ContentInfo.cs +++ b/PROMS/VEPROMS.CSLA.Library/Generated/ContentInfo.cs @@ -265,6 +265,64 @@ namespace VEPROMS.CSLA.Library return _MyEntry; } } + private int _ContentGridCount = 0; + /// + /// Count of ContentGrids for this Content + /// + public int ContentGridCount + { + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)] + get + { + CanReadProperty("ContentGridCount", true); + return _ContentGridCount; + } + } + private GridInfo _MyGrid = null; + [TypeConverter(typeof(GridInfoConverter))] + public GridInfo MyGrid + { + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)] + get + { + CanReadProperty("MyGrid", true); + if (_ContentGridCount != 0 && _MyGrid == null) + { + _MyGrid = GridInfo.Get(_ContentID); + _ContentGridCount = _MyGrid == null ? 0 : 1; + } + return _MyGrid; + } + } + private int _ContentImageCount = 0; + /// + /// Count of ContentImages for this Content + /// + public int ContentImageCount + { + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)] + get + { + CanReadProperty("ContentImageCount", true); + return _ContentImageCount; + } + } + private ImageInfo _MyImage = null; + [TypeConverter(typeof(ImageInfoConverter))] + public ImageInfo MyImage + { + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)] + get + { + CanReadProperty("MyImage", true); + if (_ContentImageCount != 0 && _MyImage == null) + { + _MyImage = ImageInfo.Get(_ContentID); + _ContentImageCount = _MyImage == null ? 0 : 1; + } + return _MyImage; + } + } private int _ContentItemCount = 0; /// /// Count of ContentItems for this Content @@ -538,6 +596,24 @@ namespace VEPROMS.CSLA.Library //RHM Removed 20090724 - Duplicates function of code above. // - Dispose caused error when a new step was added. // - Resequence of transitions did not work properly. +// if(_MyGrid != null) +// { +// _MyGrid.Dispose();// Dispose related value +// _MyGrid = null;// Reset related value +// } + _ContentGridCount = -1;// Reset Count +//RHM Removed 20090724 - Duplicates function of code above. +// - Dispose caused error when a new step was added. +// - Resequence of transitions did not work properly. +// if(_MyImage != null) +// { +// _MyImage.Dispose();// Dispose related value +// _MyImage = null;// Reset related value +// } + _ContentImageCount = -1;// Reset Count +//RHM Removed 20090724 - Duplicates function of code above. +// - Dispose caused error when a new step was added. +// - Resequence of transitions did not work properly. // if(_MyZContent != null) // { // _MyZContent.Dispose();// Dispose related value @@ -583,6 +659,24 @@ namespace VEPROMS.CSLA.Library //RHM Removed 20090724 - Duplicates function of code above. // - Dispose caused error when a new step was added. // - Resequence of transitions did not work properly. +// if(_MyGrid != null) +// { +// _MyGrid.Dispose();// Dispose related value +// _MyGrid = null;// Reset related value +// } + _ContentGridCount = -1;// Reset Count +//RHM Removed 20090724 - Duplicates function of code above. +// - Dispose caused error when a new step was added. +// - Resequence of transitions did not work properly. +// if(_MyImage != null) +// { +// _MyImage.Dispose();// Dispose related value +// _MyImage = null;// Reset related value +// } + _ContentImageCount = -1;// Reset Count +//RHM Removed 20090724 - Duplicates function of code above. +// - Dispose caused error when a new step was added. +// - Resequence of transitions did not work properly. // if(_MyZContent != null) // { // _MyZContent.Dispose();// Dispose related value @@ -656,6 +750,8 @@ namespace VEPROMS.CSLA.Library _UserID = dr.GetString("UserID"); _ContentDetailCount = dr.GetInt32("DetailCount"); _ContentEntryCount = dr.GetInt32("EntryCount"); + _ContentGridCount = dr.GetInt32("GridCount"); + _ContentImageCount = dr.GetInt32("ImageCount"); _ContentItemCount = dr.GetInt32("ItemCount"); _ContentPartCount = dr.GetInt32("PartCount"); _ContentRoUsageCount = dr.GetInt32("RoUsageCount"); diff --git a/PROMS/VEPROMS.CSLA.Library/Generated/PropertyDescriptor.cs b/PROMS/VEPROMS.CSLA.Library/Generated/PropertyDescriptor.cs index 7636660b..a29b1079 100644 --- a/PROMS/VEPROMS.CSLA.Library/Generated/PropertyDescriptor.cs +++ b/PROMS/VEPROMS.CSLA.Library/Generated/PropertyDescriptor.cs @@ -141,6 +141,10 @@ namespace VEPROMS.CSLA.Library // { public override string ToString() { return string.Format("{0}", _Name); } } // public partial class FormatInfo // { public override string ToString() { return string.Format("{0}", _Name); } } +// public partial class Grid +// { public override string ToString() { return string.Format("{0}", _Name); } } +// public partial class GridInfo +// { public override string ToString() { return string.Format("{0}", _Name); } } // public partial class Group // { public override string ToString() { return string.Format("{0}", _Name); } } // public partial class GroupAssignment @@ -149,6 +153,10 @@ namespace VEPROMS.CSLA.Library // { public override string ToString() { return string.Format("{0}", _Name); } } // public partial class GroupInfo // { public override string ToString() { return string.Format("{0}", _Name); } } +// public partial class Image +// { public override string ToString() { return string.Format("{0}", _Name); } } +// public partial class ImageInfo +// { public override string ToString() { return string.Format("{0}", _Name); } } // public partial class Item // { public override string ToString() { return string.Format("{0}", _Name); } } // public partial class ItemAnnotation