Listing E
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
 
 
CREATE PROCEDURE WSB2B_CONFIRM_ORDER
 
 
@paramOrderId        int,
@paramOrderStatus    nvarchar(20)
 
 
AS
 
 
SET NOCOUNT ON
 
 
UPDATE [ORDER] SET ORDER_STATUS=@paramOrderStatus
WHERE ORDER_ID=@paramOrderId
 
 
SELECT CUSTOMER_ID FROM [ORDER] WITH(NOLOCK) WHERE ORDER_ID=@paramOrderId
 
 
SET NOCOUNT OFF
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
 
 
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS OFF
GO
 
 
CREATE PROCEDURE WSB2B_CREATE_CUSTOMER
 
 
@paramEmail          nvarchar(50),
@paramPassword             nvarchar(12),
@paramFirstName            nvarchar(25) = NULL,
@paramLastName             nvarchar(25) = NULL
 
 
AS
 
 
SET NOCOUNT ON
 
 
INSERT INTO CUSTOMER (EMAIL, [PASSWORD], FIRST_NAME, LAST_NAME)
VALUES(@paramEmail, @paramPassword, @paramFirstName, @paramLastName)
 
 
SET NOCOUNT OFF
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
 
 
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
 
 
CREATE PROCEDURE WSB2B_CREATE_ORDER
 
 
@paramCustomerId           int,
@paramOrderStatus          nvarchar(20)
 
 
AS
 
 
SET NOCOUNT ON
 
 
INSERT INTO [ORDER] (CUSTOMER_ID, ORDER_STATUS)
VALUES(@paramCustomerId, @paramOrderStatus)
 
 
SELECT SCOPE_IDENTITY() AS ORDER_ID
 
 
SET NOCOUNT OFF
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
 
 
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
 
 
CREATE PROCEDURE WSB2B_DELETE_ORDER
 
 
@paramOrderId        int
 
 
AS
 
 
SET NOCOUNT ON
 
 
DELETE FROM [ORDER] WHERE ORDER_ID=@paramOrderId
 
 
SET NOCOUNT OFF
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
 
 
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
 
 
CREATE PROCEDURE WSB2B_GET_CUSTOMER
 
 
@paramEmail          nvarchar(50),
@paramPassword             nvarchar(12)
 
 
AS
 
 
SET NOCOUNT ON
 
 
SELECT CUSTOMER_ID, EMAIL, FIRST_NAME, LAST_NAME FROM CUSTOMER WITH(NOLOCK)
WHERE EMAIL=@paramEmail
AND [PASSWORD]=@paramPassword
 
 
SET NOCOUNT OFF
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
 
 
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
 
 
CREATE PROCEDURE WSB2B_GET_CUSTOMER_BY_ID
 
 
@paramCustomerId           int
 
 
AS
 
 
SET NOCOUNT ON
 
 
SELECT CUSTOMER_ID, EMAIL, FIRST_NAME, LAST_NAME FROM CUSTOMER WITH(NOLOCK)
WHERE CUSTOMER_ID=@paramCustomerId
 
 
SET NOCOUNT OFF
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
 
 
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS OFF
GO
 
 
CREATE PROCEDURE WSB2B_GET_ORDERS_BY_CUSTOMER
 
 
@paramCustomerId     int,
@paramOrderStatus    nvarchar(20)
 
 
AS
 
 
SET NOCOUNT ON
 
 
SELECT ORDER_ID, CREATION_DATE FROM [ORDER] WITH(NOLOCK)
WHERE CUSTOMER_ID=@paramCustomerId
AND ORDER_STATUS=@paramOrderStatus
 
 
SET NOCOUNT OFF
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO