AlarmByDayComparer.cs 985 B

1234567891011121314151617181920212223242526
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. namespace DllEapEntity.Dtos
  5. {
  6. public class AlarmByDayComparer : IEqualityComparer<McaEventStatisticByDay>
  7. {
  8. public bool Equals(McaEventStatisticByDay x, McaEventStatisticByDay y)
  9. {
  10. if (Object.ReferenceEquals(x, y)) return true;
  11. if (Object.ReferenceEquals(x, null) || Object.ReferenceEquals(y, null))
  12. return false;
  13. return x.McaCode == y.McaCode && x.AlarmCode == y.AlarmCode && x.EventCode == y.EventCode
  14. && x.StartTime == y.StartTime && x.EndTime == y.EndTime;
  15. }
  16. public int GetHashCode(McaEventStatisticByDay obj)
  17. {
  18. if (Object.ReferenceEquals(obj, null)) return 0;
  19. int hashStudentName = obj.McaName == null ? 0 : obj.McaName.GetHashCode();
  20. int hashStudentCode = obj.McaCode.GetHashCode();
  21. return hashStudentName ^ hashStudentCode;
  22. }
  23. }
  24. }