public static string GetTimePeriodDisplay(TimePeriod period) { var result = "?"; if (period != null) { var start = period.Start; var stop = period.Stop; if ((start != null) && (stop != null)) { var startDate = start.Value; var stopDate = stop.Value; var span = stopDate - startDate; var totalDays = span.TotalDays; var totalMonths = (int) (totalDays/30.0); var totalYears = totalMonths/12; if (totalMonths == 0) { result = ""; } else if (totalYears > 0) { var remainingMonths = totalMonths%12; result = String.Format("({0} year{1}, {2} month{3})", totalYears, (totalYears == 1) ? "" : "s", remainingMonths, (remainingMonths == 1) ? "" : "s"); } else { result = String.Format("({0} month{1})", totalMonths, (totalMonths == 1) ? "" : "s"); } } } return result; }
protected Association(EntityId entityId, ResponseDictionary responseDictionary, TimePeriod validFor, bool isHistorical, DateTime? contactCreationDate) { EntityId = entityId; _responseDictionary = responseDictionary; ValidFor = validFor; IsHistorical = isHistorical; ContactCreationDate = contactCreationDate; ValidateEntityIdType(); }
protected LocationAssociation(EntityId entityId, ResponseDictionary responseDictionary, TimePeriod validFor, bool isHistorical, DateTime? contactCreationDate) : base(entityId, responseDictionary, validFor, isHistorical, contactCreationDate) { }