Site.cs 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. namespace GreenTree.Nachtragsmanagement.Core.Domain.Site
  7. {
  8. public class Site : BaseEntity
  9. {
  10. #region Fields
  11. /// <summary>
  12. /// Userlist
  13. /// </summary>
  14. private ICollection<User.User> _users;
  15. /// <summary>
  16. /// Appendixlist
  17. /// </summary>
  18. private ICollection<Appendix.Appendix> _appendices;
  19. /// <summary>
  20. /// Deviations related to the site
  21. /// </summary>
  22. private ICollection<Deviation.Deviation> _deviations;
  23. #endregion
  24. /// <summary>
  25. /// CustomNumber for identification
  26. /// </summary>
  27. public string CustomNumber { get; set; }
  28. /// <summary>
  29. /// Description
  30. /// </summary>
  31. public string Description { get; set; }
  32. /// <summary>
  33. /// Beginning of the site
  34. /// </summary>
  35. public DateTime? Start { get; set; }
  36. /// <summary>
  37. /// Ending of the site
  38. /// </summary>
  39. public DateTime? End { get; set; }
  40. /// <summary>
  41. /// Editable comment
  42. /// </summary>
  43. public string Comment { get; set; }
  44. /// <summary>
  45. /// Determines if the site is completely finished
  46. /// </summary>
  47. public bool Finished { get; set; }
  48. /// <summary>
  49. /// Users responsible for this site
  50. /// </summary>
  51. public virtual ICollection<User.User> Users
  52. {
  53. get { return _users ?? ( _users = new List<User.User>()); }
  54. protected set { _users = value; }
  55. }
  56. /// <summary>
  57. /// Appendices related to the site
  58. /// </summary>
  59. public virtual ICollection<Appendix.Appendix> Appendices
  60. {
  61. get { return _appendices ?? (_appendices = new List<Appendix.Appendix>()); }
  62. protected set { _appendices = value; }
  63. }
  64. /// <summary>
  65. /// Deviations related to the site
  66. /// </summary>
  67. public virtual ICollection<Deviation.Deviation> Deviations
  68. {
  69. get { return _deviations ?? (_deviations = new List<Deviation.Deviation>()); }
  70. protected set { _deviations = value; }
  71. }
  72. #region Helper
  73. /// <summary>
  74. /// Adds missing deviations and removes not selected deviations
  75. /// </summary>
  76. /// <param name="deviations">Site deviations.</param>
  77. public void SetDeviations(ICollection<Deviation.Deviation> deviations)
  78. {
  79. Deviations = deviations;
  80. }
  81. /// <summary>
  82. /// Adds missing appendices and removes not selected appendices
  83. /// </summary>
  84. /// <param name="deviations">Site appendices.</param>
  85. public void SetAppendices(ICollection<Appendix.Appendix> appendices)
  86. {
  87. Appendices = appendices;
  88. }
  89. /// <summary>
  90. /// Adds missing users and removes not selected users
  91. /// </summary>
  92. /// <param name="users">Site users.</param>
  93. public void SetUsers(ICollection<User.User> users)
  94. {
  95. Users = users;
  96. }
  97. #endregion
  98. }
  99. }