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 LogIPSelect(List lists, string ip) { return lists.Where(x => x.IP == ip).ToList(); } public static List LogTimeSelect(List lists, DateTime start, DateTime end) { return lists.Where(x => x.LogTime >= start && x.LogTime <= end).ToList(); } public static List LogLengthSelect(List 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 LogIntervalSelect(List 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 LogStatusSelect(List lists, string status) { if (status.IsNullOrEmpty()) return lists; return lists.Where(x => x.Status == status).ToList(); } public static List LogTipsSelect(List lists, string tips) { if (tips.IsNullOrEmpty()) return lists; return lists.Where(x => x.Tips == tips).ToList(); } public static List LogEPCSelect(List lists, string epc) { if (epc.IsNullOrEmpty()) return lists; return lists.Where(x => x.EPC.Contains(epc)).ToList(); } public static List LogSNSelect(List lists, string sn) { if (sn.IsNullOrEmpty()) return lists; return lists.Where(x => x.SN.Contains(sn)).ToList(); } } }