-- ================================================================================================================
-- Stored Procedures generated by LLBLGen v1.21.2003.712 Final on Sonntag, 21. April 2013, 14:42:54
-- For the Low Level Business Logic Layer for the database 'Themenmanagement'
-- ================================================================================================================
SET NOCOUNT ON
GO
USE TIM
GO

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

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

---------------------------------------------------------------------------------
-- Stored procedure that will insert 1 row in the table 'Pendenz'
-- Gets: @iPendenzNr int
-- Gets: @iThemanr int
-- Gets: @sVerantwortlich varchar(50)
-- Gets: @iPendenzStatusNr int
-- Gets: @sBezeichnung varchar(50)
-- Gets: @sBeschreibung varchar(255)
-- Gets: @daTermin datetime
-- Gets: @bAktiv bit
-- Gets: @daErstellt_am datetime
-- Gets: @daMutiert_am datetime
-- Gets: @iMutierer int
-- Gets: @iMandantNr int
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_Pendenz_Insert]
	@iPendenzNr int,
	@iThemanr int,
	@sVerantwortlich varchar(50),
	@iPendenzStatusNr int,
	@sBezeichnung varchar(50),
	@sBeschreibung varchar(255),
	@daTermin datetime,
	@bAktiv bit,
	@daErstellt_am datetime,
	@daMutiert_am datetime,
	@iMutierer int,
	@iMandantNr int,
	@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- INSERT a new row in the table.
INSERT [dbo].[Pendenz]
(
	[PendenzNr],
	[Themanr],
	[Verantwortlich],
	[PendenzStatusNr],
	[Bezeichnung],
	[Beschreibung],
	[Termin],
	[Aktiv],
	[Erstellt_am],
	[Mutiert_am],
	[Mutierer],
	[MandantNr]
)
VALUES
(
	@iPendenzNr,
	@iThemanr,
	@sVerantwortlich,
	@iPendenzStatusNr,
	@sBezeichnung,
	@sBeschreibung,
	@daTermin,
	@bAktiv,
	@daErstellt_am,
	@daMutiert_am,
	@iMutierer,
	@iMandantNr
)
-- Get the Error Code for the statement just executed.
SELECT @iErrorCode=@@ERROR
GO


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

---------------------------------------------------------------------------------
-- Stored procedure that will update an existing row in the table 'Pendenz'
-- Gets: @iPendenzNr int
-- Gets: @iThemanr int
-- Gets: @sVerantwortlich varchar(50)
-- Gets: @iPendenzStatusNr int
-- Gets: @sBezeichnung varchar(50)
-- Gets: @sBeschreibung varchar(255)
-- Gets: @daTermin datetime
-- Gets: @bAktiv bit
-- Gets: @daErstellt_am datetime
-- Gets: @daMutiert_am datetime
-- Gets: @iMutierer int
-- Gets: @iMandantNr int
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_Pendenz_Update]
	@iPendenzNr int,
	@iThemanr int,
	@sVerantwortlich varchar(50),
	@iPendenzStatusNr int,
	@sBezeichnung varchar(50),
	@sBeschreibung varchar(255),
	@daTermin datetime,
	@bAktiv bit,
	@daErstellt_am datetime,
	@daMutiert_am datetime,
	@iMutierer int,
	@iMandantNr int,
	@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- UPDATE an existing row in the table.
UPDATE [dbo].[Pendenz]
SET 
	[Themanr] = @iThemanr,
	[Verantwortlich] = @sVerantwortlich,
	[PendenzStatusNr] = @iPendenzStatusNr,
	[Bezeichnung] = @sBezeichnung,
	[Beschreibung] = @sBeschreibung,
	[Termin] = @daTermin,
	[Aktiv] = @bAktiv,
	[Erstellt_am] = @daErstellt_am,
	[Mutiert_am] = @daMutiert_am,
	[Mutierer] = @iMutierer,
	[MandantNr] = @iMandantNr
WHERE
	[PendenzNr] = @iPendenzNr
-- 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_Pendenz_Delete]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[pr_Pendenz_Delete]
GO

---------------------------------------------------------------------------------
-- Stored procedure that will delete an existing row from the table 'Pendenz'
-- using the Primary Key. 
-- Gets: @iPendenzNr int
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_Pendenz_Delete]
	@iPendenzNr int,
	@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- DELETE an existing row from the table.
DELETE FROM [dbo].[Pendenz]
WHERE
	[PendenzNr] = @iPendenzNr
-- 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_Pendenz_SelectOne]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[pr_Pendenz_SelectOne]
GO

---------------------------------------------------------------------------------
-- Stored procedure that will select an existing row from the table 'Pendenz'
-- based on the Primary Key.
-- Gets: @iPendenzNr int
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_Pendenz_SelectOne]
	@iPendenzNr int,
	@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- SELECT an existing row from the table.
SELECT
	[PendenzNr],
	[Themanr],
	[Verantwortlich],
	[PendenzStatusNr],
	[Bezeichnung],
	[Beschreibung],
	[Termin],
	[Aktiv],
	[Erstellt_am],
	[Mutiert_am],
	[Mutierer],
	[MandantNr]
FROM [dbo].[Pendenz]
WHERE
	[PendenzNr] = @iPendenzNr
-- 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_Pendenz_SelectAll]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[pr_Pendenz_SelectAll]
GO

---------------------------------------------------------------------------------
-- Stored procedure that will select all rows from the table 'Pendenz'
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_Pendenz_SelectAll]
	@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- SELECT all rows from the table.
SELECT
	[PendenzNr],
	[Themanr],
	[Verantwortlich],
	[PendenzStatusNr],
	[Bezeichnung],
	[Beschreibung],
	[Termin],
	[Aktiv],
	[Erstellt_am],
	[Mutiert_am],
	[Mutierer],
	[MandantNr]
FROM [dbo].[Pendenz]
ORDER BY 
	[PendenzNr] ASC
-- Get the Error Code for the statement just executed.
SELECT @iErrorCode=@@ERROR
GO


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