-- ================================================================================================================
-- Stored Procedures generated by LLBLGen v1.21.2003.712 Final on Montag, 17. Mai 2021, 17:24:52
-- For the Low Level Business Logic Layer for the database 'beA_PROD'
-- ================================================================================================================
SET NOCOUNT ON
GO
USE [beA_PROD]
GO

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

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

---------------------------------------------------------------------------------
-- Stored procedure that will insert 1 row in the table 'MailTexte'
-- Gets: @iid int
-- Gets: @sBeschreibung varchar(255)
-- Gets: @sBetreff varchar(255)
-- Gets: @sInhalt varchar(2048)
-- Gets: @daerstellt_am datetime
-- Gets: @damutiert_am datetime
-- Gets: @imutierer int
-- Gets: @baktiv bit
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_MailTexte_Insert]
	@iid int,
	@sBeschreibung varchar(255),
	@sBetreff varchar(255),
	@sInhalt varchar(2048),
	@daerstellt_am datetime,
	@damutiert_am datetime,
	@imutierer int,
	@baktiv bit,
	@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- INSERT a new row in the table.
INSERT [dbo].[MailTexte]
(
	[id],
	[Beschreibung],
	[Betreff],
	[Inhalt],
	[erstellt_am],
	[mutiert_am],
	[mutierer],
	[aktiv]
)
VALUES
(
	@iid,
	@sBeschreibung,
	@sBetreff,
	@sInhalt,
	@daerstellt_am,
	@damutiert_am,
	@imutierer,
	@baktiv
)
-- 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_MailTexte_Update]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[pr_MailTexte_Update]
GO

---------------------------------------------------------------------------------
-- Stored procedure that will update an existing row in the table 'MailTexte'
-- Gets: @iid int
-- Gets: @sBeschreibung varchar(255)
-- Gets: @sBetreff varchar(255)
-- Gets: @sInhalt varchar(2048)
-- Gets: @daerstellt_am datetime
-- Gets: @damutiert_am datetime
-- Gets: @imutierer int
-- Gets: @baktiv bit
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_MailTexte_Update]
	@iid int,
	@sBeschreibung varchar(255),
	@sBetreff varchar(255),
	@sInhalt varchar(2048),
	@daerstellt_am datetime,
	@damutiert_am datetime,
	@imutierer int,
	@baktiv bit,
	@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- UPDATE an existing row in the table.
UPDATE [dbo].[MailTexte]
SET 
	[Beschreibung] = @sBeschreibung,
	[Betreff] = @sBetreff,
	[Inhalt] = @sInhalt,
	[erstellt_am] = @daerstellt_am,
	[mutiert_am] = @damutiert_am,
	[mutierer] = @imutierer,
	[aktiv] = @baktiv
WHERE
	[id] = @iid
-- 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_MailTexte_Delete]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[pr_MailTexte_Delete]
GO

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

---------------------------------------------------------------------------------
-- Stored procedure that will select an existing row from the table 'MailTexte'
-- based on the Primary Key.
-- Gets: @iid int
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_MailTexte_SelectOne]
	@iid int,
	@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- SELECT an existing row from the table.
SELECT
	[id],
	[Beschreibung],
	[Betreff],
	[Inhalt],
	[erstellt_am],
	[mutiert_am],
	[mutierer],
	[aktiv]
FROM [dbo].[MailTexte]
WHERE
	[id] = @iid
-- 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_MailTexte_SelectAll]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[pr_MailTexte_SelectAll]
GO

---------------------------------------------------------------------------------
-- Stored procedure that will select all rows from the table 'MailTexte'
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_MailTexte_SelectAll]
	@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- SELECT all rows from the table.
SELECT
	[id],
	[Beschreibung],
	[Betreff],
	[Inhalt],
	[erstellt_am],
	[mutiert_am],
	[mutierer],
	[aktiv]
FROM [dbo].[MailTexte]
ORDER BY 
	[id] ASC
-- Get the Error Code for the statement just executed.
SELECT @iErrorCode=@@ERROR
GO


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