155 lines
5.0 KiB
C#
155 lines
5.0 KiB
C#
using MP.Core.Objects;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel.DataAnnotations;
|
|
|
|
namespace MP.Data.DTO
|
|
{
|
|
public class IobDTO
|
|
{
|
|
#region Public Constructors
|
|
|
|
/// <summary>
|
|
/// Costruttore da dati completi x Macchine
|
|
/// </summary>
|
|
/// <param name="recMacc"></param>
|
|
/// <param name="iobInfo"></param>
|
|
/// <param name="macInfo"></param>
|
|
public IobDTO(DbModels.MacchineModel recMacc, IOB_data iobInfo, Dictionary<string, string> macInfo)
|
|
{
|
|
this.IdxMacchina = recMacc.IdxMacchina;
|
|
this.CodMacchina = recMacc.CodMacchina;
|
|
this.Nome = recMacc.Nome;
|
|
this.Descrizione = recMacc.Descrizione;
|
|
this.Note = recMacc.Note ?? "";
|
|
this.Locazione = recMacc.locazione ?? "";
|
|
this.OS = $"{iobInfo.iType}";
|
|
this.IobName = iobInfo.name;
|
|
this.IobIpv4 = iobInfo.IP;
|
|
this.IobMac = "";
|
|
if (macInfo != null && macInfo.Count > 0)
|
|
{
|
|
this.AdapName = macInfo.ContainsKey("IobExe") ? macInfo["IobExe"] : "";
|
|
this.AdapType = macInfo.ContainsKey("IobType") ? macInfo["IobType"] : "";
|
|
this.AdapVers = macInfo.ContainsKey("IobVersion") ? macInfo["IobVersion"] : "";
|
|
this.TargetIp = macInfo.ContainsKey("MachIp") ? macInfo["MachIp"] : "";
|
|
this.TargetPort = macInfo.ContainsKey("MachPort") ? macInfo["MachPort"] : "";
|
|
}
|
|
this.IsMachine = true;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Costruttore empty di default
|
|
/// </summary>
|
|
public IobDTO()
|
|
{ }
|
|
|
|
/// <summary>
|
|
/// Costruttore da dati RemoteRebootLog e info incomplete
|
|
/// </summary>
|
|
/// <param name="recRRL"></param>
|
|
/// <param name="iobInfo"></param>
|
|
/// <param name="macInfo"></param>
|
|
public IobDTO(DbModels.RemoteRebootLogModel recRRL, IOB_data iobInfo, Dictionary<string, string> macInfo)
|
|
{
|
|
this.IdxMacchina = recRRL.IdxMacchina;
|
|
this.Locazione = "NA";
|
|
this.OS = $"{iobInfo.iType}";
|
|
this.IobName = recRRL.Agent;
|
|
this.IobIpv4 = recRRL.IPv4;
|
|
this.IobMac = recRRL.MacAddr;
|
|
if (macInfo != null && macInfo.Count > 0)
|
|
{
|
|
this.AdapName = macInfo.ContainsKey("IobExe") ? macInfo["IobExe"] : "";
|
|
this.AdapType = macInfo.ContainsKey("IobType") ? macInfo["IobType"] : "";
|
|
this.AdapVers = macInfo.ContainsKey("IobVersion") ? macInfo["IobVersion"] : "";
|
|
this.TargetIp = macInfo.ContainsKey("MachIp") ? macInfo["MachIp"] : "";
|
|
this.TargetPort = macInfo.ContainsKey("MachPort") ? macInfo["MachPort"] : "";
|
|
}
|
|
this.IsMachine = false;
|
|
}
|
|
|
|
#endregion Public Constructors
|
|
|
|
#region Public Properties
|
|
|
|
/// <summary>
|
|
/// Nome Adapter
|
|
/// </summary>
|
|
public string AdapName { get; set; } = "";
|
|
|
|
/// <summary>
|
|
/// Sottotipo Adapter
|
|
/// </summary>
|
|
public string AdapType { get; set; } = "";
|
|
|
|
/// <summary>
|
|
/// Versione Adapter
|
|
/// </summary>
|
|
public string AdapVers { get; set; } = "";
|
|
|
|
/// <summary>
|
|
/// Cod macchina
|
|
/// </summary>
|
|
public string CodMacchina { get; set; } = "";
|
|
|
|
/// <summary>
|
|
/// Descrizione macchina
|
|
/// </summary>
|
|
public string Descrizione { get; set; } = "";
|
|
|
|
[Key]
|
|
public string IdxMacchina { get; set; } = "";
|
|
|
|
/// <summary>
|
|
/// IP v4 PC Iob
|
|
/// </summary>
|
|
public string IobIpv4 { get; set; } = "";
|
|
|
|
/// <summary>
|
|
/// Mac address IOB
|
|
/// </summary>
|
|
public string IobMac { get; set; } = "";
|
|
|
|
/// <summary>
|
|
/// Nome PC Iob
|
|
/// </summary>
|
|
public string IobName { get; set; } = "";
|
|
|
|
/// <summary>
|
|
/// Indica se sia una macchina effettiva vs Extra da RemoteRebootLog (es PING, ENR, ...)
|
|
/// </summary>
|
|
public bool IsMachine { get; set; } = true;
|
|
|
|
/// <summary>
|
|
/// Locazione (usata per nascondere in SITE/Tab)
|
|
/// </summary>
|
|
public string Locazione { get; set; } = "";
|
|
|
|
/// <summary>
|
|
/// Nome macchina
|
|
/// </summary>
|
|
public string Nome { get; set; } = "";
|
|
|
|
/// <summary>
|
|
/// Descrizione macchina
|
|
/// </summary>
|
|
public string Note { get; set; } = "";
|
|
|
|
/// <summary>
|
|
/// Tipo di IOB (Win / rPi / Python)
|
|
/// </summary>
|
|
public string OS { get; set; } = "";
|
|
|
|
/// <summary>
|
|
/// IP del target CNC/PLC
|
|
/// </summary>
|
|
public string TargetIp { get; set; } = "";
|
|
|
|
/// <summary>
|
|
/// Porta del target CNC/PLC
|
|
/// </summary>
|
|
public string TargetPort { get; set; } = "";
|
|
|
|
#endregion Public Properties
|
|
}
|
|
} |