74 lines
1.7 KiB
C#
74 lines
1.7 KiB
C#
using System.Text.RegularExpressions;
|
|
|
|
namespace Core.Entities;
|
|
|
|
public class Student
|
|
{
|
|
public string Name { get; set; }
|
|
|
|
public string LastNameFirstName
|
|
{
|
|
get
|
|
{
|
|
if (Name.Contains(',')) return Name;
|
|
var match = Regex.Match(Name, @"(.*)\s(.*)");
|
|
if (match.Success)
|
|
return $"{match.Groups[2].Value}, {match.Groups[2].Value} ";
|
|
return Name;
|
|
}
|
|
}
|
|
|
|
|
|
public string FirstNameLastName
|
|
{
|
|
get
|
|
{
|
|
if (!Name.Contains(',')) return Name;
|
|
var match = Regex.Match(Name, @"(.*),\s*(.*)");
|
|
if (match.Success)
|
|
return $"{match.Groups[2].Value} {match.Groups[1].Value}";
|
|
return Name;
|
|
}
|
|
}
|
|
|
|
public string FirstName
|
|
{
|
|
get
|
|
{
|
|
var match = Regex.Match(LastNameFirstName, @"(.*),\s*(.*)");
|
|
if (match.Success)
|
|
return $"{match.Groups[2].Value}";
|
|
return Name;
|
|
}
|
|
}
|
|
|
|
public int Grade { get; }
|
|
public string StateID { get; }
|
|
public string RegionalID { get; }
|
|
public string NationalID { get; }
|
|
public int TsaYear { get; }
|
|
public string Officer { get; }
|
|
public IList<CompetitiveEvent> RankedEventPicks { get; }
|
|
|
|
public ICollection<Team> Teams { get; set; }
|
|
|
|
public Student(string name, int grade, int tsaYear, string officer, IList<CompetitiveEvent> rankedEventPicks,
|
|
string stateID, string regionalID, string nationalId)
|
|
{
|
|
Name = name;
|
|
Grade = grade;
|
|
TsaYear = tsaYear;
|
|
Officer = officer;
|
|
RankedEventPicks = rankedEventPicks;
|
|
StateID=stateID;
|
|
RegionalID = regionalID;
|
|
NationalID = nationalId;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
return FirstName;
|
|
}
|
|
|
|
public bool VotingDelegate => Officer.Contains("Pres");
|
|
} |