public TmAlert(byte[] id, int importance, bool isActive, bool isUnacked, DateTime?onTime, DateTime?offTime, string type, string name, string currentValueString, DateTime?currentValueTime, float currentValue, float?initialValue, DateTime?ackTime, string ackUser, int tmClassId, TmAddr tmAddr, ITmAnalogRetro[] microSeries, TmAnalogTechParameters analogTechParameters) { Id = id; Importance = importance; IsActive = isActive; IsUnacked = isUnacked; OnTime = onTime; OffTime = offTime; Type = type; Name = name; CurrentValueString = currentValueString; CurrentValueTime = currentValueTime; CurrentValue = currentValue; AckTime = ackTime; AckUser = ackUser; TmClassId = tmClassId; TmAddr = tmAddr; MicroSeries = microSeries.ToList(); if (tmAddr.Type == TmType.Analog) { AnalogTechParameters = analogTechParameters; } if (tmAddr.Type == TmType.Analog && initialValue != null) { Reference = initialValue.Value; } }
public static TmAlert CreateFromDto(TmAlertDto dto) { return(new TmAlert(dto.AlertId, dto.Importance, dto.Active, dto.Unack, dto.OnTime, dto.OffTime.NullIfEpoch(), dto.TypeName, dto.Name.RemoveMultipleWhitespaces(), dto.ValueText.Trim(), dto.CurTime, dto.CurValue, dto.ActValue, dto.AckTime, dto.AckUser, dto.ClassId ?? 0, TmAddr.CreateFromSqlTmaAndTmaType((ushort)(dto.TmType ?? 0), dto.Tma), dto.MapToTmAnalogMicroSeriesDto().MapToITmAnalogRetroArray(), TmAnalogTechParameters.CreateFromDto(dto.MapToTmAnalogTechParametersDto()) )); }