CREATE PROCEDURE [dbo].[AddTraderFeedback]
	@knokId			bigint,
	@userId			bigint,
	@AccountId		bigint,
	@FeedbackType int,
	@Comment VARCHAR,
	@Clear int null

AS
DECLARE		@TranStarted		BIT,
			@ERROR				SMALLINT,
			@RC					INT,
			@ErrorMessage		VARCHAR(100)
			


	
BEGIN TRY  
	SET @TranStarted = 0 
	SET @RC	 = 0 

	BEGIN TRANSACTION
	SET @TranStarted = 1

		


	Insert [TraderFeedbacks] 
	([KnokId]
      ,[UserId]
      ,[FeedbackType]
      ,[Comment]
      ,[Clear]
      ,[Educational ]
      ,[Comprehensive ]
      ,[KnokBenefit]
      ,[KnokserFeedback]) VALUES(@userId, @knokId, GETDATE()) -- failure on errors
	IF( @TranStarted = 1 )    
	COMMIT TRANSACTION  
END TRY 
BEGIN CATCH  
	IF( @TranStarted = 1 )    
	ROLLBACK TRANSACTION  
	
	EXEC USP_LogError            
	EXEC USP_RethrowError                       
   
	IF @RC = 0
		SET @RC = 1   ---- Unexpected Error	   
		                     
	RETURN @RC                        
END CATCH
