KeyScalarDate.cs 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. using System;
  2. namespace BO.AppServer.Data
  3. {
  4. public class KeyScalarDate : IEquatable<KeyScalarDate>
  5. {
  6. public int Day { get; set; }
  7. public int Month { get; set; }
  8. public int Year { get; set; }
  9. public bool Equals(KeyScalarDate other)
  10. {
  11. if (other == null)
  12. return false;
  13. return Day == other.Day && Year == other.Year && Month == other.Month;
  14. }
  15. public override bool Equals(object obj)
  16. {
  17. if (ReferenceEquals(null, obj)) return false;
  18. if (ReferenceEquals(this, obj)) return true;
  19. if (obj.GetType() != this.GetType()) return false;
  20. return Equals((KeyScalarDate)obj);
  21. }
  22. public override int GetHashCode()
  23. {
  24. return (Day * Month * Year).GetHashCode();
  25. }
  26. public static bool operator ==(KeyScalarDate left, KeyScalarDate right)
  27. {
  28. return Equals(left, right);
  29. }
  30. public static bool operator !=(KeyScalarDate left, KeyScalarDate right)
  31. {
  32. return !Equals(left, right);
  33. }
  34. }
  35. }