public void TestAddingCollection() { TVerificationResult res; TVerificationResultCollection coll = new TVerificationResultCollection(); TVerificationResultCollection coll2 = new TVerificationResultCollection(); res = new TVerificationResult(null, "test1", TResultSeverity.Resv_Noncritical); coll2.Add(res); res = new TVerificationResult(null, "test2", TResultSeverity.Resv_Noncritical); coll2.Add(res); Assert.AreEqual(2, coll2.Count, "there should be two verification results in the coll2 collection"); Assert.AreEqual(0, coll.Count, "there should be no verification results in the coll collection"); coll.AddCollection(coll2); Assert.AreEqual(2, coll.Count, "there should be two verification results in the coll collection after the adding of coll2"); Assert.AreEqual("test1", coll[0].ResultText, "added result text should be test1"); Assert.AreEqual("test2", coll[1].ResultText, "added result text should be test2"); coll2 = new TVerificationResultCollection(); res = new TVerificationResult(null, "test3", TResultSeverity.Resv_Noncritical); coll2.Add(res); res = new TVerificationResult(null, "test4", TResultSeverity.Resv_Noncritical); coll2.Add(res); coll.AddCollection(coll2); Assert.AreEqual(4, coll.Count, "there should be four verification results in the coll collection after the adding of coll2 another time"); Assert.AreEqual("test3", coll[2].ResultText, "added result text should be test3"); Assert.AreEqual("test4", coll[3].ResultText, "added result text should be test4"); }
private void ValidateDataDetailsManual(PPartnerGiftDestinationRow ARow) { TVerificationResultCollection VerificationResultCollection = FPetraUtilsObject.VerificationResultCollection; TSharedPartnerValidation_Partner.ValidateGiftDestinationRowManual(this, ARow, ref VerificationResultCollection, FPetraUtilsObject.ValidationControlsDict); // add VerificationResults from validating on all data (FPetraUtilsObject_DataSaved) VerificationResultCollection.AddCollection(FVerificationResultCollection); FVerificationResultCollection = null; }
private void ValidateDataDetailsManual(PPartnerGiftDestinationRow ARow) { TVerificationResultCollection VerificationResultCollection = FPetraUtilsObject.VerificationResultCollection; TSharedPartnerValidation_Partner.ValidateGiftDestinationRowManual(this, ARow, ref VerificationResultCollection, FPetraUtilsObject.ValidationControlsDict); if (VerificationResultCollection.HasCriticalErrors) // If something went wrong - allow the user to fix it! { dtpDetailDateEffective.Enabled = true; txtDetailFieldKey.Enabled = true; } // add VerificationResults from validating on all data (FPetraUtilsObject_DataSaved) VerificationResultCollection.AddCollection(FVerificationResultCollection); FVerificationResultCollection = null; }
/// <summary> /// Main Entry point. The parameters are the same as in /// Ict.Petra.Server.MFinance.GL.WebConnectors.TPeriodMonthEnd /// </summary> /// <param name="AInfoMode"></param> /// <param name="AglBatchNumbers">The Client should print the generated Batches</param> /// <param name="AStewardshipBatch">True if Stewardship Batch was generated</param> /// <param name="AVRCollection"></param> /// <returns>false if it went OK</returns> public bool RunMonthEnd( bool AInfoMode, out List <Int32> AglBatchNumbers, out Boolean AStewardshipBatch, out TVerificationResultCollection AVRCollection) { FInfoMode = AInfoMode; FverificationResults = new TVerificationResultCollection(); AVRCollection = FverificationResults; AStewardshipBatch = false; TPeriodEndOperations.FwasCancelled = false; AglBatchNumbers = new List <int>(); if (FledgerInfo.ProvisionalYearEndFlag) { // we want to run a month end, but the provisional year end flag has been set TVerificationResult tvt = new TVerificationResult(Catalog.GetString("Year End is required!"), Catalog.GetString("In this situation you cannot run a month end routine"), "", TPeriodEndErrorAndStatusCodes.PEEC_03.ToString(), TResultSeverity.Resv_Critical); FverificationResults.Add(tvt); FHasCriticalErrors = true; return(true); } if (AInfoMode) { AAccountingPeriodTable PeriodTbl = null; TDBTransaction Transaction = null; DBAccess.GDBAccessObj.GetNewOrExistingAutoReadTransaction(IsolationLevel.ReadUncommitted, TEnforceIsolationLevel.eilMinimum, ref Transaction, delegate { PeriodTbl = AAccountingPeriodAccess.LoadByPrimaryKey(FledgerInfo.LedgerNumber, FledgerInfo.CurrentPeriod, Transaction); }); if (PeriodTbl.Rows.Count > 0) { FverificationResults.Add( new TVerificationResult( Catalog.GetString("Month End"), String.Format(Catalog.GetString("Current period is {0} - {1}"), PeriodTbl[0].PeriodStartDate.ToShortDateString(), PeriodTbl[0].PeriodEndDate.ToShortDateString()), TResultSeverity.Resv_Status)); } } RunPeriodEndCheck(new RunMonthEndChecks(FledgerInfo), FverificationResults); if (!AInfoMode) { TVerificationResultCollection IchVerificationResults; if (!StewardshipCalculationDelegate(FledgerInfo.LedgerNumber, FledgerInfo.CurrentPeriod, out AglBatchNumbers, out IchVerificationResults)) { FHasCriticalErrors = true; } // Merge VerificationResults: FverificationResults.AddCollection(IchVerificationResults); if (AglBatchNumbers.Count > 0) { AStewardshipBatch = true; } } // RunPeriodEndSequence(new RunMonthlyAdminFees(), "Example"); if (TPeriodEndOperations.FwasCancelled) { FverificationResults.Add(new TVerificationResult(Catalog.GetString("Month End"), Catalog.GetString("Process was cancelled by user."), "", TPeriodEndErrorAndStatusCodes.PEEC_12.ToString(), TResultSeverity.Resv_Critical)); FHasCriticalErrors = true; } if (!FInfoMode) { if (!FHasCriticalErrors) { SetNextPeriod(null); NoteForexRevalRequired(FledgerInfo.LedgerNumber, FledgerInfo.CurrentFinancialYear, FledgerInfo.CurrentPeriod); // refresh cached ledger table, so that the client will know the current period TCacheableTablesManager.GCacheableTablesManager.MarkCachedTableNeedsRefreshing( TCacheableFinanceTablesEnum.LedgerDetails.ToString()); } } return(FHasCriticalErrors); }
/// <summary> /// Main Entry point. The parameters are the same as in /// Ict.Petra.Server.MFinance.GL.WebConnectors.TPeriodMonthEnd /// </summary> /// <param name="AInfoMode"></param> /// <param name="AVRCollection"></param> /// <returns>false if it went OK</returns> public bool RunMonthEnd(bool AInfoMode, out TVerificationResultCollection AVRCollection) { FInfoMode = AInfoMode; FverificationResults = new TVerificationResultCollection(); AVRCollection = FverificationResults; if (FledgerInfo.ProvisionalYearEndFlag) { // we want to run a month end, but the provisional year end flag has been set TVerificationResult tvt = new TVerificationResult(Catalog.GetString("Year End is required!"), Catalog.GetString("In this situation you cannot run a month end routine"), "", TPeriodEndErrorAndStatusCodes.PEEC_03.ToString(), TResultSeverity.Resv_Critical); FverificationResults.Add(tvt); FHasCriticalErrors = true; return(true); } if (AInfoMode) { AAccountingPeriodTable PeriodTbl = null; TDBTransaction Transaction = null; DBAccess.GDBAccessObj.GetNewOrExistingAutoReadTransaction(IsolationLevel.ReadUncommitted, ref Transaction, delegate { PeriodTbl = AAccountingPeriodAccess.LoadByPrimaryKey(FledgerInfo.LedgerNumber, FledgerInfo.CurrentPeriod, Transaction); }); if (PeriodTbl.Rows.Count > 0) { FverificationResults.Add( new TVerificationResult( Catalog.GetString("Month End"), String.Format(Catalog.GetString("Current period is {0} - {1}"), PeriodTbl[0].PeriodStartDate.ToShortDateString(), PeriodTbl[0].PeriodEndDate.ToShortDateString()), TResultSeverity.Resv_Status)); } } RunPeriodEndCheck(new RunMonthEndChecks(FledgerInfo), FverificationResults); if (!AInfoMode) { TVerificationResultCollection IchVerificationReults; if (!StewardshipCalculationDelegate(FledgerInfo.LedgerNumber, FledgerInfo.CurrentPeriod, out IchVerificationReults)) { FHasCriticalErrors = true; } // Merge VerificationResults: FverificationResults.AddCollection(IchVerificationReults); } // RunPeriodEndSequence(new RunMonthlyAdminFees(), "Example"); if (!FInfoMode) { if (!FHasCriticalErrors) { SetNextPeriod(); // refresh cached ledger table, so that the client will know the current period TCacheableTablesManager.GCacheableTablesManager.MarkCachedTableNeedsRefreshing( TCacheableFinanceTablesEnum.LedgerDetails.ToString()); } } // // The 4GL code throws out these reports: // // Admin fee calculations report. // ICH stewardship report. // "Trial Balance" with account details. // HOSA for each foreign cost centre (ledger/fund). // Income Statement/Profit & Loss // Current Accounts Payable if interfaced. M025 // AFO report. // Executive Summary Report. // return(FHasCriticalErrors); }