feat: se agregan logs, y se hacen cambios en el modulo registrar mediciones
This commit is contained in:
parent
5bd9c2a1a6
commit
4b6204d9e7
32 changed files with 648 additions and 625 deletions
|
@ -1,10 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Shared.DTO.Envios_DGA
|
||||
namespace Shared.DTO.Envios_DGA
|
||||
{
|
||||
public class LogMedicionScada
|
||||
{
|
||||
|
|
|
@ -1,10 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Shared.DTO.Envios_DGA
|
||||
namespace Shared.DTO.Envios_DGA
|
||||
{
|
||||
public class MedicionScada
|
||||
{
|
||||
|
@ -27,6 +21,6 @@ namespace Shared.DTO.Envios_DGA
|
|||
|
||||
public decimal? Nivel { get; set; }
|
||||
|
||||
public string? TipoEmpresa { get; set; }
|
||||
public string? tipo_empresa { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,10 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Shared.DTO.Envios_DGA
|
||||
namespace Shared.DTO.Envios_DGA
|
||||
{
|
||||
public class MedicionSubterraneaRequest
|
||||
{
|
||||
|
@ -26,5 +20,7 @@ namespace Shared.DTO.Envios_DGA
|
|||
public string HoraMedicion { get; set; }
|
||||
public string NivelFreaticoDelPozo { get; set; }
|
||||
public string Totalizador { get; set; }
|
||||
public string? TipoEmpresa { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Shared.DTO.Integracion_DGA;
|
||||
namespace Shared.DTO.Integracion_DGA;
|
||||
|
||||
public partial class DgaMacroResultado
|
||||
{
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Shared.DTO.Integracion_DGA;
|
||||
namespace Shared.DTO.Integracion_DGA;
|
||||
|
||||
public partial class DgaMacroResultadoSupFluj
|
||||
{
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Shared.DTO.Integracion_DGA;
|
||||
namespace Shared.DTO.Integracion_DGA;
|
||||
|
||||
public partial class DgaMacroResultadoSupFlujSuma
|
||||
{
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Shared.DTO.Integracion_DGA;
|
||||
namespace Shared.DTO.Integracion_DGA;
|
||||
|
||||
public partial class DgaMacroResultadoVilos
|
||||
{
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Shared.DTO.Integracion_DGA;
|
||||
namespace Shared.DTO.Integracion_DGA;
|
||||
|
||||
public partial class DgaSensorResultado
|
||||
{
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Shared.DTO.Integracion_DGA;
|
||||
namespace Shared.DTO.Integracion_DGA;
|
||||
|
||||
public partial class DgaSensorResultadoVilos
|
||||
{
|
||||
|
|
|
@ -1,10 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Shared.DTO.Integracion_DGA
|
||||
namespace Shared.DTO.Integracion_DGA
|
||||
{
|
||||
public class DocumentResponse
|
||||
{
|
||||
|
|
|
@ -1,10 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Shared.DTO.Integracion_DGA
|
||||
namespace Shared.DTO.Integracion_DGA
|
||||
{
|
||||
public class HistoricRequest
|
||||
{
|
||||
|
|
|
@ -1,10 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Shared.DTO.Integracion_DGA
|
||||
namespace Shared.DTO.Integracion_DGA
|
||||
{
|
||||
public class HistoricResponse
|
||||
{
|
||||
|
|
|
@ -1,10 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Shared.DTO.Integracion_DGA
|
||||
namespace Shared.DTO.Integracion_DGA
|
||||
{
|
||||
public class TagviewsResponse
|
||||
{
|
||||
|
|
|
@ -1,10 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Shared.DTO.VariablesEntorno
|
||||
namespace Shared.DTO.VariablesEntorno
|
||||
{
|
||||
public static class BdConexion
|
||||
{
|
||||
|
|
|
@ -1,14 +1,9 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Shared.DTO.VariablesEntorno
|
||||
namespace Shared.DTO.VariablesEntorno
|
||||
{
|
||||
public static class CredencialDGA
|
||||
{
|
||||
public static string RutEmpresa { get; set; } = string.Empty;
|
||||
public static string RutEsval { get; set; } = string.Empty;
|
||||
public static string RutAv { get; set; } = string.Empty;
|
||||
public static string RutUsuario { get; set; } = string.Empty;
|
||||
public static string Password { get; set; } = string.Empty;
|
||||
}
|
||||
|
|
|
@ -1,10 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Shared.DTO.VariablesEntorno
|
||||
namespace Shared.DTO.VariablesEntorno
|
||||
{
|
||||
public static class NexusApiUrl
|
||||
{
|
||||
|
|
|
@ -1,10 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Shared.DTO.VariablesEntorno
|
||||
namespace Shared.DTO.VariablesEntorno
|
||||
{
|
||||
public static class SubterraneaApiUrl
|
||||
{
|
||||
|
|
|
@ -3,27 +3,27 @@ using Serilog;
|
|||
|
||||
namespace Shared.Helper
|
||||
{
|
||||
public class FileLoggerHelper
|
||||
{
|
||||
public static void ConfigureLogger(IConfiguration configuration)
|
||||
public class FileLoggerHelper
|
||||
{
|
||||
var logFilePath = configuration.GetSection("Logging:LogFile:Path").Value;
|
||||
var logFileFullPath = Path.Combine(Directory.GetCurrentDirectory(), logFilePath);
|
||||
public static void ConfigureLogger(IConfiguration configuration)
|
||||
{
|
||||
var logFilePath = configuration.GetSection("Logging:LogFile:Path").Value;
|
||||
var logFileFullPath = Path.Combine(Directory.GetCurrentDirectory(), logFilePath);
|
||||
|
||||
Log.Logger = new LoggerConfiguration()
|
||||
.ReadFrom.Configuration(configuration)
|
||||
.WriteTo.File(logFileFullPath, rollingInterval: RollingInterval.Day)
|
||||
.CreateLogger();
|
||||
}
|
||||
Log.Logger = new LoggerConfiguration()
|
||||
.ReadFrom.Configuration(configuration)
|
||||
.WriteTo.File(logFileFullPath, rollingInterval: RollingInterval.Day)
|
||||
.CreateLogger();
|
||||
}
|
||||
|
||||
public static void LogInformation(string message)
|
||||
{
|
||||
Log.Information($"{message}");
|
||||
}
|
||||
public static void LogInformation(string message)
|
||||
{
|
||||
Log.Information($"{message}");
|
||||
}
|
||||
|
||||
public static void LogError(string message, Exception ex)
|
||||
{
|
||||
Log.Error(ex, message);
|
||||
public static void LogError(string message, Exception ex)
|
||||
{
|
||||
Log.Error(ex, message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Shared.DTO.VariablesEntorno;
|
||||
using Shared.DTO.VariablesEntorno;
|
||||
|
||||
namespace Shared.Utils
|
||||
{
|
||||
|
@ -34,8 +29,11 @@ namespace Shared.Utils
|
|||
{
|
||||
var dictEnv = GetVarEnviromentDict(env);
|
||||
|
||||
dictEnv.TryGetValue("RUTEMPRESA", out string? rutEmpresa);
|
||||
CredencialDGA.RutEmpresa = rutEmpresa ?? string.Empty;
|
||||
dictEnv.TryGetValue("RUTESVAL", out string? rutEsval);
|
||||
CredencialDGA.RutEsval = rutEsval ?? string.Empty;
|
||||
|
||||
dictEnv.TryGetValue("RUTAV", out string? rutAv);
|
||||
CredencialDGA.RutAv = rutAv ?? string.Empty;
|
||||
|
||||
dictEnv.TryGetValue("RUTUSUARIO", out string? rutUsuario);
|
||||
CredencialDGA.RutUsuario = rutUsuario ?? string.Empty;
|
||||
|
@ -79,5 +77,33 @@ namespace Shared.Utils
|
|||
dictEnv.TryGetValue("ENDPOINT", out string? endpoint);
|
||||
SubterraneaApiUrl.EndPoint = endpoint ?? string.Empty;
|
||||
}
|
||||
|
||||
public static void ValidarVariablesEntorno()
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(CredencialDGA.RutEsval))
|
||||
throw new Exception("La propiedad CredencialDGA.RutEsval está vacía o nula.");
|
||||
if (string.IsNullOrWhiteSpace(CredencialDGA.RutAv))
|
||||
throw new Exception("La propiedad CredencialDGA.RutAv está vacía o nula.");
|
||||
if (string.IsNullOrWhiteSpace(CredencialDGA.RutUsuario))
|
||||
throw new Exception("La propiedad CredencialDGA.RutUsuario está vacía o nula.");
|
||||
if (string.IsNullOrWhiteSpace(CredencialDGA.Password))
|
||||
throw new Exception("La propiedad CredencialDGA.Password está vacía o nula.");
|
||||
if (string.IsNullOrWhiteSpace(NexusApiUrl.ApiUrl))
|
||||
throw new Exception("La propiedad NexusApiUrl.ApiUrl está vacía o nula.");
|
||||
if (string.IsNullOrWhiteSpace(NexusApiUrl.ApiKey))
|
||||
throw new Exception("La propiedad NexusApiUrl.ApiKey está vacía o nula.");
|
||||
if (string.IsNullOrWhiteSpace(NexusApiUrl.Version))
|
||||
throw new Exception("La propiedad NexusApiUrl.Version está vacía o nula.");
|
||||
if (string.IsNullOrWhiteSpace(NexusApiUrl.DataSource))
|
||||
throw new Exception("La propiedad NexusApiUrl.DataSource está vacía o nula.");
|
||||
if (string.IsNullOrWhiteSpace(NexusApiUrl.Resolution))
|
||||
throw new Exception("La propiedad NexusApiUrl.Resolution está vacía o nula.");
|
||||
if (string.IsNullOrWhiteSpace(BdConexion.StringConnection))
|
||||
throw new Exception("La propiedad BdConexion.StringConnection está vacía o nula.");
|
||||
if (string.IsNullOrWhiteSpace(SubterraneaApiUrl.BaseUrl))
|
||||
throw new Exception("La propiedad SubterraneaApiUrl.BaseUrl está vacía o nula.");
|
||||
if (string.IsNullOrWhiteSpace(SubterraneaApiUrl.EndPoint))
|
||||
throw new Exception("La propiedad SubterraneaApiUrl.EndPoint está vacía o nula.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue