using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using Abp.Domain.Entities.Auditing; using VberZero.BaseSystem.Users; namespace VberZero.BaseSystem; [Table("Sys_Calendars")] public class SysCalendar : AuditedEntity { [MaxLength(500)] public string Title { get; set; } [MaxLength(1000)] public string Description { get; set; } public DateTime? Start { get; set; } public DateTime? End { get; set; } [MaxLength(100)] public string Colors { get; set; } public bool AllDay { get; set; } public long? OwnerId { get; set; } [ForeignKey("OwnerId")] public User Owner { get; set; } public bool IsNotify { get; set; } [MaxLength(20)] public string NotifyType { get; set; } [MaxLength(20)] public string JobId { get; set; } [NotMapped] public VzDefinition.CalendarNotifyType[] NotifyTypes { get { string[] strArr = NotifyType?.Split(',') ?? new string[] { }; var list = new List(); foreach (var s in strArr) { if (Enum.TryParse(s, out VzDefinition.CalendarNotifyType e)) { list.Add(e); } } return list.ToArray(); } } public void SetNotifyTypes(params VzDefinition.CalendarNotifyType[] notifyTypes) { if (notifyTypes.Length == 1) { NotifyType = (int)notifyTypes[0] + ""; return; } NotifyType = string.Join(",", notifyTypes.Select(a => (int)a).ToArray()); } }