Exemplo n.º 1
0
 protected async Task <WebApiEntity.UDSLog> InsertLogAsync(WebApiEntity.UDSLog log)
 {
     try
     {
         return(await _webApiClient.PostEntityAsync(log));
     }
     catch (Exception ex)
     {
         _logger.WriteError(ex, LogCategories);
         throw ex;
     }
 }
Exemplo n.º 2
0
        protected WebApiEntity.UDSLog MapLog(UDSLogModel localLog)
        {
            WebApiEntity.UDSLog webApiLog = new WebApiEntity.UDSLog
            {
                IdUDS            = localLog.UDSId,
                LogDescription   = localLog.LogDescription,
                RegistrationDate = localLog.LogDate,
                SystemComputer   = localLog.SystemComputer,
                RegistrationUser = localLog.SystemUser,
                LogType          = (WebApiEntity.UDSLogType)Enum.Parse(typeof(WebApiEntity.UDSLogType), localLog.LogType.ToString())
            };

            return(webApiLog);
        }
Exemplo n.º 3
0
        protected async Task InsertLogAsync(UDSEntityModel model, Guid udsRepositoryId, int environment)
        {
            if (model == null || model.Logs == null || !model.Logs.Any())
            {
                return;
            }

            try
            {
                foreach (UDSLogModel log in model.Logs)
                {
                    WebApiEntity.UDSLog webApiLog = MapLog(log);
                    webApiLog.Entity      = new WebApiEntity.UDSRepository(udsRepositoryId);
                    webApiLog.Environment = environment;
                    await InsertLogAsync(webApiLog);
                }
            }
            catch (Exception ex)
            {
                _logger.WriteError(new LogMessage(string.Format("InsertLogAsync -> Errore in inserimento log: {0}", ex.Message)), LogCategories);
                throw ex;
            }
        }