-- ================================================================================================================
-- Stored Procedures generated by LLBLGen v1.21.2003.712 Final on Samstag, 16. Januar 2021, 08:03:58
-- 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:  Application]
GO

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

---------------------------------------------------------------------------------
-- Stored procedure that will insert 1 row in the table 'Application'
-- Gets: @iapplikationsnr int
-- Gets: @sversion varchar(4)
-- Gets: @bshowlogin bit
-- Gets: @imandantnr int
-- Gets: @baktiv bit
-- Gets: @daerstellt_am datetime
-- Gets: @damutiert_am datetime
-- Gets: @imutierer int
-- Gets: @stmp_filepath varchar(255)
-- Gets: @sTag_Externe_MA varchar(255)
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_Application_Insert]
	@iapplikationsnr int,
	@sversion varchar(4),
	@bshowlogin bit,
	@imandantnr int,
	@baktiv bit,
	@daerstellt_am datetime,
	@damutiert_am datetime,
	@imutierer int,
	@stmp_filepath varchar(255),
	@sTag_Externe_MA varchar(255),
	@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- INSERT a new row in the table.
INSERT [dbo].[Application]
(
	[applikationsnr],
	[version],
	[showlogin],
	[mandantnr],
	[aktiv],
	[erstellt_am],
	[mutiert_am],
	[mutierer],
	[tmp_filepath],
	[Tag_Externe_MA]
)
VALUES
(
	@iapplikationsnr,
	@sversion,
	@bshowlogin,
	@imandantnr,
	@baktiv,
	@daerstellt_am,
	@damutiert_am,
	@imutierer,
	@stmp_filepath,
	@sTag_Externe_MA
)
-- 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_Application_Update]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[pr_Application_Update]
GO

---------------------------------------------------------------------------------
-- Stored procedure that will update an existing row in the table 'Application'
-- Gets: @iapplikationsnr int
-- Gets: @sversion varchar(4)
-- Gets: @bshowlogin bit
-- Gets: @imandantnr int
-- Gets: @baktiv bit
-- Gets: @daerstellt_am datetime
-- Gets: @damutiert_am datetime
-- Gets: @imutierer int
-- Gets: @stmp_filepath varchar(255)
-- Gets: @sTag_Externe_MA varchar(255)
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_Application_Update]
	@iapplikationsnr int,
	@sversion varchar(4),
	@bshowlogin bit,
	@imandantnr int,
	@baktiv bit,
	@daerstellt_am datetime,
	@damutiert_am datetime,
	@imutierer int,
	@stmp_filepath varchar(255),
	@sTag_Externe_MA varchar(255),
	@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- UPDATE an existing row in the table.
UPDATE [dbo].[Application]
SET 
	[version] = @sversion,
	[showlogin] = @bshowlogin,
	[mandantnr] = @imandantnr,
	[aktiv] = @baktiv,
	[erstellt_am] = @daerstellt_am,
	[mutiert_am] = @damutiert_am,
	[mutierer] = @imutierer,
	[tmp_filepath] = @stmp_filepath,
	[Tag_Externe_MA] = @sTag_Externe_MA
WHERE
	[applikationsnr] = @iapplikationsnr
-- 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_Application_Delete]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[pr_Application_Delete]
GO

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

---------------------------------------------------------------------------------
-- Stored procedure that will select an existing row from the table 'Application'
-- based on the Primary Key.
-- Gets: @iapplikationsnr int
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_Application_SelectOne]
	@iapplikationsnr int,
	@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- SELECT an existing row from the table.
SELECT
	[applikationsnr],
	[version],
	[showlogin],
	[mandantnr],
	[aktiv],
	[erstellt_am],
	[mutiert_am],
	[mutierer],
	[tmp_filepath],
	[Tag_Externe_MA]
FROM [dbo].[Application]
WHERE
	[applikationsnr] = @iapplikationsnr
-- 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_Application_SelectAll]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[pr_Application_SelectAll]
GO

---------------------------------------------------------------------------------
-- Stored procedure that will select all rows from the table 'Application'
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_Application_SelectAll]
	@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- SELECT all rows from the table.
SELECT
	[applikationsnr],
	[version],
	[showlogin],
	[mandantnr],
	[aktiv],
	[erstellt_am],
	[mutiert_am],
	[mutierer],
	[tmp_filepath],
	[Tag_Externe_MA]
FROM [dbo].[Application]
ORDER BY 
	[applikationsnr] ASC
-- Get the Error Code for the statement just executed.
SELECT @iErrorCode=@@ERROR
GO


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