SysCalendar.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. using System.ComponentModel.DataAnnotations;
  2. using System.ComponentModel.DataAnnotations.Schema;
  3. using Abp.Domain.Entities.Auditing;
  4. using VberZero.BaseSystem.Users;
  5. namespace VberZero.BaseSystem;
  6. [Table("Sys_Calendars")]
  7. public class SysCalendar : AuditedEntity<int, User>
  8. {
  9. [MaxLength(500)]
  10. public string Title { get; set; }
  11. [MaxLength(1000)]
  12. public string Description { get; set; }
  13. public DateTime? Start { get; set; }
  14. public DateTime? End { get; set; }
  15. [MaxLength(100)]
  16. public string Colors { get; set; }
  17. public bool AllDay { get; set; }
  18. public long? OwnerId { get; set; }
  19. [ForeignKey("OwnerId")]
  20. public User Owner { get; set; }
  21. public bool IsNotify { get; set; }
  22. [MaxLength(20)]
  23. public string NotifyType { get; set; }
  24. [MaxLength(20)]
  25. public string JobId { get; set; }
  26. [NotMapped]
  27. public VzDefinition.CalendarNotifyType[] NotifyTypes
  28. {
  29. get
  30. {
  31. string[] strArr = NotifyType?.Split(',') ?? new string[] { };
  32. var list = new List<VzDefinition.CalendarNotifyType>();
  33. foreach (var s in strArr)
  34. {
  35. if (Enum.TryParse(s, out VzDefinition.CalendarNotifyType e))
  36. {
  37. list.Add(e);
  38. }
  39. }
  40. return list.ToArray();
  41. }
  42. }
  43. public void SetNotifyTypes(params VzDefinition.CalendarNotifyType[] notifyTypes)
  44. {
  45. if (notifyTypes.Length == 1)
  46. {
  47. NotifyType = (int)notifyTypes[0] + "";
  48. return;
  49. }
  50. NotifyType = string.Join(",", notifyTypes.Select(a => (int)a).ToArray());
  51. }
  52. }