Last active
December 17, 2015 02:38
-
-
Save nairdo/5536682 to your computer and use it in GitHub Desktop.
Gets the grade level of the person based on their High School graduation date. The grade level is -1 for prekindergarten, 0 for kindergarten, 1 for first grade, etc. and null if they do not have a graduation date set.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// Gets the grade level of the person based on their High School graduation date. | |
/// </summary> | |
/// <value> | |
/// The grade level (-1 for prekindergarten, 0 for kindergarten, 1 for first grade, etc.) or null if they have no graduation date. | |
/// </value> | |
[NotMapped] | |
[DataMember] | |
[MergeField] | |
public virtual int? Grade | |
{ | |
get | |
{ | |
if ( ! GraduationDate.HasValue ) | |
{ | |
return null; | |
} | |
else | |
{ | |
// Is it before the promotion date? | |
// TODO: change next line to use a "PromotionDate" instead pulling the mm and dd from the GraduationDate. | |
DateTime promotionDate = new DateTime( DateTime.Now.Year, GraduationDate.Value.Month, GraduationDate.Value.Day ); | |
var gradeMaxFactorReactor = ( DateTime.Now < promotionDate ) ? 12 : 13; | |
return gradeMaxFactorReactor - ( GraduationDate.Value.Year - DateTime.Now.Year ); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment