You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

86 lines
2.9 KiB
C#

using HighWayIot.Repository.domain;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Xml.Linq;
using TouchSocket.Core;
namespace RFIDSocket
{
public class LogControl
{
public static List<RFIDContent> LogIPSelect(List<RFIDContent> lists, string ip)
{
return lists.Where(x => x.IP == ip).ToList();
}
public static List<RFIDContent> LogTimeSelect(List<RFIDContent> lists, DateTime start, DateTime end)
{
return lists.Where(x => x.LogTime >= start && x.LogTime <= end).ToList();
}
public static List<RFIDContent> LogLengthSelect(List<RFIDContent> lists, int minLength, int maxLength)
{
if (minLength == -1 && maxLength == -1)
{
return lists;
}
else if (minLength == -1 && maxLength != -1)
{
return lists.Where(x => x.Length <= maxLength).ToList();
}
else if (minLength != -1 && maxLength == -1)
{
return lists.Where(x => x.Length >= minLength).ToList();
}
return lists.Where(x => x.Length >= minLength && x.Length <= maxLength).ToList();
}
public static List<RFIDContent> LogIntervalSelect(List<RFIDContent> lists, int minInterval, int maxInterval)
{
if (minInterval == -1 && maxInterval == -1)
{
return lists;
}
else if (minInterval == -1 && maxInterval != -1)
{
return lists.Where(x => x.Interval <= maxInterval).ToList();
}
else if (minInterval != -1 && maxInterval == -1)
{
return lists.Where(x => x.Interval >= minInterval).ToList();
}
return lists.Where(x => x.Interval >= minInterval && x.Interval <= maxInterval).ToList();
}
public static List<RFIDContent> LogStatusSelect(List<RFIDContent> lists, string status)
{
if (status.IsNullOrEmpty()) return lists;
return lists.Where(x => x.Status == status).ToList();
}
public static List<RFIDContent> LogTipsSelect(List<RFIDContent> lists, string tips)
{
if (tips.IsNullOrEmpty()) return lists;
return lists.Where(x => x.Tips == tips).ToList();
}
public static List<RFIDContent> LogEPCSelect(List<RFIDContent> lists, string epc)
{
if (epc.IsNullOrEmpty()) return lists;
return lists.Where(x => x.EPC.Contains(epc)).ToList();
}
public static List<RFIDContent> LogSNSelect(List<RFIDContent> lists, string sn)
{
if (sn.IsNullOrEmpty()) return lists;
return lists.Where(x => x.SN.Contains(sn)).ToList();
}
}
}