private void ValidateDataManual(PmGeneralApplicationRow ARow) { TVerificationResultCollection VerificationResultCollection = FPetraUtilsObject.VerificationResultCollection; DataColumn ValidationColumn; TValidationControlsData ValidationControlsData; TVerificationResult VerificationResult = null; TSharedPersonnelValidation_Personnel.ValidateGeneralApplicationManual(this, ARow, true, ref VerificationResultCollection, FValidationControlsDict); TSharedPersonnelValidation_Personnel.ValidateEventApplicationManual(this, FMainDS.PmShortTermApplication[0], ref VerificationResultCollection, FValidationControlsDict); if (FDelegateCheckEventApplicationDuplicate != null) { // Same 'Event' must only exist for one application per person ValidationColumn = FMainDS.PmShortTermApplication[0].Table.Columns[PmShortTermApplicationTable.ColumnStConfirmedOptionId]; if (FValidationControlsDict.TryGetValue(ValidationColumn, out ValidationControlsData)) { if (FDelegateCheckEventApplicationDuplicate(ARow.ApplicationKey, ARow.RegistrationOffice, FMainDS.PmShortTermApplication[0].StConfirmedOption)) { VerificationResult = new TScreenVerificationResult(new TVerificationResult(this, ErrorCodes.GetErrorInfo(PetraErrorCodes.ERR_APPLICATION_DUPLICATE_EVENT, new string[] { FMainDS.PmShortTermApplication[0].StConfirmedOption.ToString() })), ValidationColumn, ValidationControlsData.ValidationControl); // Handle addition to/removal from TVerificationResultCollection. // Only add/remove verification result if duplicate found as same field has already been // handled in TSharedPersonnelValidation_Personnel.ValidateEventApplicationManual VerificationResultCollection.Auto_Add_Or_AddOrRemove(this, VerificationResult, ValidationColumn); } } } }
// The main validation method for the controls on this tab page private void ValidateDataManual(ALedgerRow ARow) { TVerificationResultCollection VerificationResultCollection = FPetraUtilsObject.VerificationResultCollection; DataColumn ValidationColumn; TValidationControlsData ValidationControlsData; TVerificationResult VerificationResult = null; // make sure that Financial Year Start Date is no later than 28th of a month // (this field is not part of a_ledger but will be stored in period 1 of a_accounting_period) if (rbtMonthly.Checked) { // make sure that Financial Year Start Date is not empty // (this field is not part of a_ledger but will be stored in period 1 of a_accounting_period) if (dtpFinancialYearStartDate.Date == null) { VerificationResult = new TScreenVerificationResult( TDateChecks.IsNotUndefinedDateTime( dtpFinancialYearStartDate.Date, lblFinancialYearStartDate.Text.Trim(':'), true, this), null, dtpFinancialYearStartDate); } else if (dtpFinancialYearStartDate.Date.Value.Day > 28) { VerificationResult = new TScreenVerificationResult( this, new DataColumn(), ErrorCodes.GetErrorInfo(PetraErrorCodes.ERR_PERIOD_START_DAY_AFTER_28).ErrorMessageText, PetraErrorCodes.ERR_PERIOD_START_DAY_AFTER_28, dtpFinancialYearStartDate, TResultSeverity.Resv_Critical); } else { VerificationResult = null; } // Handle addition/removal to/from TVerificationResultCollection VerificationResultCollection.Auto_Add_Or_AddOrRemove(this, VerificationResult, null); } // check that there no suspense accounts for this ledger if box is unticked ValidationColumn = ARow.Table.Columns[ALedgerTable.ColumnSuspenseAccountFlagId]; if (FValidationControlsDict.TryGetValue(ValidationColumn, out ValidationControlsData)) { if (!ARow.SuspenseAccountFlag) { if (TRemote.MFinance.Common.ServerLookups.WebConnectors.HasSuspenseAccounts(FLedgerNumber)) { VerificationResult = new TScreenVerificationResult(new TVerificationResult(this, ErrorCodes.GetErrorInfo(PetraErrorCodes.ERR_NO_SUSPENSE_ACCOUNTS_ALLOWED)), ValidationColumn, ValidationControlsData.ValidationControl); } else { VerificationResult = null; } // Handle addition/removal to/from TVerificationResultCollection VerificationResultCollection.Auto_Add_Or_AddOrRemove(this, VerificationResult, ValidationColumn); } } // check that the number of forwarding periods is not less than the already used ones ValidationColumn = ARow.Table.Columns[ALedgerTable.ColumnNumberFwdPostingPeriodsId]; if (FValidationControlsDict.TryGetValue(ValidationColumn, out ValidationControlsData)) { if (ARow.NumberFwdPostingPeriods < FMainForm.CurrentForwardPostingPeriods) { VerificationResult = new TScreenVerificationResult(new TVerificationResult(this, ErrorCodes.GetErrorInfo(PetraErrorCodes.ERR_NUMBER_FWD_PERIODS_TOO_SMALL, new string[] { FMainForm.CurrentForwardPostingPeriods.ToString(), FMainForm.CurrentForwardPostingPeriods.ToString() })), ValidationColumn, ValidationControlsData.ValidationControl); } else { VerificationResult = null; } // Handle addition/removal to/from TVerificationResultCollection VerificationResultCollection.Auto_Add_Or_AddOrRemove(this, VerificationResult, ValidationColumn); } // check that current period is not greater than number of ledger periods ValidationColumn = ARow.Table.Columns[ALedgerTable.ColumnNumberOfAccountingPeriodsId]; if (FValidationControlsDict.TryGetValue(ValidationColumn, out ValidationControlsData)) { if (ARow.CurrentPeriod > ARow.NumberOfAccountingPeriods) { VerificationResult = new TScreenVerificationResult(new TVerificationResult(this, ErrorCodes.GetErrorInfo(PetraErrorCodes.ERR_CURRENT_PERIOD_TOO_LATE)), ValidationColumn, ValidationControlsData.ValidationControl); } else { VerificationResult = null; } // Handle addition/removal to/from TVerificationResultCollection VerificationResultCollection.Auto_Add_Or_AddOrRemove(this, VerificationResult, ValidationColumn); } }