namespace IStation.Application
|
{
|
/// <summary>
|
///
|
/// </summary>
|
public class MonitorFullLogicalTreeDto : Yw.Application.LogicalTreeDto
|
{
|
/// <summary>
|
///
|
/// </summary>
|
public MonitorFullLogicalTreeDto() { }
|
|
/// <summary>
|
///
|
/// </summary>
|
public MonitorFullLogicalTreeDto(Model.AirpSite rhs)
|
{
|
this.Id = $"{IStation.DataType.AirpSite}_{rhs.ID}";
|
this.ParentId = string.Empty;
|
this.LogicalName = rhs.Name;
|
this.LogicalType = DataType.AirpSite;
|
this.LogicalID = rhs.ID;
|
this.LogicalModel = null;
|
this.SortCode = rhs.SortCode;
|
this.Description = rhs.Description;
|
this.Children = new List<LogicalTreeDto>();
|
}
|
|
/// <summary>
|
///
|
/// </summary>
|
public MonitorFullLogicalTreeDto(Yw.Model.MonitorPointGroup rhs)
|
{
|
this.Id = $"{Yw.Monitor.DataType.MonitorPointGroup}_{rhs.ID}";
|
this.ParentId = $"{Yw.Monitor.DataType.MonitorPointGroup}_{rhs.ParentIds.LastOrDefault()}";
|
this.LogicalName = rhs.Name;
|
this.LogicalType = Yw.Monitor.DataType.MonitorPointGroup;
|
this.LogicalID = rhs.ID;
|
this.LogicalModel = null;
|
this.SortCode = rhs.SortCode;
|
this.Description = rhs.Description;
|
this.Children = new List<LogicalTreeDto>();
|
}
|
|
/// <summary>
|
///
|
/// </summary>
|
public MonitorFullLogicalTreeDto(Yw.Model.MonitorPointGroup rhs, List<Yw.Model.MonitorPoint_Signal_SignalType> monitorList)
|
{
|
this.Id = $"{Yw.Monitor.DataType.MonitorPointGroup}_{rhs.ID}";
|
this.ParentId = $"{Yw.Monitor.DataType.MonitorPointGroup}_{rhs.ParentIds.LastOrDefault()}";
|
this.LogicalName = rhs.Name;
|
this.LogicalType = Yw.Monitor.DataType.MonitorPointGroup;
|
this.LogicalID = rhs.ID;
|
this.LogicalModel = null;
|
this.SortCode = rhs.SortCode;
|
this.Description = rhs.Description;
|
this.Children = new List<LogicalTreeDto>();
|
|
if (monitorList != null && monitorList.Count > 0)
|
{
|
foreach (var monitor in monitorList)
|
{
|
var child = new MonitorFullLogicalTreeDto(monitor);
|
child.ParentId = this.Id;
|
this.Children.Add(child);
|
}
|
}
|
}
|
|
/// <summary>
|
///
|
/// </summary>
|
public MonitorFullLogicalTreeDto(Yw.Model.MonitorPoint_Signal_SignalType rhs)
|
{
|
if (rhs.SignalList.Count == 1)
|
{
|
var signal = rhs.SignalList[0];
|
this.Id = $"{Yw.Monitor.DataType.Signal}_{signal.ID}";
|
this.ParentId = $"{Yw.Monitor.DataType.MonitorPointGroup}_{rhs.GroupID}";
|
this.LogicalName = rhs.Name;
|
this.LogicalType = Yw.Monitor.DataType.Signal;
|
this.LogicalID = signal.ID;
|
this.LogicalModel = null;
|
this.SortCode = rhs.SortCode;
|
this.Description = rhs.Description;
|
this.Children = new List<LogicalTreeDto>();
|
}
|
else
|
{
|
this.Id = $"{Yw.Monitor.DataType.MonitorPoint}_{rhs.ID}";
|
this.ParentId = $"{Yw.Monitor.DataType.MonitorPointGroup}_{rhs.GroupID}";
|
this.LogicalName = rhs.Name;
|
this.LogicalType = Yw.Monitor.DataType.MonitorPoint;
|
this.LogicalID = rhs.ID;
|
this.LogicalModel = null;
|
this.SortCode = rhs.SortCode;
|
this.Description = rhs.Description;
|
this.Children = new List<LogicalTreeDto>();
|
|
foreach (var signal in rhs.SignalList)
|
{
|
var child = new MonitorFullLogicalTreeDto(signal);
|
child.ParentId = this.Id;
|
this.Children.Add(child);
|
}
|
}
|
|
}
|
|
/// <summary>
|
///
|
/// </summary>
|
public MonitorFullLogicalTreeDto(Yw.Model.Signal_SignalType rhs)
|
{
|
this.Id = $"{Yw.Monitor.DataType.Signal}_{rhs.ID}";
|
this.ParentId = $"{Yw.Monitor.DataType.MonitorPoint}_{rhs.MonitorPointID}";
|
this.LogicalName = rhs.Name;
|
this.LogicalType = Yw.Monitor.DataType.Signal;
|
this.LogicalID = rhs.ID;
|
this.LogicalModel = null;
|
this.SortCode = rhs.SortCode;
|
this.Description = rhs.Description;
|
this.Children = new List<LogicalTreeDto>();
|
}
|
|
}
|
}
|