using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Text;
using System.IO;
using System.Text.RegularExpressions;
using System.Web.UI.HtmlControls;
public partial class View_TrainingPartner_ManageInvoice_InvoiceInbox : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
try
{
BLL_LoginAudit objAudit = new BLL_LoginAudit();
objAudit.Transction(new BO_LoginAuditMaster
{
Login_action = "I",
Login_Action_Type = "Invoice Inbox Page",
Login_Audit_id = 0,
Login_Date_Time = DateTime.Now,
Login_IP_Address = LuminiousUtility.Util.Utility.VisitorIPAddress(),
Login_Module_Name = "Training Partner",
Login_Section_Name = LuminiousUtility.Util.Utility.BrowserDetection(),
Login_Status = "No PAN found",
Login_User_Name = Convert.ToString(Session["trainingpartnercode"]),
Login_User_Type = 5//Convert.ToInt32(ddluserType.SelectedValue)
});
}
catch (Exception ee)
{
ExceptionHandler.WriteException(ee.Message);
}
}
}
-----------------------------------
BLL_LoginAudit.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.SqlClient;
/// <summary>
/// Summary description for BLL_LoginAudit
/// </summary>
public class BLL_LoginAudit
{
public BLL_LoginAudit()
{
//
// TODO: Add constructor logic here
//
}
public int Transction(BO_LoginAuditMaster bo)
{
int? result = null;
try
{
SqlParameter[] para = {
new SqlParameter("@Login_Audit_id",bo.Login_Audit_id),
new SqlParameter("@Login_User_Name",bo.Login_User_Name),
new SqlParameter("@Login_User_Type",bo.Login_User_Type),
new SqlParameter("@Login_IP_Address",bo.Login_IP_Address),
new SqlParameter("@Login_Module_Name",bo.Login_Module_Name),
new SqlParameter("@Login_Section_Name",bo.Login_Section_Name),
new SqlParameter("@Login_Action_Type",bo.Login_Action_Type),
new SqlParameter("@Login_Date_Time",bo.Login_Date_Time),
new SqlParameter("@Login_Status",bo.Login_Status),
new SqlParameter("@IUD",bo.Login_action)
};
result = Luminious.DataAcessLayer.SqlHelper.ExecuteNonQuery(Luminious.Connection.Configuration.ConnectionString, "USP_IUD_LOGIN_AUDIT", para);
return 0;
}
catch (System.Data.SqlClient.SqlException)
{
return 0;
}
catch (Exception)
{
return 0;
}
}
}
-------------------------------
BO_LoginAuditMaster.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
/// <summary>
/// Summary description for BO_LoginAuditMaster
/// </summary>
public class BO_LoginAuditMaster
{
public BO_LoginAuditMaster()
{
Login_Audit_id = null;
Login_User_Name = null;
Login_User_Type = null;
Login_IP_Address = null;
Login_Module_Name = null;
Login_Section_Name = null;
Login_Action_Type = null;
Login_Date_Time = null;
Login_Status = null;
Login_action = null;
}
public int ? Login_Audit_id { get; set; }
public string Login_User_Name { get; set; }
public int ? Login_User_Type { get; set; }
public string Login_IP_Address { get; set; }
public string Login_Module_Name { get; set; }
public string Login_Section_Name { get; set; }
public string Login_Action_Type { get; set; }
public DateTime ? Login_Date_Time { get; set; }
public string Login_Status { get; set; }
public string Login_action { set; get; }
}
------------------------------------
Stored procedure USP_IUD_LOGIN_AUDIT
USE [ESDM_NIELIT_NEW]
GO
/****** Object: StoredProcedure [dbo].[USP_IUD_LOGIN_AUDIT] Script Date: 27-05-2022 12:02:53 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[USP_IUD_LOGIN_AUDIT]
(
@Login_Audit_id INT = NULL
,@Login_User_Name VARCHAR(150)
,@Login_User_Type INT = NULL
,@Login_IP_Address VARCHAR(50) =NULL
,@Login_Module_Name VARCHAR(50) = NULL
,@Login_Section_Name VARCHAR(50) = NULL
,@Login_Action_Type VARCHAR(50) = NULL
,@Login_Date_Time DATETIME = NULL
,@Login_Status VARCHAR(10)
,@IUD CHAR(1)
)
AS
BEGIN
BEGIN TRY
BEGIN TRAN
IF @IUD = 'I'
BEGIN
SELECT @Login_Audit_id = ISNULL(MAX(Login_Audit_id),0) + 1 FROM MST_LOGIN_AUDIT
INSERT INTO MST_LOGIN_AUDIT
(
Login_Audit_id
,Login_User_Name
,Login_User_Type
,Login_IP_Address
,Login_Module_Name
,Login_Section_Name
,Login_Action_Type
,Login_Date_Time
,Login_Status
)
VALUES
(
@Login_Audit_id
,@Login_User_Name
,@Login_User_Type
,@Login_IP_Address
,@Login_Module_Name
,@Login_Section_Name
,@Login_Action_Type
,@Login_Date_Time
,@Login_Status
)
END ;
ELSE IF @IUD ='U'
BEGIN
UPDATE MST_LOGIN_AUDIT
SET Login_User_Name = CASE WHEN @Login_User_Name IS NULL THEN Login_User_Name ELSE @Login_User_Name END
,Login_User_Type = CASE WHEN @Login_User_Type IS NULL THEN Login_User_Type ELSE @Login_User_Type END
,Login_IP_Address = CASE WHEN @Login_IP_Address IS NULL THEN Login_IP_Address ELSE @Login_IP_Address END
,Login_Module_Name = CASE WHEN @Login_Module_Name IS NULL THEN Login_Module_Name ELSE @Login_Module_Name END
,Login_Section_Name = CASE WHEN @Login_Section_Name IS NULL THEN Login_Section_Name ELSE @Login_Section_Name END
,Login_Action_Type = CASE WHEN @Login_Action_Type IS NULL THEN Login_Action_Type ELSE @Login_Action_Type END
,Login_Date_Time = CASE WHEN @Login_Date_Time IS NULL THEN Login_Date_Time ELSE @Login_Date_Time END
,Login_Status = CASE WHEN @Login_Status IS NULL THEN Login_Status ELSE @Login_Status END
WHERE Login_Audit_id = @Login_Audit_id
END
ELSE IF @IUD ='D'
BEGIN
DELETE FROM MST_LOGIN_AUDIT WHERE Login_Audit_id = @Login_Audit_id;
END;
COMMIT;
END TRY
BEGIN CATCH
ROLLBACK;
END CATCH;
END
GO
No comments:
Post a Comment