spAddUpdate_ImageAlbum
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@PKID | int | INOUT | |
@DisplayName | nvarchar(50) | IN | |
@Location | nvarchar(50) | IN | |
@Description | nvarchar(255) | IN | |
@AlbumType | int | IN | |
@AlbumArtImageID | int | IN | |
@OwnerUserID | int | IN | |
@Deleted | bit | IN | |
@DeletedDate | datetime | IN | |
@DeletedUserID | int | IN | |
@IsDefault | bit | IN | |
@Security | int | IN |
Definition
Copy
CREATE PROCEDURE [dbo].[spAddUpdate_ImageAlbum]
(
@PKID int output,
@DisplayName nvarchar(50),
@Location nvarchar(50),
@Description nvarchar(255),
@AlbumType int,
@AlbumArtImageID int,
@OwnerUserID int,
@Deleted bit,
@DeletedDate datetime,
@DeletedUserID int,
@IsDefault bit,
@Security int
)
AS
BEGIN
IF (@PKID<=0)
BEGIN
INSERT INTO [ImageAlbum]
(
[DisplayName],
[Location],
[Description],
[AlbumType],
[AlbumArtImageID],
[OwnerUserID],
[Deleted],
[DeletedDate],
[DeletedUserID],
[IsDefault],
[Security]
)
VALUES
(
@DisplayName,
@Location,
@Description,
@AlbumType,
@AlbumArtImageID,
@OwnerUserID,
@Deleted,
@DeletedDate,
@DeletedUserID,
@IsDefault,
@Security
)
SELECT @PKID = @@Identity
END
ELSE
UPDATE [ImageAlbum] SET
[DisplayName] = @DisplayName,
[Location] = @Location,
[Description] = @Description,
[AlbumType] = @AlbumType,
[AlbumArtImageID] = @AlbumArtImageID,
[OwnerUserID] = @OwnerUserID,
[UpdateDate] = getutcdate(),
[Deleted] = @Deleted,
[DeletedDate] = @DeletedDate,
[DeletedUserID] = @DeletedUserID,
[IsDefault] = @IsDefault,
[Security] = @Security
WHERE [ID]=@PKID
IF @Deleted = 1
BEGIN
UPDATE SiteImages SET Deleted = 1 WHERE ID IN (SELECT SiteImageID FROM ImageAlbum_Images WHERE ImageAlbumID = @PKID)
END
END