Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel.DataAnnotations;
- using UIOMatic.Attributes;
- using UIOMatic.Enums;
- using Umbraco.Core.Persistence;
- using Umbraco.Core.Persistence.DatabaseAnnotations;
- namespace Company.Models
- {
- [UIOMatic("event", "Evenementen", "Evenement", FolderIcon = "icon-users", ItemIcon = "icon-user", RenderType = UIOMaticRenderType.List, ShowOnSummaryDashboard = true)]
- [System.Web.DynamicData.TableName("Event")]
- public class Event
- {
- [UIOMaticListViewField, PrimaryKeyColumn(AutoIncrement = true)]
- public int Id { get; set; }
- [Required]
- [UIOMaticListViewField(Name = "Titel"), UIOMaticField(Name = "Titel", Description = "Geef de titel op")]
- public string Title { get; set; }
- [Required]
- [UIOMaticListViewFilter(Name = "Locatie"), UIOMaticListViewField(Name = "Locatie"), UIOMaticField(Name = "Locatie", Description = "Geef de locatie op")]
- public string Location { get; set; }
- [Required]
- [UIOMaticField(Name = "Korte omschrijving", Description = "Geef een korte omschrijving op")]
- public string Excerpt { get; set; }
- [Required]
- [UIOMaticListViewField(Name = "Datum", Config = "{'format' : '{{value | date:\"dd/MM/yyyy\"}}'}"), UIOMaticField(Name = "Begindatum", Description = "Geef de begindatum en tijd op", View = "datetime")]
- public DateTime Begintime { get; set; }
- [Ignore]
- [UIOMaticListViewFilter(Name = "Jaar"), UIOMaticListViewField(Name = "Jaar")]
- public int Year
- {
- get { return Begintime.Year; }
- }
- [Required]
- [UIOMaticField(Name = "Einddatum", Description = "Geef de einddatum en tijd op", View = "datetime")]
- public DateTime Endtime { get; set; }
- [Required]
- [UIOMaticField(Name = "Beschikbare plaatsen", Description ="Aantal beschikbare plaatsen", View = "number")]
- public int Places { get; set; }
- [UIOMaticField(Name = "Hoofdfoto", Description = "Foto bevindt zich in de header", View = UIOMatic.Constants.FieldEditors.PickerMedia)]
- public int CoverId { get; set; }
- [UIOMaticField(Name= "Fotoalbum", Description = "Fotoalbum indien aanwezig", View = UIOMatic.Constants.FieldEditors.PickerMedia)]
- public int AlbumId { get; set; }
- [Ignore]
- public List<Media> Album
- {
- get
- {
- if (AlbumId != 0)
- {
- return MediaRepository.getAlbum(AlbumId);
- }
- return null;
- }
- }
- [Ignore]
- public Media Cover
- {
- get
- {
- if (CoverId != 0)
- {
- return MediaRepository.getMedia(CoverId);
- }
- return null;
- }
- }
- [Required]
- [UIOMaticField(Name = "Volledig bericht", Description = "Geef een volledige beschrijving op", View = "rte")]
- public string Body { get; set; }
- public List<Registration> Registrations(int statusId = -1)
- {
- if (Id != 0)
- return RegistrationRepository.getRegistrations(Id, statusId);
- return null;
- }
- [Ignore]
- public Registration Registration {
- get {
- if (Id != 0)
- {
- Registration registration = EventRepository.getStatus(this);
- if ((registration != null) && registration.Id != 0)
- return registration;
- }
- return null;
- }
- }
- public override string ToString()
- {
- return Title;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement