fixed Date Plausi und settings für blacked out regions

This commit is contained in:
Daniel Schick 2023-08-03 11:27:50 +02:00
parent f4fd9595a1
commit 05ea4b5783
5 changed files with 61 additions and 24 deletions

View File

@ -15,9 +15,7 @@ namespace ENI2.EditControls
/// Interaction logic for EditCREWDialog.xaml
/// </summary>
public partial class EditCREWDialog : EditWindowBase
{
private static DateTime MAXDATE = new DateTime(2198, 12, 31);
{
public EditCREWDialog()
{
@ -39,24 +37,35 @@ namespace ENI2.EditControls
this.textBoxPlaceOfBirth.Text = this.CREW.CrewMemberPlaceOfBirth;
this.comboBoxNationality.ItemsSource = bsmd.database.CREW.NationalityDict;
this.comboBoxNationality.SelectedValue = this.CREW.CrewMemberNationality;
if (this.CREW.CrewMemberDateOfBirth > MAXDATE)
this.CREW.CrewMemberDateOfBirth = MAXDATE;
if (this.CREW.CrewMemberDateOfBirth > CREW.CLAMPMAXDATE)
{
this.datePickerDateOfBirth.SelectedDate = CREW.CLAMPMAXDATE;
}
else if (this.CREW.CrewMemberDateOfBirth < CREW.CLAMPMINDATE)
{
this.datePickerDateOfBirth.SelectedDate = CREW.CLAMPMINDATE;
}
else
{
this.datePickerDateOfBirth.SelectedDate = this.CREW.CrewMemberDateOfBirth;
}
this.comboBoxIdDocType.ItemsSource = GlobalStructures.IDDocTypeDict;
this.comboBoxIdDocType.SelectedValue = this.CREW.CrewMemberIdentityDocumentType?.ToString();
this.textBoxIdDocNumber.Text = this.CREW.CrewMemberIdentityDocumentId;
this.textBoxVisaNumber.Text = this.CREW.CrewMemberVisaNumber;
this.comboBoxIssuingState.ItemsSource = bsmd.database.CREW.NationalityDict;
this.comboBoxIssuingState.SelectedValue = this.CREW.CrewMemberIdentityDocumentIssuingState;
if (this.CREW.CrewMemberIdentityDocumentExpiryDate > MAXDATE)
if (this.CREW.CrewMemberIdentityDocumentExpiryDate > CREW.CLAMPMAXDATE)
{
this.datePickerExpiryDate.SelectedDate = MAXDATE;
this.datePickerExpiryDate.SelectedDate = CREW.CLAMPMAXDATE;
}
else if(this.CREW.CrewMemberDateOfBirth < CREW.CLAMPMINDATE)
{
this.datePickerExpiryDate.SelectedDate = CREW.CLAMPMINDATE;
}
else
{
if (this.CREW.CrewMemberIdentityDocumentExpiryDate.HasValue)
this.datePickerExpiryDate.SelectedDate = MAXDATE;
{
this.datePickerExpiryDate.SelectedDate = this.CREW.CrewMemberIdentityDocumentExpiryDate;
}
// this.comboBoxCountryOfBirth.ItemsSource = bsmd.database.CREW.NationalityDict; // XXX: TODO
// this.comboBoxCountryOfBirth.SelectedValue = this.CREW.CrewMemberCountryOfBirth;

View File

@ -15,9 +15,7 @@ namespace ENI2.EditControls
/// Interaction logic for EditPasDialog.xaml
/// </summary>
public partial class EditPASDialog : EditWindowBase
{
private static DateTime MAXDATE = new DateTime(2198, 12, 31);
{
public EditPASDialog()
{
@ -38,10 +36,18 @@ namespace ENI2.EditControls
this.textBoxPlaceOfBirth.Text = this.PAS.PassengerPlaceOfBirth;
this.comboBoxNationality.ItemsSource = bsmd.database.CREW.NationalityDict;
this.comboBoxNationality.SelectedValue = this.PAS.PassengerNationality;
if (this.PAS.PassengerDateOfBirth > MAXDATE)
this.datePickerDateOfBirth.SelectedDate = MAXDATE;
if (this.PAS.PassengerDateOfBirth > CREW.CLAMPMAXDATE)
{
this.datePickerDateOfBirth.SelectedDate = CREW.CLAMPMAXDATE;
}
else if (this.PAS.PassengerDateOfBirth < CREW.CLAMPMINDATE)
{
this.datePickerDateOfBirth.SelectedDate = CREW.CLAMPMINDATE;
}
else
{
this.datePickerDateOfBirth.SelectedDate = this.PAS.PassengerDateOfBirth;
}
this.comboBoxIdDocType.ItemsSource = GlobalStructures.IDDocTypeDict;
this.comboBoxIdDocType.SelectedValue = this.PAS.PassengerIdentityDocumentType?.ToString();
this.textBoxIdDocNumber.Text = this.PAS.PassengerIdentityDocumentId;
@ -52,15 +58,19 @@ namespace ENI2.EditControls
this.comboBoxIssuingState.ItemsSource = bsmd.database.CREW.NationalityDict;
this.comboBoxIssuingState.SelectedValue = this.PAS.PassengerIdentityDocumentIssuingState;
if (this.PAS.PassengerIdentityDocumentExpiryDate > MAXDATE)
if (this.PAS.PassengerIdentityDocumentExpiryDate > CREW.CLAMPMAXDATE)
{
this.datePickerExpiryDate.SelectedDate = MAXDATE;
this.datePickerExpiryDate.SelectedDate = CREW.CLAMPMAXDATE;
}
else if (this.PAS.PassengerIdentityDocumentExpiryDate < CREW.CLAMPMINDATE)
{
this.datePickerExpiryDate.SelectedDate = CREW.CLAMPMINDATE;
}
else
{
if (this.PAS.PassengerIdentityDocumentExpiryDate.HasValue)
this.datePickerExpiryDate.SelectedDate = this.PAS.PassengerIdentityDocumentExpiryDate;
this.datePickerExpiryDate.SelectedDate = this.PAS.PassengerIdentityDocumentExpiryDate;
}
// XXX : TODO
//this.comboBoxCountryOfBirth.ItemsSource = bsmd.database.CREW.NationalityDict;
//this.comboBoxCountryOfBirth.SelectedValue = this.PAS.PassengerCountryOfBirth;

View File

@ -1450,7 +1450,7 @@ namespace ENI2.Excel
if (!(poc30d.PortOfCallLast30DaysCrewMembersJoined ?? false) && (PortOfCallLast30DaysCrewMembersJoinedFlag ?? false))
poc30d.PortOfCallLast30DaysCrewMembersJoined = true;
if (poc30d.PortOfCallLast30DaysCrewMembersJoined ?? false)
if (!crewNameString.IsNullOrEmpty() && (poc30d.PortOfCallLast30DaysCrewMembersJoined ?? false))
{
// try different separators
string[] crew = crewNameString.Split(';');

View File

@ -17,6 +17,9 @@ namespace bsmd.database
public class CREW : DatabaseEntity, ISublistElement, IBulkSaver
{
public static DateTime CLAMPMAXDATE = new DateTime(2198, 12, 31);
public static DateTime CLAMPMINDATE = new DateTime(1900, 1, 1);
public CREW()
{
this.tablename = "[dbo].[CREW]";
@ -297,6 +300,9 @@ namespace bsmd.database
{
if (this.CrewMemberIdentityDocumentExpiryDate.Equals(new DateTime(2100, 12, 31)))
violations.Add(RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "Id doc expiry date set to 31/12/2100", null, this.Title, this.Identifier, this.Tablename));
if ((this.CrewMemberIdentityDocumentExpiryDate >= CLAMPMAXDATE) || (this.CrewMemberIdentityDocumentExpiryDate <= CLAMPMINDATE))
violations.Add(RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "Check id doc expiry date", null, this.Title, this.Identifier, this.Tablename));
}
if (this.CrewMemberGender.HasValue)
@ -305,8 +311,11 @@ namespace bsmd.database
violations.Add(RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "Gender set to unknown", null, this.Title, this.Identifier, this.Tablename));
}
if ((this.CrewMemberDateOfBirth.HasValue) && (this.CrewMemberDateOfBirth.Value > DateTime.Today))
violations.Add(RuleEngine.CreateViolation(ValidationCode.TIME_IMPLAUSIBLE, "Date of birth is in the future", null, this.Title, this.Identifier, this.Tablename));
if (this.CrewMemberDateOfBirth.HasValue && (this.CrewMemberDateOfBirth.Value > DateTime.Today))
violations.Add(RuleEngine.CreateViolation(ValidationCode.TIME_IMPLAUSIBLE, "Date of birth is in the future", null, this.Title, this.Identifier, this.Tablename));
if (this.CrewMemberDateOfBirth.HasValue && (this.CrewMemberDateOfBirth.Value <= CLAMPMINDATE))
violations.Add(RuleEngine.CreateViolation(ValidationCode.TIME_IMPLAUSIBLE, "Check date of birth", null, this.Title, this.Identifier, this.Tablename));
}

View File

@ -354,6 +354,9 @@ namespace bsmd.database
{
if(this.PassengerIdentityDocumentExpiryDate.Equals(new DateTime(2100, 12, 31)))
violations.Add(RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "Id doc expiry date set to 31/12/2100", null, this.Title, this.Identifier, this.Tablename));
if ((this.PassengerDateOfBirth >= CREW.CLAMPMAXDATE) || (this.PassengerDateOfBirth <= CREW.CLAMPMINDATE))
violations.Add(RuleEngine.CreateViolation(ValidationCode.TIME_IMPLAUSIBLE, "Check identity document expiry date", null, this.Title, this.Identifier, this.Tablename));
}
if(this.PassengerGender.HasValue)
@ -362,8 +365,14 @@ namespace bsmd.database
violations.Add(RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "Gender set to unknown", null, this.Title, this.Identifier, this.Tablename));
}
if ((this.PassengerDateOfBirth.HasValue) && (this.PassengerDateOfBirth.Value > DateTime.Today))
violations.Add(RuleEngine.CreateViolation(ValidationCode.TIME_IMPLAUSIBLE, "Date of birth is in the future", null, this.Title, this.Identifier, this.Tablename));
if (this.PassengerDateOfBirth.HasValue)
{
if (this.PassengerDateOfBirth.Value > DateTime.Today)
violations.Add(RuleEngine.CreateViolation(ValidationCode.TIME_IMPLAUSIBLE, "Date of birth is in the future", null, this.Title, this.Identifier, this.Tablename));
if(this.PassengerDateOfBirth <= CREW.CLAMPMINDATE)
violations.Add(RuleEngine.CreateViolation(ValidationCode.TIME_IMPLAUSIBLE, "Check date of birth", null, this.Title, this.Identifier, this.Tablename));
}
}