using System;
|
using System.Collections.Generic;
|
using System.IO;
|
using System.Linq;
|
|
namespace IStation.BLL
|
{
|
/// <summary>
|
///
|
/// </summary>
|
public partial class CurveAnalyzePointPacket
|
{
|
|
private readonly DAL.CurveAnalyzePointPacket _dal = new DAL.CurveAnalyzePointPacket();
|
|
/// <summary>
|
///
|
/// </summary>
|
/// <returns></returns>
|
public List<Model.CurveAnalyzePointPacket> Get(long monitorDataSourcesId, long curveAnalyzeId)
|
{
|
return _dal.Get(monitorDataSourcesId, curveAnalyzeId);
|
}
|
|
/// <summary>
|
///
|
/// </summary>
|
/// <returns></returns>
|
public List<Model.CurveAnalyzePointPacket> GetValid(long monitorDataSourcesId, long curveAnalyzeId)
|
{
|
return _dal.GetValid(monitorDataSourcesId, curveAnalyzeId);
|
}
|
|
|
/// <summary>
|
///
|
/// </summary>
|
/// <param name="list"></param>
|
public bool Save(long monitorDataSourcesId, long curveAnalyzeId, List<Model.CurveAnalyzePointPacket> list)
|
{
|
return _dal.Save(monitorDataSourcesId, curveAnalyzeId, list);
|
}
|
|
|
/// <summary>
|
/// 设置无效点
|
/// </summary>
|
public bool SetInvalid(long monitorDataSourcesId, long curveAnalyzeId, List<DateTime> timeList)
|
{
|
if (timeList == null || timeList.Count() < 1)
|
return default;
|
var packets = _dal.Get(monitorDataSourcesId, curveAnalyzeId);
|
if (packets == null || !packets.Any())
|
return default;
|
foreach (var packet in packets)
|
{
|
var all = packet.Points;
|
if (all == null || !all.Any())
|
continue;
|
for (int i = 0; i < all.Count(); i++)
|
{
|
if (timeList.Contains(all[i].Time))
|
{
|
all[i].Status = Model.AnalyzePointStatus.Invalid;
|
}
|
}
|
}
|
return _dal.Save(monitorDataSourcesId, curveAnalyzeId, packets);
|
}
|
|
/// <summary>
|
/// 重置数据
|
/// </summary>
|
public bool Reset(long monitorDataSourcesId, long curveAnalyzeId)
|
{
|
var packets = _dal.Get(monitorDataSourcesId, curveAnalyzeId);
|
if (packets == null || !packets.Any())
|
return default;
|
foreach (var packet in packets)
|
{
|
var all = packet.Points;
|
if (all == null || !all.Any())
|
continue;
|
for (int i = 0; i < all.Count(); i++)
|
{
|
all[i].Status = Model.AnalyzePointStatus.Valid;
|
}
|
}
|
return _dal.Save(monitorDataSourcesId, curveAnalyzeId, packets);
|
}
|
|
|
}
|
}
|