public async Task InsertLog(Summary summary, LogActionEnum action) { if (summary != null) { try { var sysLog = new SysSqlLog { Action = action.ToString(), EmpNo = summary.SvcNo, EmpName = summary.EmpNameM, DateTime = DateTimeOffset.Now, Host = summary.HostIP }; _context.SysSqlLogs.Add(sysLog); await _context.SaveChangesAsync(); } catch (Exception exeption) { throw new Exception("Insert log failed", exeption); } } }
public static BIException ConvertToBIException(this Exception ex, LogActionEnum logAction, LogTypeEnum logType, string title, string sourceMethod, string user, string server, string additionalMessage = null) { return(new BIException { ApplicationName = Utility.ApplicationName, LogAction = logAction, LogType = logType, Message = ex.Message + " - Additional Info: " + additionalMessage, StackTrace = ex.StackTrace, Title = title, User = user, Server = server, Source = sourceMethod }); }