BusinessUnit.cs 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. using System;
  2. using System.ComponentModel.DataAnnotations;
  3. namespace Dfs.WayneChina.PosModelMini
  4. {
  5. public class BusinessUnit
  6. {
  7. /// <summary>
  8. /// Unique id of the business unit.
  9. /// </summary>
  10. public Guid Id { get; set; }
  11. /// <summary>
  12. /// When the business unit is created.
  13. /// </summary>
  14. public virtual DateTime? CreatedDateTime { get; set; }
  15. /// <summary>
  16. /// Business unit type.
  17. /// </summary>
  18. public BusinessUnitTypeEnum UnitType { get; set; }
  19. /// <summary>
  20. /// Name of the business unit.
  21. /// </summary>
  22. [MaxLength(50)]
  23. public string Name { get; set; }
  24. /// <summary>
  25. /// Address of the business unit.
  26. /// </summary>
  27. public string Address { get; set; }
  28. /// <summary>
  29. /// Anything could help to understand what this unit means, like a Site, then try put info about this site.
  30. /// or a region, then try put info about the region.
  31. /// </summary>
  32. public string Description { get; set; }
  33. /// <summary>
  34. /// Parent business unit id of the current business unit.
  35. /// </summary>
  36. public Guid? ParentBusinessUnitId { get; set; }
  37. /// <summary>
  38. /// Parent business unit of the current business unit.
  39. /// </summary>
  40. public virtual BusinessUnit ParentBusinessUnit { get; set; }
  41. /// <summary>
  42. /// Pos item group system.
  43. /// </summary>
  44. public virtual PosItemGroupSystem PosItemGroupSystem { get; set; }
  45. /// <summary>
  46. /// Checks whether the target business unit is the same as the current one.
  47. /// </summary>
  48. /// <param name="obj"></param>
  49. /// <returns></returns>
  50. public override bool Equals(object obj)
  51. {
  52. var target = obj as BusinessUnit;
  53. if (target == null)
  54. return false;
  55. if (target.Name == this.Name)
  56. return true;
  57. return false;
  58. }
  59. /// <summary>
  60. /// Overrides the method just to make the compiler happy.
  61. /// </summary>
  62. /// <returns></returns>
  63. public override int GetHashCode()
  64. {
  65. return base.GetHashCode();
  66. }
  67. }
  68. }