YTErrorList.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using SysBaseLibs;
  6. namespace SysDataLibs
  7. {
  8. public class YTErrorList
  9. {
  10. private List<DateTime> _ErrorTimes = new List<DateTime>();
  11. public List<DateTime> ErrorTimes
  12. {
  13. get
  14. {
  15. return _ErrorTimes;
  16. }
  17. set
  18. {
  19. _ErrorTimes = value;
  20. }
  21. }
  22. public bool IsCanStop
  23. {
  24. get
  25. {
  26. bool lbRetval = false;
  27. try
  28. {
  29. if (ErrorTimes.Count > 20)
  30. {
  31. TimeSpan ts = Utils.DateDiff(ErrorTimes[ErrorTimes.Count - 1], ErrorTimes[ErrorTimes.Count - 20]);
  32. if (ts.Hours <= 2)
  33. {
  34. lbRetval = true;
  35. }
  36. for (int i = 0; i < ErrorTimes.Count - 20; i++)
  37. {
  38. ErrorTimes.RemoveAt(i);
  39. }
  40. }
  41. }
  42. catch
  43. {
  44. }
  45. return lbRetval;
  46. }
  47. }
  48. }
  49. }