Exemplo n.º 1
0
 public void Post(ErrorLog log)
 {
     if (ModelState.IsValid)
     {
         LogDA.Insert(log);
     }
 }
Exemplo n.º 2
0
        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);
            }
        }
Exemplo n.º 3
0
        public static void LogError(string exception)
        {
            Dictionary <string, dynamic> parameters = new Dictionary <string, dynamic>();

            parameters.Add(nameof(exception), exception);
            LogDA.LogError(parameters);
        }
Exemplo n.º 4
0
        public List <Log> GetLogList()
        {
            var logDA   = new LogDA(_configuration);
            var listLog = logDA.GetLogList();

            logDA.Dispose();
            return(listLog);
        }
Exemplo n.º 5
0
        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);
        }
Exemplo n.º 6
0
        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);
            }
        }
Exemplo n.º 7
0
        public int GetTotalSesstionCount(IConnectionHandler connectionHandler, string url)
        {
            var da = new LogDA(connectionHandler);

            return(da.GetTotalSesstionCount(url));
        }
Exemplo n.º 8
0
        public int GetSesstionCountBetweenDate(IConnectionHandler connectionHandler, string url, string minDate, string maxDate)
        {
            var da = new LogDA(connectionHandler);

            return(da.GetSesstionCountBetweenDate(url, minDate, maxDate));
        }
Exemplo n.º 9
0
        public int GetDateSesstionCount(IConnectionHandler connectionHandler, string url, string date)
        {
            var da = new LogDA(connectionHandler);

            return(da.GetDateSesstionCount(url, date));
        }
Exemplo n.º 10
0
 // GET: LogView
 public ActionResult Index()
 {
     return(View(LogDA.Get()));
 }