spAddUpdate_GivingHistory

Parameters

Parameter Parameter Type Mode Description
@PKID int INOUT
@GivingHistoryName nvarchar(510) IN
@Message nvarchar(2048) IN
@Guid uniqueidentifier IN
@SiteContentID int IN
@GiftTypes ntext IN
@Campaigns ntext IN
@Funds ntext IN
@Appeals ntext IN
@ExcludeSC bit IN
@SCtext nvarchar(255) IN

Definition

Copy


CREATE  PROCEDURE dbo.spAddUpdate_GivingHistory
                (
                    @PKID                int output        ,
                    @GivingHistoryName    nvarchar(510)    ,
                    @Message            nvarchar(2048)    ,
                    @Guid                uniqueidentifier,
                    @SiteContentID        int                ,
                    @GiftTypes            ntext            ,
                    @Campaigns            ntext            ,
                    @Funds                ntext            ,
                    @Appeals            ntext            ,
                    @ExcludeSC            bit,
                    @SCtext                nvarchar(255)
                )
                AS

                begin transaction

                if (@PKID<=0)

                begin

                    INSERT INTO GivingHistory
                    (
                    GivingHistoryName    ,
                    [Message]            ,
                    Guid                ,
                    SiteContentID        ,
                    GiftTypes            ,
                    Campaigns            ,
                    Funds                ,
                    Appeals                ,
                    ExcludeSC    ,
                    SCtext
                    )

                    VALUES
                    (
                    @GivingHistoryName    ,
                    @Message            ,
                    @Guid                ,
                    @SiteContentID        ,
                    @GiftTypes            ,
                    @Campaigns            ,
                    @Funds                ,
                    @Appeals            ,
                    @ExcludeSC            ,
                    @SCtext
                    )

                    SELECT @PKID = @@Identity


                end 
                else 
                begin

                    UPDATE GivingHistory SET
                        GivingHistoryName    =@GivingHistoryName    ,
                        [Message]            =@Message            ,
                        Guid                =@Guid                ,
                        SiteContentID        =@SiteContentID        ,
                        GiftTypes            =@GiftTypes            ,
                        Campaigns            =@Campaigns            ,
                        Funds                =@Funds                ,
                        Appeals                =@Appeals            ,
                        ExcludeSC            =@ExcludeSC            ,
                        SCtext                =@SCtext

                    WHERE ID=@PKID

                end

                commit transaction