public void Post(ErrorLog log) { if (ModelState.IsValid) { LogDA.Insert(log); } }
private void LogError(string exMsg) { try { #region *** Get Class Name & Method Name *** System.Diagnostics.StackTrace st = new System.Diagnostics.StackTrace(); string methodName = "", className = ""; int indxStack = 1; while (methodName == "" || methodName == "SetError") { methodName = st.GetFrame(indxStack).GetMethod().Name; className = st.GetFrame(indxStack).GetMethod().DeclaringType.FullName; indxStack++; } exMsg += "\r\n\r\n Class : " + className + "\r\n\r\n Method : " + methodName; #endregion Log log = new Log(); LogDA logDA = new LogDA(); log.ExceptionMessage = exMsg; logDA.Insert(log); } catch (System.Exception exc) { AddFileException(exc); } }
public static void LogError(string exception) { Dictionary <string, dynamic> parameters = new Dictionary <string, dynamic>(); parameters.Add(nameof(exception), exception); LogDA.LogError(parameters); }
public List <Log> GetLogList() { var logDA = new LogDA(_configuration); var listLog = logDA.GetLogList(); logDA.Dispose(); return(listLog); }
public static void Log(string service, string input, string output) { Dictionary <string, dynamic> parameters = new Dictionary <string, dynamic>(); parameters.Add(nameof(service), service); parameters.Add(nameof(input), input); parameters.Add(nameof(output), output); LogDA.Log(parameters); }
public Response InsertLogEvent(Log log) { var response = new Response { Result = false, Message = "Sin inicializar" }; try { if (log.Application == null) { response.Message = "Debe de inicializar el objeto Application."; return(response); } var applicationDA = new ApplicationDA(_configuration); var applicationDbList = applicationDA.GetApplicationList(); applicationDA.Dispose(); var appFinded = applicationDbList.Find(app => app.ApplicationName == log.Application.ApplicationName); if (appFinded == null) { response.Message = "La aplicación no existe en SeguridadApp."; return(response); } log.Application = appFinded; if (log.EventUser == null) { response.Message = "Debe de inicializar el objeto EventUser"; return(response); } string[] usuarioEncontrar = log.EventUser.UserId.Split(' '); var userLogic = new UserLogic(_configuration); User userFinded = userLogic.FindUser(usuarioEncontrar[0]); userLogic.Dispose(); if (userFinded == null) { response.Message = "La cuenta de usuario no existe en SeguridadApp."; return(response); } log.EventUser = userFinded; var logDa = new LogDA(_configuration); logDa.AddLogEvent(log); logDa.Dispose(); response.Message = "Se registró correctamente el evento en la bitácora"; response.Result = true; return(response); } catch (Exception err) { response.Message = string.Format("Ocurrió un error al intentar realizar el registro en bitácora. {0}", err.Message); return(response); } }
public int GetTotalSesstionCount(IConnectionHandler connectionHandler, string url) { var da = new LogDA(connectionHandler); return(da.GetTotalSesstionCount(url)); }
public int GetSesstionCountBetweenDate(IConnectionHandler connectionHandler, string url, string minDate, string maxDate) { var da = new LogDA(connectionHandler); return(da.GetSesstionCountBetweenDate(url, minDate, maxDate)); }
public int GetDateSesstionCount(IConnectionHandler connectionHandler, string url, string date) { var da = new LogDA(connectionHandler); return(da.GetDateSesstionCount(url, date)); }
// GET: LogView public ActionResult Index() { return(View(LogDA.Get())); }