Advertisement
Guest User

Untitled

a guest
Nov 10th, 2016
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.83 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel.DataAnnotations;
  4. using UIOMatic.Attributes;
  5. using UIOMatic.Enums;
  6. using Umbraco.Core.Persistence;
  7. using Umbraco.Core.Persistence.DatabaseAnnotations;
  8.  
  9. namespace Company.Models
  10. {
  11. [UIOMatic("event", "Evenementen", "Evenement", FolderIcon = "icon-users", ItemIcon = "icon-user", RenderType = UIOMaticRenderType.List, ShowOnSummaryDashboard = true)]
  12. [System.Web.DynamicData.TableName("Event")]
  13. public class Event
  14. {
  15. [UIOMaticListViewField, PrimaryKeyColumn(AutoIncrement = true)]
  16. public int Id { get; set; }
  17.  
  18. [Required]
  19. [UIOMaticListViewField(Name = "Titel"), UIOMaticField(Name = "Titel", Description = "Geef de titel op")]
  20. public string Title { get; set; }
  21.  
  22. [Required]
  23. [UIOMaticListViewFilter(Name = "Locatie"), UIOMaticListViewField(Name = "Locatie"), UIOMaticField(Name = "Locatie", Description = "Geef de locatie op")]
  24. public string Location { get; set; }
  25.  
  26. [Required]
  27. [UIOMaticField(Name = "Korte omschrijving", Description = "Geef een korte omschrijving op")]
  28. public string Excerpt { get; set; }
  29.  
  30. [Required]
  31. [UIOMaticListViewField(Name = "Datum", Config = "{'format' : '{{value | date:\"dd/MM/yyyy\"}}'}"), UIOMaticField(Name = "Begindatum", Description = "Geef de begindatum en tijd op", View = "datetime")]
  32. public DateTime Begintime { get; set; }
  33.  
  34. [Ignore]
  35. [UIOMaticListViewFilter(Name = "Jaar"), UIOMaticListViewField(Name = "Jaar")]
  36. public int Year
  37. {
  38. get { return Begintime.Year; }
  39. }
  40.  
  41. [Required]
  42. [UIOMaticField(Name = "Einddatum", Description = "Geef de einddatum en tijd op", View = "datetime")]
  43. public DateTime Endtime { get; set; }
  44.  
  45. [Required]
  46. [UIOMaticField(Name = "Beschikbare plaatsen", Description ="Aantal beschikbare plaatsen", View = "number")]
  47. public int Places { get; set; }
  48.  
  49. [UIOMaticField(Name = "Hoofdfoto", Description = "Foto bevindt zich in de header", View = UIOMatic.Constants.FieldEditors.PickerMedia)]
  50. public int CoverId { get; set; }
  51.  
  52. [UIOMaticField(Name= "Fotoalbum", Description = "Fotoalbum indien aanwezig", View = UIOMatic.Constants.FieldEditors.PickerMedia)]
  53. public int AlbumId { get; set; }
  54.  
  55. [Ignore]
  56. public List<Media> Album
  57. {
  58. get
  59. {
  60. if (AlbumId != 0)
  61. {
  62. return MediaRepository.getAlbum(AlbumId);
  63. }
  64.  
  65. return null;
  66. }
  67. }
  68.  
  69. [Ignore]
  70. public Media Cover
  71. {
  72. get
  73. {
  74. if (CoverId != 0)
  75. {
  76. return MediaRepository.getMedia(CoverId);
  77. }
  78.  
  79. return null;
  80. }
  81. }
  82.  
  83. [Required]
  84. [UIOMaticField(Name = "Volledig bericht", Description = "Geef een volledige beschrijving op", View = "rte")]
  85. public string Body { get; set; }
  86.  
  87. public List<Registration> Registrations(int statusId = -1)
  88. {
  89. if (Id != 0)
  90. return RegistrationRepository.getRegistrations(Id, statusId);
  91.  
  92. return null;
  93. }
  94.  
  95. [Ignore]
  96. public Registration Registration {
  97. get {
  98. if (Id != 0)
  99. {
  100. Registration registration = EventRepository.getStatus(this);
  101.  
  102. if ((registration != null) && registration.Id != 0)
  103. return registration;
  104. }
  105.  
  106. return null;
  107. }
  108. }
  109.  
  110. public override string ToString()
  111. {
  112. return Title;
  113. }
  114. }
  115. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement