private void ValidateDataManual(PmPersonalDataRow ARow) { TVerificationResultCollection VerificationResultCollection = FPetraUtilsObject.VerificationResultCollection; TSharedPersonnelValidation_Personnel.ValidatePersonalDataManual(this, ARow, ref VerificationResultCollection, FValidationControlsDict); }
/// create new PM data public static PDataLabelTable CreateNewPMData(long AFromPartnerKey, long AToPartnerKey, IndividualDataTDS AMainDS, TDataBase ADataBase = null) { TDataBase db = DBAccess.Connect("CreateNewPMData", ADataBase); TDBTransaction Transaction = db.BeginTransaction(IsolationLevel.ReadCommitted); // Create a new DataLabel record PDataLabelTable AllDataLabelTable = PDataLabelAccess.LoadAll(Transaction); PDataLabelTable DataLabelTable = new PDataLabelTable(); PDataLabelRow DataLabelRow = DataLabelTable.NewRowTyped(); // Get the first available key, which is our unique primary key field Int32 Key = 1; while (AllDataLabelTable.Rows.Find(new object[] { Key }) != null) { Key++; } DataLabelRow.Key = Key; DataLabelRow.DataType = "char"; DataLabelTable.Rows.Add(DataLabelRow); // Create a new DataLabelValuePartner record PDataLabelValuePartnerRow DataLabelValuePartner = AMainDS.PDataLabelValuePartner.NewRowTyped(); DataLabelValuePartner.PartnerKey = AFromPartnerKey; DataLabelValuePartner.DataLabelKey = DataLabelRow.Key; AMainDS.PDataLabelValuePartner.Rows.Add(DataLabelValuePartner); // Create a new PassportDetails record IndividualDataTDSPmPassportDetailsRow PassportDetails = AMainDS.PmPassportDetails.NewRowTyped(); PassportDetails.PartnerKey = AFromPartnerKey; PassportDetails.PassportNumber = "0"; PassportDetails.PassportNationalityName = "IRELAND"; AMainDS.PmPassportDetails.Rows.Add(PassportDetails); // Create two new PersonalData records PmPersonalDataRow FromPersonalData = AMainDS.PmPersonalData.NewRowTyped(); FromPersonalData.PartnerKey = AFromPartnerKey; FromPersonalData.HeightCm = 175; FromPersonalData.WeightKg = 80; AMainDS.PmPersonalData.Rows.Add(FromPersonalData); PmPersonalDataRow ToPersonalData = AMainDS.PmPersonalData.NewRowTyped(); ToPersonalData.PartnerKey = AToPartnerKey; ToPersonalData.WeightKg = 95; AMainDS.PmPersonalData.Rows.Add(ToPersonalData); Transaction.Rollback(); return(DataLabelTable); }
/// <summary> /// Validates the personal (miscellaneous) data of a Person. /// </summary> /// <param name="AContext">Context that describes where the data validation failed.</param> /// <param name="ARow">The <see cref="DataRow" /> which holds the the data against which the validation is run.</param> /// <param name="AVerificationResultCollection">Will be filled with any <see cref="TVerificationResult" /> items if /// data validation errors occur.</param> /// <param name="AValidationControlsDict">A <see cref="TValidationControlsDict" /> containing the Controls that /// display data that is about to be validated.</param> /// <returns>void</returns> public static void ValidatePersonalDataManual(object AContext, PmPersonalDataRow ARow, ref TVerificationResultCollection AVerificationResultCollection, TValidationControlsDict AValidationControlsDict) { DataColumn ValidationColumn; TValidationControlsData ValidationControlsData; TVerificationResult VerificationResult; // Don't validate deleted DataRows if (ARow.RowState == DataRowState.Deleted) { return; } // 'Believer since year' must have a sensible value (must not be below 1850 and must not lie in the future) ValidationColumn = ARow.Table.Columns[PmPersonalDataTable.ColumnBelieverSinceYearId]; if (AValidationControlsDict.TryGetValue(ValidationColumn, out ValidationControlsData)) { if (!ARow.IsBelieverSinceYearNull() && (ARow.BelieverSinceYear != 0)) { VerificationResult = TDateChecks.IsDateBetweenDates( new DateTime(ARow.BelieverSinceYear, 12, 31), new DateTime(1850, 1, 1), new DateTime(DateTime.Today.Year, 12, 31), ValidationControlsData.ValidationControlLabel, TDateBetweenDatesCheckType.dbdctUnrealisticDate, TDateBetweenDatesCheckType.dbdctNoFutureDate, AContext, ValidationColumn, ValidationControlsData.ValidationControl); // Handle addition to/removal from TVerificationResultCollection AVerificationResultCollection.Auto_Add_Or_AddOrRemove(AContext, VerificationResult, ValidationColumn); } } }
private void ValidateDataManual(PmPersonalDataRow ARow) { TVerificationResultCollection VerificationResultCollection = FPetraUtilsObject.VerificationResultCollection; TSharedPersonnelValidation_Personnel.ValidatePersonalDataManual(this, ARow, ref VerificationResultCollection, FValidationControlsDict); }