spTransactions_InsertVolunteer
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@VolunteerOpID | int | IN | |
@UserID | int | IN | |
@XMLData | ntext | IN | |
@BackOfficeUserID | int | IN | |
@EmailJobRecipientID | int | IN |
Definition
Copy
CREATE PROCEDURE [dbo].[spTransactions_InsertVolunteer]
(
@VolunteerOpID int,
@UserID int,
@XMLData ntext,
@BackOfficeUserID int,
@EmailJobRecipientID int
)
AS
BEGIN
IF DATALENGTH(@XMLData) < 8
BEGIN
RAISERROR ('Unable to insert transaction - VolunteerTransaction.XMLObjectData cannot be a zero-length string and must be well formed XML', 16, 1)
RETURN 0
END
begin Tran
IF @UserID = 0 SET @UserID = NULL
if @EmailJobRecipientID <= 0 set @EmailJobRecipientID = NULL
INSERT INTO dbo.VolunteerTransactions
(
VolunteerOpID,
AddedBy,
XMLObjectData,
[EmailJobRecipientID]
)
VALUES
(
@VolunteerOpID,
@UserID,
@XMLData,
@EmailJobRecipientID
)
--This will save the transaction into the BBNCTransactions Table
Declare @BBNCTransactionsPKID int
Set @BBNCTransactionsPKID = 0
Declare @TransactionPKID int
Set @TransactionPKID = SCOPE_IDENTITY()
Declare @TransactionType nvarchar(100)
Set @TransactionType = '{02B000B6-179F-4c0f-A2DE-6856DCD5D964}'
exec spTransactions_InsertTransaction @BBNCTransactionsPKID, @TransactionPKID, @TransactionType, @XMLData, @UserID, @BackOfficeUserID
if @@error = 0
begin
commit tran
return @TransactionPKID
end
else
begin
rollback tran
return 0
end
END