Exemplo n.º 1
0
        protected static bool ValidateDateOfBirthOptional(DataItemBase item)
        {
            var now       = DateTime.UtcNow;
            var min       = now - new TimeSpan(36525, 0, 0, 0); // 100 years
            var max       = now - new TimeSpan(6575, 0, 0, 0);  // 18 years
            var validated =
                item.Feedback.ValidateDateOptional(item.DataControl as TextBox,
                                                   out var success, item.Description, min, max, VotePage.DefaultDbDate);

            if (success)
            {
                item.DataControl.SetValue(
                    Politicians.GetDateOfBirthFromDateTime(validated));
            }
            return(success);
        }
Exemplo n.º 2
0
 public static string DateOfBirthAsString(this DataRow row)
 {
     return(Politicians.GetDateOfBirthFromDateTime(row.DateOfBirth()));
 }