namespace IStation.Application { /// /// /// public class MonitorFullLogicalTreeDto : Yw.Dto.LogicalTreeDto { /// /// /// public MonitorFullLogicalTreeDto() { } /// /// /// public MonitorFullLogicalTreeDto(Model.LogicSite rhs) { this.Id = $"{IStation.DataType.LogicSite}_{rhs.ID}"; this.ParentId = string.Empty; this.LogicalName = rhs.Name; this.LogicalType = DataType.LogicSite; this.LogicalID = rhs.ID; this.LogicalModel = null; this.SortCode = rhs.SortCode; this.Description = rhs.Description; this.Children = new List(); } /// /// /// 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(); } /// /// /// public MonitorFullLogicalTreeDto(Yw.Model.MonitorPointGroup rhs, List 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(); if (monitorList != null && monitorList.Count > 0) { foreach (var monitor in monitorList) { var child = new MonitorFullLogicalTreeDto(monitor); child.ParentId = this.Id; this.Children.Add(child); } } } /// /// /// 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(); } 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(); foreach (var signal in rhs.SignalList) { var child = new MonitorFullLogicalTreeDto(signal); child.ParentId = this.Id; this.Children.Add(child); } } } /// /// /// 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(); } } }