This commit is contained in:
2021-08-12 18:58:03 +01:00
parent 5e5ef7190b
commit 6a682ff9ea
51 changed files with 657 additions and 192 deletions
@@ -8,6 +8,7 @@ using Saxonite.Base.App;
using Saxonite.Net.Standard.Base.Bus;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
@@ -130,11 +131,11 @@ namespace Saxonite.Net.Standard.Base.Mgr
errField.PhoneMobile = SacsHierarchyItem.ValidValue.Invalid;
return false;
}
// Date of birth.
if (errField.DateOfBirth != SacsHierarchyItem.ValidValue.Ignore && DateUtil.IsValid(data.DateOfBirth) && data.DateOfBirth.CompareTo(DateTime.Today) > 0)
// Date of birth year.
if (errField.DateOfBirthYear != SacsHierarchyItem.ValidValue.Ignore && data.DateOfBirthYear > DateTime.Today.Year)
{
errField.PhoneMobile = SacsHierarchyItem.ValidValue.Invalid;
return SetErrorState("Date of birth must not be in the future");
return SetErrorState("Date of birth year must not be in the future");
}
//---------------------------------------------------------------
@@ -244,11 +245,34 @@ namespace Saxonite.Net.Standard.Base.Mgr
/// Extract and format result set data value where specific handling is required.
/// <para>Where response is an invalid data value, format value using column.FormatValue(values).</para>
/// </summary>
public virtual DataValue GetUserAccountDataValue(ColumnDfn column, NamedValue.Map values)
public virtual DataValue GetUserAccountDataValue(ColumnDfn column, NamedValue.Map values, CultureInfo cultureInfo = null)
{
DataValue value = new DataValue();
switch ((SaxUserAccount.Column)column.Id)
{
//-----------------------------------------------------------
case SaxUserAccount.Column.DateOfBirth:
{
byte dobDay = (byte)values.GetValue(GetUserAccountColumnDfn(SaxUserAccount.Column.DateOfBirthDay).DataName).AsLong();
byte dobMonth = (byte)values.GetValue(GetUserAccountColumnDfn(SaxUserAccount.Column.DateOfBirthMonth).DataName).AsLong();
short dobYear = (short)values.GetValue(GetUserAccountColumnDfn(SaxUserAccount.Column.DateOfBirthYear).DataName).AsLong();
List<String> dobParts = new List<string>();
if (dobYear > 0)
{
if (dobMonth > 0)
{
if (dobDay > 0)
dobParts.Add(dobDay.ToString());
// Format date with month to extract name.
DateTime monthDate = new DateTime(DateTime.Today.Year, dobMonth, 1);
dobParts.Add(DateUtil.Format(monthDate, "MMM", cultureInfo));
}
dobParts.Add(dobYear.ToString());
}
value = new DataValue(dobParts.Concat("-"));
}
break;
//-----------------------------------------------------------
// Notes.
case SaxUserAccount.Column.Notes: