Files
chapter-organizer/Core/Entities/EventDefinition.cs
T
poprhythm 8af86e22d9 Refactor collection initializers to use C# 12 collection expressions
This commit updates various files across the Core and WebApp projects to replace traditional collection initializers with C# 12 collection expressions. Changes include modifications to EventAssignment.cs, TeamScheduler_DecisionTree.cs, CareerField.cs, EventDefinition.cs, and several components in the WebApp. These updates enhance code readability and maintainability by adhering to modern C# syntax standards.
2026-01-11 10:35:58 -05:00

80 lines
2.4 KiB
C#

using System.ComponentModel.DataAnnotations;
namespace Core.Entities;
public class EventDefinition
{
public int Id { get; set; }
[Required]
[StringLength(100, MinimumLength = 2)]
[Display(Name = "Event Name")]
public string Name { get; set; } = null!;
[Required]
[StringLength(40, MinimumLength = 2)]
[Display(Name = "Event Short Name")]
public string? ShortName { get; set; }
[Required]
public EventFormat EventFormat { get; set; }
[Range(1, 6)]
public int MinTeamSize { get; set; }
[Range(1, 6)]
public int MaxTeamSize { get; set; }
public string TeamSize =>
MinTeamSize == MaxTeamSize
? MinTeamSize.ToString()
: $"{MinTeamSize.ToString()}-{MaxTeamSize.ToString()}";
[StringLength(100)]
public string? SemifinalistActivity { get; set; }
public bool InterviewOrPresentation
=> SemifinalistActivity != null && (SemifinalistActivity.Contains("Interview") || SemifinalistActivity.Contains("Presentation"));
public bool OnSiteActivity { get; set; }
[StringLength(1024)]
public string? Notes { get; set; }
[Range(0, 3)]
public int ChapterEligibilityCountRegionals { get; set; }
[Range(1, 3)]
public int ChapterEligibilityCountState { get; set; }
public bool RegionalEvent => ChapterEligibilityCountRegionals > 0;
public bool Presubmission { get; set; }
[StringLength(64)]
public string? Documentation { get; set; }
[Required]
[StringLength(256)]
public string Eligibility { get; set; } = null!;
[StringLength(4096)]
public string? Theme { get; set; }
[StringLength(1024)]
public string? Description { get; set; }
public int? LevelOfEffort { get; set; }
public ICollection<Career> RelatedCareers { get; set; } = [];
[System.ComponentModel.DataAnnotations.Schema.NotMapped]
public string? RelatedCareersText { get; set; }
public override string ToString() => Name;
public static readonly EventDefinition GeneralSchedule = new(){Name = "General Schedule"};
public static readonly EventDefinition MeetTheCandidates = new(){Name = "Meet the Candidates"};
public static readonly EventDefinition ChapterOfficerMeeting = new(){Name = "Chapter Officer Meeting"};
public static readonly EventDefinition VotingDelegateMeeting = new(){Name = "Voting Delegate Meeting"};
public static readonly EventDefinition SocialGathering = new(){Name = "Social Gathering"};
}