spAddUpdate_ClientMerchantAccounts

Parameters

Parameter Parameter Type Mode Description
@PKID int INOUT
@Name nvarchar(100) IN
@Active bit IN
@ClientsID int IN
@XMLTransactionInfo xml IN
@BBPSID uniqueidentifier IN
@CLIENTSITESID int IN

Definition

Copy

CREATE   PROCEDURE [dbo].[spAddUpdate_ClientMerchantAccounts]
(
@PKID            int output,
@Name             nvarchar(100),
@Active            bit,
@ClientsID        int,
@XMLTransactionInfo xml,
@BBPSID            uniqueidentifier,
@CLIENTSITESID int = 0
)
AS

if @CLIENTSITESID <= 0
    select @CLIENTSITESID = Value from dbo.Setting where ID = 1

if (@PKID<=0) begin
    if (@BBPSID = '00000000-0000-0000-0000-000000000000')
        set @BBPSID = null;

    INSERT INTO [ClientMerchantAccounts]
    (    [Name], 
        [Active], 
        [ClientsID], 
        [XMLTransactionInfo],
        [BBPSID],
        [CLIENTSITESID]) 
    VALUES 
    (    @Name,        
        @Active,
        @ClientsID,        
        @XMLTransactionInfo,
        @BBPSID,
        @CLIENTSITESID)

    SELECT @PKID = @@Identity
    end
else begin
    UPDATE [dbo].[ClientMerchantAccounts]
    SET 
        [Name]            = @Name
        [Active]        = @Active
        [BBPSID]        = @BBPSID,
        [XMLTransactionInfo] = @XMLTransactionInfo,
        [CLIENTSITESID] = @CLIENTSITESID
    WHERE ID=@PKID                
end