-- ================================================================================================================
-- Stored Procedures generated by LLBLGen v1.21.2003.712 Final on Mittwoch, 29. August 2018, 09:03:06
-- For the Low Level Business Logic Layer for the database 'Vertragsverwaltung_20170430'
-- ================================================================================================================
SET NOCOUNT ON
GO
USE [Vertragsverwaltung_20170430]
GO

-- ========================================================================================================
-- [Stored Procedures generated for table:  URLValidate]
GO

-- //// Insert Stored procedure.
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[pr_URLValidate_Insert]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[pr_URLValidate_Insert]
GO

---------------------------------------------------------------------------------
-- Stored procedure that will insert 1 row in the table 'URLValidate'
-- Gets: @sRegel varchar(1024)
-- Gets: @bRegex bit
-- Gets: @bZwingend bit
-- Gets: @bNicht_Erlaubt bit
-- Gets: @sMeldung varchar(1024)
-- Gets: @baktiv bit
-- Gets: @daerstellt_am datetime
-- Gets: @damutiert_am datetime
-- Gets: @imutierer int
-- Returns: @iNrEintrag int
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_URLValidate_Insert]
	@sRegel varchar(1024),
	@bRegex bit,
	@bZwingend bit,
	@bNicht_Erlaubt bit,
	@sMeldung varchar(1024),
	@baktiv bit,
	@daerstellt_am datetime,
	@damutiert_am datetime,
	@imutierer int,
	@iNrEintrag int OUTPUT,
	@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- INSERT a new row in the table.
INSERT [dbo].[URLValidate]
(
	[Regel],
	[Regex],
	[Zwingend],
	[Nicht_Erlaubt],
	[Meldung],
	[aktiv],
	[erstellt_am],
	[mutiert_am],
	[mutierer]
)
VALUES
(
	@sRegel,
	@bRegex,
	@bZwingend,
	@bNicht_Erlaubt,
	@sMeldung,
	@baktiv,
	@daerstellt_am,
	@damutiert_am,
	@imutierer
)
-- Get the Error Code for the statement just executed.
SELECT @iErrorCode=@@ERROR
-- Get the IDENTITY value for the row just inserted.
SELECT @iNrEintrag=SCOPE_IDENTITY()
GO


-- //// Update Stored procedure for updating one single row.
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[pr_URLValidate_Update]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[pr_URLValidate_Update]
GO

---------------------------------------------------------------------------------
-- Stored procedure that will update an existing row in the table 'URLValidate'
-- Gets: @iNrEintrag int
-- Gets: @sRegel varchar(1024)
-- Gets: @bRegex bit
-- Gets: @bZwingend bit
-- Gets: @bNicht_Erlaubt bit
-- Gets: @sMeldung varchar(1024)
-- Gets: @baktiv bit
-- Gets: @daerstellt_am datetime
-- Gets: @damutiert_am datetime
-- Gets: @imutierer int
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_URLValidate_Update]
	@iNrEintrag int,
	@sRegel varchar(1024),
	@bRegex bit,
	@bZwingend bit,
	@bNicht_Erlaubt bit,
	@sMeldung varchar(1024),
	@baktiv bit,
	@daerstellt_am datetime,
	@damutiert_am datetime,
	@imutierer int,
	@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- UPDATE an existing row in the table.
UPDATE [dbo].[URLValidate]
SET 
	[Regel] = @sRegel,
	[Regex] = @bRegex,
	[Zwingend] = @bZwingend,
	[Nicht_Erlaubt] = @bNicht_Erlaubt,
	[Meldung] = @sMeldung,
	[aktiv] = @baktiv,
	[erstellt_am] = @daerstellt_am,
	[mutiert_am] = @damutiert_am,
	[mutierer] = @imutierer
WHERE
	[NrEintrag] = @iNrEintrag
-- Get the Error Code for the statement just executed.
SELECT @iErrorCode=@@ERROR
GO


-- //// Delete Stored procedure using Primary Key.
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[pr_URLValidate_Delete]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[pr_URLValidate_Delete]
GO

---------------------------------------------------------------------------------
-- Stored procedure that will delete an existing row from the table 'URLValidate'
-- using the Primary Key. 
-- Gets: @iNrEintrag int
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_URLValidate_Delete]
	@iNrEintrag int,
	@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- DELETE an existing row from the table.
DELETE FROM [dbo].[URLValidate]
WHERE
	[NrEintrag] = @iNrEintrag
-- Get the Error Code for the statement just executed.
SELECT @iErrorCode=@@ERROR
GO


-- //// Select Stored procedure, based on Primary Key.
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[pr_URLValidate_SelectOne]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[pr_URLValidate_SelectOne]
GO

---------------------------------------------------------------------------------
-- Stored procedure that will select an existing row from the table 'URLValidate'
-- based on the Primary Key.
-- Gets: @iNrEintrag int
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_URLValidate_SelectOne]
	@iNrEintrag int,
	@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- SELECT an existing row from the table.
SELECT
	[NrEintrag],
	[Regel],
	[Regex],
	[Zwingend],
	[Nicht_Erlaubt],
	[Meldung],
	[aktiv],
	[erstellt_am],
	[mutiert_am],
	[mutierer]
FROM [dbo].[URLValidate]
WHERE
	[NrEintrag] = @iNrEintrag
-- Get the Error Code for the statement just executed.
SELECT @iErrorCode=@@ERROR
GO


-- //// Select All Stored procedure.
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[pr_URLValidate_SelectAll]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[pr_URLValidate_SelectAll]
GO

---------------------------------------------------------------------------------
-- Stored procedure that will select all rows from the table 'URLValidate'
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_URLValidate_SelectAll]
	@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- SELECT all rows from the table.
SELECT
	[NrEintrag],
	[Regel],
	[Regex],
	[Zwingend],
	[Nicht_Erlaubt],
	[Meldung],
	[aktiv],
	[erstellt_am],
	[mutiert_am],
	[mutierer]
FROM [dbo].[URLValidate]
ORDER BY 
	[NrEintrag] ASC
-- Get the Error Code for the statement just executed.
SELECT @iErrorCode=@@ERROR
GO


-- [End of Stored Procedures for table:     URLValidate]
-- ========================================================================================================
GO
