135 lines
6.3 KiB
C#
135 lines
6.3 KiB
C#
//using System;
|
|
//using System.Collections.Generic;
|
|
//using System.Configuration;
|
|
//using System.Data;
|
|
//using System.Linq;
|
|
//using System.Web;
|
|
//using Microsoft.Practices.EnterpriseLibrary.Logging;
|
|
////using DBHelper;
|
|
////using MySql.Data;
|
|
////using MySql.Data.MySqlClient;
|
|
|
|
//namespace GODATA.Models.AuditLog
|
|
//{
|
|
// /// <summary>
|
|
// /// This class contain method used for manipulate audit details
|
|
// /// </summary>
|
|
// public class AuditLogRepository
|
|
// {
|
|
|
|
// #region Global Variables
|
|
// /// <summary>
|
|
// /// Represent object of datatable
|
|
// /// </summary>
|
|
// DataTable objDt;
|
|
|
|
// /// <summary>
|
|
// /// Represent string object contain database connection string
|
|
// /// </summary>
|
|
// string _connStr = ConfigurationManager.ConnectionStrings["ApplicationServices"].ConnectionString;
|
|
// #endregion
|
|
|
|
// #region Methods
|
|
|
|
// /// <summary>
|
|
// /// Get Audit Details with date filter
|
|
// /// </summary>
|
|
// /// <param name="fromDate">Represent date time object contain from date for calculate revenue amount
|
|
// /// e.g. 01 Apr 2013 </param>
|
|
// /// <param name="ToDate">Represent datetime object contain to date for calculate revenue amount
|
|
// /// e.g. 30 Apr 2013 </param>
|
|
// /// <returns>Dataset of Audit Details</returns>
|
|
// public DataSet GetAuditDetailDataset(DateTime fromDate, DateTime ToDate)
|
|
// {
|
|
// MySqlParameter[] mySqlParam = new MySqlParameter[2];
|
|
// mySqlParam[0] = new MySqlParameter("fromdate", fromDate);
|
|
// mySqlParam[1] = new MySqlParameter("todate", ToDate);
|
|
// DataSet ds = MySqlDBHelper.ExecuteDataset(_connStr, CommandType.StoredProcedure, "sp_get_audit_detail_datewise", mySqlParam);
|
|
// return ds;
|
|
// }
|
|
|
|
// /// <summary>
|
|
// /// Get Audit Details with paging
|
|
// /// </summary>
|
|
// /// <param name="fromDate">Represent date time object contain from date for calculate revenue amount
|
|
// /// e.g. 01 Apr 2013 </param>
|
|
// /// <param name="ToDate">Represent datetime object contain to date for calculate revenue amount
|
|
// /// e.g. 30 Apr 2013 </param>
|
|
// /// <param name="limit">data limit per page</param>
|
|
// /// <param name="offSet">off set</param>
|
|
// /// <returns>Dataset of Audit Details</returns>
|
|
// public DataSet GetAuditDetailDataset(DateTime fromDate, DateTime ToDate, int limit, int offSet)
|
|
// {
|
|
// MySqlParameter[] mySqlParam = new MySqlParameter[4];
|
|
// mySqlParam[0] = new MySqlParameter("fromdate", fromDate);
|
|
// mySqlParam[1] = new MySqlParameter("todate", ToDate);
|
|
// mySqlParam[2] = new MySqlParameter("limt", limit);
|
|
// mySqlParam[3] = new MySqlParameter("off_set", offSet);
|
|
|
|
// DataSet ds = MySqlDBHelper.ExecuteDataset(_connStr, CommandType.StoredProcedure, "sp_get_audit_detail_datewise_pagewise", mySqlParam);
|
|
// return ds;
|
|
// }
|
|
|
|
// /// <summary>
|
|
// /// This method is used to retrive audit detail between given dates
|
|
// /// </summary>
|
|
// /// <param name="fromDate">Represent date time object contain from date for calculate revenue amount
|
|
// /// e.g. 01 Apr 2013 </param>
|
|
// /// <param name="ToDate">Represent datetime object contain to date for calculate revenue amount
|
|
// /// e.g. 30 Apr 2013 </param>
|
|
// /// <returns>List of Audit Details</returns>
|
|
// public List<AuditModel> GetAuditDetailDateWise(DateTime fromDate, DateTime ToDate, int limit, int offSet)
|
|
// {
|
|
// try
|
|
// {
|
|
// //Intialize data table object
|
|
// objDt = new DataTable();
|
|
// //Create list type object of auditmodel class
|
|
// List<AuditModel> objListAuditModel = new List<AuditModel>();
|
|
// //Retrieve data from database between given date
|
|
// DataSet ds = GetAuditDetailDataset(fromDate, ToDate, limit, offSet);
|
|
// //insert data in datatable object
|
|
// objDt.Merge(ds.Tables[0]);
|
|
|
|
// //Arrange data in list type object of audit model class
|
|
// objListAuditModel = objDt.AsEnumerable().Select(s => new AuditModel
|
|
// {
|
|
// SessionID = s.Field<string>("sessionid"),
|
|
// // AuditID = s.Field<Guid>("auditid"),
|
|
// ControllerName = s.Field<string>("controllername"),
|
|
// InputParameters = s.Field<string>("inputparameters"),
|
|
// IPAddress = s.Field<string>("ipaddress"),
|
|
// MethodName = s.Field<string>("methodname"),
|
|
// TimeAccessed = s.Field<DateTime>("timeaccessed").AddMinutes(Convert.ToInt32(ConfigurationManager.AppSettings["UTC"])),
|
|
// URLAccessed = s.Field<string>("urlaccessed"),
|
|
// UserName = s.Field<string>("username")
|
|
// }).ToList();
|
|
|
|
// return objListAuditModel;
|
|
// }
|
|
// catch (Exception Ex)
|
|
// {
|
|
// Logger.Write(Ex.Message + Ex.StackTrace, "AuditRepository - GetAuditDetailDateWise");
|
|
// throw new Exception(Ex.Message);
|
|
// }
|
|
// }
|
|
|
|
// /// <summary>
|
|
// /// Get Audit Details data count
|
|
// /// </summary>
|
|
// /// <param name="fromDate">Represent date time object contain from date for calculate revenue amount
|
|
// /// e.g. 01 Apr 2013 </param>
|
|
// /// <param name="ToDate">Represent datetime object contain to date for calculate revenue amount
|
|
// /// e.g. 30 Apr 2013 </param>
|
|
// /// <returns>Returns total count of Audit Details Dataset</returns>
|
|
// public Int32 GetCountAuditDetail(DateTime fromDate, DateTime ToDate)
|
|
// {
|
|
// MySqlParameter[] mySqlParam = new MySqlParameter[2];
|
|
// mySqlParam[0] = new MySqlParameter("fromdate", fromDate);
|
|
// mySqlParam[1] = new MySqlParameter("todate", ToDate);
|
|
// DataSet ds = MySqlDBHelper.ExecuteDataset(_connStr, CommandType.StoredProcedure, "sp_count_audit_detail_datewise", mySqlParam);
|
|
// return Convert.ToInt32(ds.Tables[0].Rows[0][0].ToString());
|
|
// }
|
|
// #endregion
|
|
// }
|
|
//} |