Exemplo n.º 1
0
        /// <summary>
        /// Imports a string value from the specified text line using the specified delimiter
        /// </summary>
        /// <param name="AImportLine">The line containing the text to be imported.  When the method returns the imported value
        /// will have been removed from the start ready for the next call to an Import method.</param>
        /// <param name="ADelimiter">The delimiter</param>
        /// <param name="AColumnTitle"></param>
        /// <param name="ADataColumn"></param>
        /// <param name="ARowNumber"></param>
        /// <param name="AMessages"></param>
        /// <param name="AValidationColumnsDict"></param>
        /// <param name="ATreatEmptyStringAsText">When true the return value will be the empty string. When false the return value will be null.</param>
        /// <returns>The string value.  The AImportLine parameter will have been clipped.</returns>
        public static String ImportString(ref String AImportLine,
            String ADelimiter,
            String AColumnTitle,
            DataColumn ADataColumn,
            int ARowNumber,
            TVerificationResultCollection AMessages,
            TValidationControlsDict AValidationColumnsDict,
            bool ATreatEmptyStringAsText = true)
        {
            if ((ADataColumn != null) && (AValidationColumnsDict != null) && !AValidationColumnsDict.ContainsKey(ADataColumn))
            {
                AValidationColumnsDict.Add(ADataColumn, new TValidationControlsData(null, AColumnTitle));
            }

            String sReturn = StringHelper.GetNextCSV(ref AImportLine, ADelimiter);

            if ((sReturn == StringHelper.CSV_STRING_FORMAT_ERROR) && (AMessages != null))
            {
                AMessages.Add(new TVerificationResult(String.Format(MCommonConstants.StrParsingErrorInLineColumn, ARowNumber, AColumnTitle),
                        Catalog.GetString("Could not parse the quoted string. Did you forget a quotation mark?"),
                        TResultSeverity.Resv_Critical));
            }

            if ((sReturn.Length == 0) && !ATreatEmptyStringAsText)
            {
                return null;
            }

            return sReturn;
        }
        /// <summary>
        /// Processes the result of a data submission to the Server where the result of that operation is
        /// <see cref="TSubmitChangesResult.scrOK" />. (Overload for DataTables.)
        /// </summary>
        /// <param name="ACallingFormOrUserControl"></param>
        /// <param name="ALocalDT"></param>
        /// <param name="ASubmitDT"></param>
        /// <param name="APetraUtilsObject"></param>
        /// <param name="AVerificationResults"></param>
        /// <param name="ASetPrimaryKeyOnlyMethod"></param>
        /// <param name="AMasterDataTableSaveCall"></param>
        /// <param name="ACalledFromUserControl"></param>
        /// <param name="ACallAcceptChangesOnReturnedDataBeforeMerge"></param>
        public static void ProcessSubmitChangesResultOK(IFrmPetra ACallingFormOrUserControl, DataTable ALocalDT,
            DataTable ASubmitDT, TFrmPetraEditUtils APetraUtilsObject, TVerificationResultCollection AVerificationResults,
            Action <bool>ASetPrimaryKeyOnlyMethod, bool AMasterDataTableSaveCall, bool ACalledFromUserControl,
            bool ACallAcceptChangesOnReturnedDataBeforeMerge = false)
        {
            if (AMasterDataTableSaveCall)
            {
                // Call AcceptChanges to get rid now of any deleted columns before we Merge with the result from the Server
                ALocalDT.AcceptChanges();

                // Merge back with data from the Server (eg. for getting Sequence values)
                if (ACallAcceptChangesOnReturnedDataBeforeMerge)
                {
                    ASubmitDT.AcceptChanges();
                }

                ALocalDT.Merge(ASubmitDT, false);

                // Need to accept any new modification ID's
                ALocalDT.AcceptChanges();

                if (ASetPrimaryKeyOnlyMethod != null)
                {
                    // Ensure the Primary-Key(s)-containing Controls are disabled to prevent further modification of Primary Key values
                    ASetPrimaryKeyOnlyMethod(true);
                }
            }

            CommonPostMergeOperations(ACallingFormOrUserControl, APetraUtilsObject,
                AVerificationResults, ACalledFromUserControl);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Validates the MPartner Marital Status screen data.
        /// </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>
        public static void ValidateConferenceCostType(object AContext, PcCostTypeRow ARow,
            ref TVerificationResultCollection AVerificationResultCollection, TValidationControlsDict AValidationControlsDict)
        {
            DataColumn ValidationColumn;
            TValidationControlsData ValidationControlsData;
            TVerificationResult VerificationResult = null;

            // Don't validate deleted DataRows
            if (ARow.RowState == DataRowState.Deleted)
            {
                return;
            }

            // 'UnassignableDate' must not be empty if the flag is set
            ValidationColumn = ARow.Table.Columns[PcCostTypeTable.ColumnUnassignableDateId];

            if (AValidationControlsDict.TryGetValue(ValidationColumn, out ValidationControlsData))
            {
                if (ARow.UnassignableFlag)
                {
                    VerificationResult = TSharedValidationControlHelper.IsNotInvalidDate(ARow.UnassignableDate,
                        ValidationControlsData.ValidationControlLabel, AVerificationResultCollection, true,
                        AContext, ValidationColumn, ValidationControlsData.ValidationControl);
                }

                // Handle addition to/removal from TVerificationResultCollection
                AVerificationResultCollection.Auto_Add_Or_AddOrRemove(AContext, VerificationResult, ValidationColumn);
            }
        }
Exemplo n.º 4
0
        private string EvaluateVerificationResults(TVerificationResult AExpectedResult, TVerificationResult ATestResult)
        {
            TVerificationResultCollection Tmp;

            if (!TVerificationHelper.AreVerificationResultsIdentical(ATestResult, AExpectedResult))
            {
                Tmp = new TVerificationResultCollection();

                if (AExpectedResult != null)
                {
                    Tmp.Add(AExpectedResult);
                }

                if (ATestResult != null)
                {
                    Tmp.Add(ATestResult);
                }

                return TVerificationHelper.FormatVerificationCollectionItems(Tmp);
            }
            else
            {
                return String.Empty;
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// Detail 'Amount' must be positive or 0
        /// </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>
        public static void ValidateApDocumentDetailManual(object AContext, AApDocumentDetailRow ARow,
            ref TVerificationResultCollection AVerificationResultCollection, TValidationControlsDict AValidationControlsDict)
        {
            DataColumn ValidationColumn;
            TValidationControlsData ValidationControlsData;
            TVerificationResult VerificationResult;

            // Don't validate deleted DataRows
            if (ARow.RowState == DataRowState.Deleted)
            {
                return;
            }

            // 'Detail Amount' must be positive or 0
            ValidationColumn = ARow.Table.Columns[AApDocumentDetailTable.ColumnAmountId];

            if (AValidationControlsDict.TryGetValue(ValidationColumn, out ValidationControlsData))
            {
                VerificationResult = TNumericalChecks.IsPositiveOrZeroDecimal(ARow.Amount,
                    ValidationControlsData.ValidationControlLabel,
                    AContext, ValidationColumn, ValidationControlsData.ValidationControl);

                // Handle addition/removal to/from TVerificationResultCollection
                AVerificationResultCollection.Auto_Add_Or_AddOrRemove(AContext, VerificationResult, ValidationColumn);
            }
        }
        static partial void ValidateGiftDetailManual(ref TVerificationResultCollection AVerificationResult,
            TTypedDataTable ASubmitTable)
        {
            TValidationControlsDict ValidationControlsDict = new TValidationControlsDict();

            ValidationControlsDict.Add(ASubmitTable.Columns[AGiftDetailTable.ColumnGiftCommentOneId],
                new TValidationControlsData(null, AGiftDetailTable.GetGiftCommentOneDBName()));

            TPartnerClass RecipientPartnerClass;
            string RecipientDescription;

            for (int Counter = 0; Counter < ASubmitTable.Rows.Count; Counter++)
            {
                if (ASubmitTable.Rows[Counter].RowState != DataRowState.Deleted)
                {
                    TPartnerServerLookups.GetPartnerShortName(((GiftBatchTDSAGiftDetailRow)ASubmitTable.Rows[Counter]).RecipientKey,
                        out RecipientDescription,
                        out RecipientPartnerClass);

                    TSharedFinanceValidation_Gift.ValidateGiftDetailManual("TTransactionWebConnector" +
                        " (Error in Row #" + Counter.ToString() + ")",  // No translation of message text since the server's messages should be all in English
                        (GiftBatchTDSAGiftDetailRow)ASubmitTable.Rows[Counter], ref AVerificationResult,
                        ValidationControlsDict, RecipientPartnerClass);
                }
            }
        }
Exemplo n.º 7
0
        //
        // Put Methods for the validation of Personnel Module WebConnectors in this code file.
        //

        static partial void ValidatePersonnelStaffManual(ref TVerificationResultCollection AVerificationResult,
            TTypedDataTable ASubmitTable)
        {
            TValidationControlsDict ValidationControlsDict = new TValidationControlsDict();

            ValidationControlsDict.Add(ASubmitTable.Columns[PmStaffDataTable.ColumnReceivingFieldId],
                new TValidationControlsData(null, PmStaffDataTable.GetReceivingFieldDBName()));
            ValidationControlsDict.Add(ASubmitTable.Columns[PmStaffDataTable.ColumnStartOfCommitmentId],
                new TValidationControlsData(null, PmStaffDataTable.GetStartOfCommitmentDBName()));
            ValidationControlsDict.Add(ASubmitTable.Columns[PmStaffDataTable.ColumnEndOfCommitmentId],
                new TValidationControlsData(null, PmStaffDataTable.GetEndOfCommitmentDBName(),
                    null, PmStaffDataTable.GetStartOfCommitmentDBName()));
            ValidationControlsDict.Add(ASubmitTable.Columns[PmStaffDataTable.ColumnStatusCodeId],
                new TValidationControlsData(null, PmStaffDataTable.GetStatusCodeDBName()));
            ValidationControlsDict.Add(ASubmitTable.Columns[PmStaffDataTable.ColumnHomeOfficeId],
                new TValidationControlsData(null, PmStaffDataTable.GetHomeOfficeDBName()));
            ValidationControlsDict.Add(ASubmitTable.Columns[PmStaffDataTable.ColumnOfficeRecruitedById],
                new TValidationControlsData(null, PmStaffDataTable.GetOfficeRecruitedByDBName()));

            for (int Counter = 0; Counter < ASubmitTable.Rows.Count; Counter++)
            {
                TSharedPersonnelValidation_Personnel.ValidateCommitmentManual("TPersonnelWebConnector" +
                    " (Error in Row #" + Counter.ToString() + ")",  // No translation of message text since the server's messages should be all in English
                    (PmStaffDataRow)ASubmitTable.Rows[Counter], ref AVerificationResult,
                    ValidationControlsDict);
            }
        }
Exemplo n.º 8
0
        /// <summary>
        /// Validates the GL Batch data.
        /// </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>
        /// <param name="AStartDateCurrentPeriod">If the caller knows this value it can be supplied. Otherwise the server will supply the value for the ledger.</param>
        /// <param name="AEndDateLastForwardingPeriod">If the caller knows this value it can be supplied. Otherwise the server will supply the value for the ledger.</param>
        /// <returns>True if the validation found no data validation errors, otherwise false.</returns>
        public static bool ValidateGLBatchManual(object AContext, ABatchRow ARow,
            ref TVerificationResultCollection AVerificationResultCollection, TValidationControlsDict AValidationControlsDict,
            DateTime? AStartDateCurrentPeriod = null, DateTime? AEndDateLastForwardingPeriod = null)
        {
            DataColumn ValidationColumn;
            TValidationControlsData ValidationControlsData;
            TScreenVerificationResult VerificationResult;
            object ValidationContext;
            int VerifResultCollAddedCount = 0;

            // Don't validate deleted or posted DataRows
            if ((ARow.RowState == DataRowState.Deleted) || (ARow.BatchStatus == MFinanceConstants.BATCH_POSTED)
                || (ARow.BatchStatus == MFinanceConstants.BATCH_CANCELLED))
            {
                return true;
            }

            bool isImporting = AContext.ToString().Contains("Importing");

            // 'Effective From Date' must be valid
            ValidationColumn = ARow.Table.Columns[ABatchTable.ColumnDateEffectiveId];
            ValidationContext = ARow.BatchNumber;

            DateTime StartDateCurrentPeriod;
            DateTime EndDateLastForwardingPeriod;

            if ((AStartDateCurrentPeriod == null) || (AEndDateLastForwardingPeriod == null))
            {
                TSharedFinanceValidationHelper.GetValidPostingDateRange(ARow.LedgerNumber,
                    out StartDateCurrentPeriod,
                    out EndDateLastForwardingPeriod);
            }
            else
            {
                StartDateCurrentPeriod = AStartDateCurrentPeriod.Value;
                EndDateLastForwardingPeriod = AEndDateLastForwardingPeriod.Value;
            }

            if (AValidationControlsDict.TryGetValue(ValidationColumn, out ValidationControlsData))
            {
                VerificationResult = (TScreenVerificationResult)TDateChecks.IsDateBetweenDates(ARow.DateEffective,
                    StartDateCurrentPeriod,
                    EndDateLastForwardingPeriod,
                    ValidationControlsData.ValidationControlLabel + (isImporting ? String.Empty : " of Batch Number " + ValidationContext.ToString()),
                    TDateBetweenDatesCheckType.dbdctUnspecific,
                    TDateBetweenDatesCheckType.dbdctUnspecific,
                    AContext,
                    ValidationColumn,
                    ValidationControlsData.ValidationControl);

                // Handle addition/removal to/from TVerificationResultCollection
                if (AVerificationResultCollection.Auto_Add_Or_AddOrRemove(AContext, VerificationResult, ValidationColumn, true))
                {
                    VerifResultCollAddedCount++;
                }
            }

            return VerifResultCollAddedCount == 0;
        }
Exemplo n.º 9
0
 /// <summary>
 /// submit changes of table
 /// </summary>
 /// <param name="AInspectTable"></param>
 /// <param name="AResponseTable"></param>
 /// <param name="AVerificationResult"></param>
 /// <returns></returns>
 public TSubmitChangesResult SubmitChanges(ref DataTable AInspectTable,
     ref DataTable AResponseTable,
     out TVerificationResultCollection AVerificationResult)
 {
     // TODO
     AVerificationResult = new TVerificationResultCollection();
     return TSubmitChangesResult.scrError;
 }
Exemplo n.º 10
0
 /// <summary></summary>
 public void Test1(TVerificationResultCollection tvr)
 {
     FverificationResults = tvr;
     TestOperation testOperation = new TestOperation(1);
     testOperation.SetJobSize(12);
     testOperation.IsInInfoMode = true;
     RunPeriodEndSequence(testOperation, "Message");
     Assert.AreEqual(1, testOperation.GetOperationCount());
 }
Exemplo n.º 11
0
 /// <summary>
 /// facade call
 /// </summary>
 /// <param name="AErrorCode"></param>
 /// <param name="AContext"></param>
 /// <param name="AMessageLine1"></param>
 /// <param name="AMessageLine2"></param>
 /// <param name="AMessageLine3"></param>
 /// <param name="AVerificationResult"></param>
 /// <returns></returns>
 public static Boolean AddErrorLogEntry(String AErrorCode,
     String AContext,
     String AMessageLine1,
     String AMessageLine2,
     String AMessageLine3,
     ref TVerificationResultCollection AVerificationResult)
 {
     return TErrorLog.AddErrorLogEntry(AErrorCode, AContext, AMessageLine1, AMessageLine2, AMessageLine3, ref AVerificationResult);
 }
        private bool ValidateManual()
        {
            TVerificationResultCollection VerificationResultCollection = new TVerificationResultCollection();

            TSharedFinanceValidation_GL.ValidateGLBatchDateManual(dtpReversalDate.Date, dtpReversalDate.Description,
                ref VerificationResultCollection, FStartDateCurrentPeriod, FEndDateLastForwardingPeriod, dtpReversalDate);

            return TDataValidation.ProcessAnyDataValidationErrors(false, VerificationResultCollection, this.GetType(), dtpReversalDate.GetType());
        }
Exemplo n.º 13
0
        /// <summary>
        /// Validates the MConference Standard Cost Setup screen data.
        /// </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>
        /// <param name="AGridData">A <see cref="TValidationControlsDict" />Contains all rows that are included in the grid</param>
        public static void ValidateConferenceStandardCost(object AContext, PcConferenceCostRow ARow,
            ref TVerificationResultCollection AVerificationResultCollection, TValidationControlsDict AValidationControlsDict,
            DataRowCollection AGridData)
        {
            // Don't validate deleted DataRows
            if (ARow.RowState == DataRowState.Deleted)
            {
                return;
            }

            // Check the row being validated is consistent with the rest of the data in the table
            PcConferenceCostRow ARowCompare = null;
            Boolean StandardCostInconsistency = false;
            string[] InconsistentRows = new string[2];  // used for the error message
            int i = 0;

            while (i < AGridData.Count)
            {
                ARowCompare = (PcConferenceCostRow)AGridData[i];

                if ((ARowCompare.RowState != DataRowState.Deleted) && (ARowCompare.OptionDays > ARow.OptionDays) && (ARowCompare.Charge < ARow.Charge))
                {
                    StandardCostInconsistency = true;
                    InconsistentRows[0] = ARow.OptionDays.ToString();
                    InconsistentRows[1] = ARowCompare.OptionDays.ToString();
                    break;
                }
                else if ((ARowCompare.RowState != DataRowState.Deleted) && (ARowCompare.OptionDays < ARow.OptionDays)
                         && (ARowCompare.Charge > ARow.Charge))
                {
                    StandardCostInconsistency = true;
                    InconsistentRows[0] = ARowCompare.OptionDays.ToString();
                    InconsistentRows[1] = ARow.OptionDays.ToString();
                    break;
                }

                i++;
            }

            // if an inconsistency is found
            if (StandardCostInconsistency == true)
            {
                TValidationControlsData ValidationControlsData;
                TScreenVerificationResult VerificationResult = null;
                DataColumn ValidationColumn = ARow.Table.Columns[PcConferenceCostTable.ColumnChargeId];

                // displays a warning message (non-critical error)
                VerificationResult = new TScreenVerificationResult(new TVerificationResult(AContext, ErrorCodes.GetErrorInfo(
                            PetraErrorCodes.ERR_STANDARD_COST_INCONSISTENCY, InconsistentRows)),
                    ValidationColumn, ValidationControlsData.ValidationControl);

                // Handle addition to/removal from TVerificationResultCollection
                AVerificationResultCollection.Auto_Add_Or_AddOrRemove(AContext, VerificationResult, ValidationColumn);
            }
        }
Exemplo n.º 14
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="AExchangeRateDT">The corporate or daily exchange rate table</param>
        /// <param name="AImportMode">Determines whether corporate or daily exchange rates specified - either 'Daily' or 'Corporate'</param>
        /// <param name="AResultCollection">A validation collection to which errors will be added</param>
        /// <returns>The number of rows that were actually imported.  Rows that duplicate existing rows do not count.
        /// This is usually because this is an attempt to import again after a failed previous attempt.</returns>
        public static int ImportCurrencyExRates(TTypedDataTable AExchangeRateDT, string AImportMode, TVerificationResultCollection AResultCollection)
        {
            OpenFileDialog DialogBox = new OpenFileDialog();

            DialogBox.Title = Catalog.GetString("Import exchange rates from spreadsheet file");
            DialogBox.Filter = Catalog.GetString("Spreadsheet files (*.csv)|*.csv");

            if (DialogBox.ShowDialog() == DialogResult.OK)
            {
                String dateFormatString = TUserDefaults.GetStringDefault("Imp Date", "MDY");
                String impOptions = TUserDefaults.GetStringDefault("Imp Options", ";" + TDlgSelectCSVSeparator.NUMBERFORMAT_AMERICAN);

                TDlgSelectCSVSeparator DlgSeparator = new TDlgSelectCSVSeparator(false);
                Boolean fileCanOpen = DlgSeparator.OpenCsvFile(DialogBox.FileName);

                if (!fileCanOpen)
                {
                    MessageBox.Show(Catalog.GetString("Unable to open file."),
                        Catalog.GetString("Import Exchange Rates"),
                        MessageBoxButtons.OK,
                        MessageBoxIcon.Stop);
                    return 0;
                }

                DlgSeparator.DateFormat = dateFormatString;

                if (impOptions.Length > 1)
                {
                    DlgSeparator.NumberFormat = impOptions.Substring(1);
                }

                DlgSeparator.SelectedSeparator = impOptions.Substring(0, 1);

                if (DlgSeparator.ShowDialog() == DialogResult.OK)
                {
                    // Save the settings that we specified
                    impOptions = DlgSeparator.SelectedSeparator;
                    impOptions += DlgSeparator.NumberFormat;
                    TUserDefaults.SetDefault("Imp Options", impOptions);
                    TUserDefaults.SetDefault("Imp Date", DlgSeparator.DateFormat);
                    TUserDefaults.SaveChangedUserDefaults();

                    // Do the import and retuen the number of rows imported and any messages
                    return ImportCurrencyExRatesFromCSV(AExchangeRateDT,
                        DialogBox.FileName,
                        DlgSeparator.SelectedSeparator,
                        DlgSeparator.NumberFormat,
                        DlgSeparator.DateFormat,
                        AImportMode,
                        AResultCollection);
                }
            }

            return 0;
        }
        /// <summary>
        /// The main method to run a reference check on a single item of data
        /// </summary>
        /// <param name="APetraUtilsObject">The calling forms PetraUtils Object</param>
        /// <param name="AVerificationResults">The results collection to check</param>
        /// <param name="ALimitedCount">Will be true if the reference count call was a limited check</param>
        /// <returns>A message box result.  Yes implies doing a new unlimited count, Undefined implies there are no references so deletion can proceed.
        /// Any other value implies that references exist</returns>
        public TFrmExtendedMessageBox.TResult HandleReferences(TFrmPetraEditUtils APetraUtilsObject,
            TVerificationResultCollection AVerificationResults,
            bool ALimitedCount)
        {
            Form MyForm = APetraUtilsObject.GetForm();

            // There were reference(s)
            TRowReferenceInfo info = (TRowReferenceInfo)AVerificationResults[0].ResultContext;
            bool bIncomplete = info.CascadingCountEndedEarly;

            // Build up a message string
            string msgContent = Messages.BuildMessageFromVerificationResult(
                MCommonResourcestrings.StrRecordCannotBeDeleted +
                Environment.NewLine +
                Catalog.GetPluralString(MCommonResourcestrings.StrReasonColon, MCommonResourcestrings.StrReasonsColon, AVerificationResults.Count),
                AVerificationResults);

            TFrmExtendedMessageBox.TButtons buttons = TFrmExtendedMessageBox.TButtons.embbOK;
            TFrmExtendedMessageBox.TDefaultButton defButton = TFrmExtendedMessageBox.TDefaultButton.embdDefButton1;

            if (bIncomplete && ALimitedCount)
            {
                msgContent += String.Format(MCommonResourcestrings.StrCountTerminatedEarly1,
                    Environment.NewLine,
                    APetraUtilsObject.MaxReferenceCountOnDelete);
                msgContent += MCommonResourcestrings.StrCountTerminatedEarly2;
                msgContent += MCommonResourcestrings.StrCountTerminatedEarly3;
                msgContent += String.Format(MCommonResourcestrings.StrCountTerminatedEarly4,
                    Environment.NewLine,
                    MyForm.Text);
                buttons = TFrmExtendedMessageBox.TButtons.embbYesNo;
                defButton = TFrmExtendedMessageBox.TDefaultButton.embdDefButton2;
            }
            else
            {
                if (bIncomplete)
                {
                    // We should never get an incomplete count on an unlimited check
                }

                msgContent += String.Format(MCommonResourcestrings.StrCountTerminatedEarlyOK, Environment.NewLine);
            }

            // Show an Extended Message Box and return the value
            TFrmExtendedMessageBox extendedMsgBox = new TFrmExtendedMessageBox(MyForm);

            return extendedMsgBox.ShowDialog(
                msgContent,
                MCommonResourcestrings.StrRecordDeletionTitle,
                String.Empty,
                buttons,
                defButton,
                TFrmExtendedMessageBox.TIcon.embiInformation);
        }
Exemplo n.º 16
0
        /// <summary>
        /// This is for all info only routines that means JobSize has no definition
        /// </summary>
        protected void RunPeriodEndCheck(AbstractPeriodEndOperation Apeo, TVerificationResultCollection AVerificationResults)
        {
            FverificationResults = AVerificationResults;
            Apeo.VerificationResultCollection = AVerificationResults;
            Apeo.IsInInfoMode = FInfoMode;
            Apeo.RunOperation();

            if (Apeo.HasCriticalErrors)
            {
                FHasCriticalErrors = true;
            }
        }
Exemplo n.º 17
0
        /// <summary>
        /// format an error message using the errors from Verification Result
        /// </summary>
        /// <param name="AMessageHeadline"></param>
        /// <param name="AVerificationResult"></param>
        /// <returns></returns>
        public static String BuildMessageFromVerificationResult(String AMessageHeadline, TVerificationResultCollection AVerificationResult)
        {
            String ReturnValue;
            IEnumerator VerificationResultEnum;
            TVerificationResult VerificationResultEntry;

            if (AMessageHeadline == null)
            {
                if (AVerificationResult == null)
                {
                    throw new ArgumentNullException("AVerificationResult must not be null if AMessageHeadline is null!");
                }

                if (AVerificationResult.HasCriticalErrors)
                {
                    AMessageHeadline = Catalog.GetString("Saving of data failed!\r\n\r\nReasons:");
                }
                else
                {
                    AMessageHeadline = StrWarningsAttention;
                }
            }

// MessageBox.Show('AVerificationResult.Count: ' + AVerificationResult.Count.ToString);
            ReturnValue = AMessageHeadline + Environment.NewLine;
            VerificationResultEnum = AVerificationResult.GetEnumerator();

            while (VerificationResultEnum.MoveNext())
            {
                VerificationResultEntry = ((TVerificationResult)VerificationResultEnum.Current);

                ReturnValue += "  * ";

                if (VerificationResultEntry.ResultContext != null)
                {
                    if (!(VerificationResultEntry.ResultContext is TRowReferenceInfo))
                    {
                        ReturnValue += "[" + VerificationResultEntry.ResultContext.ToString() + "] ";
                    }
                }

                ReturnValue += VerificationResultEntry.ResultText;

                if (VerificationResultEntry.ResultCode != String.Empty)
                {
                    ReturnValue += "  [" + VerificationResultEntry.ResultCode + "]";
                }

                ReturnValue += Environment.NewLine + Environment.NewLine;
            }

            return ReturnValue;
        }
Exemplo n.º 18
0
        public static bool PeriodMonthEnd(
            Int32 ALedgerNumber,
            bool AInfoMode,
            out TVerificationResultCollection AVerificationResults)
        {
            try
            {
                TLedgerInfo ledgerInfo = new TLedgerInfo(ALedgerNumber);
                Int32 PeriodClosing = ledgerInfo.CurrentPeriod;
                bool res = new TMonthEnd(ledgerInfo).RunMonthEnd(AInfoMode,
                    out AVerificationResults);

                if (!res && !AInfoMode)
                {
                    TDBTransaction Transaction = null;
                    AAccountingPeriodTable PeriodTbl = null;

                    DBAccess.GDBAccessObj.GetNewOrExistingAutoReadTransaction(IsolationLevel.ReadUncommitted,
                        TEnforceIsolationLevel.eilMinimum,
                        ref Transaction,
                        delegate
                        {
                            PeriodTbl = AAccountingPeriodAccess.LoadByPrimaryKey(ledgerInfo.LedgerNumber, PeriodClosing, Transaction);
                        });

                    if (PeriodTbl.Rows.Count > 0)
                    {
                        AVerificationResults.Add(
                            new TVerificationResult(
                                Catalog.GetString("Month End"),
                                String.Format(Catalog.GetString("The period {0} - {1} has been closed."),
                                    PeriodTbl[0].PeriodStartDate.ToShortDateString(), PeriodTbl[0].PeriodEndDate.ToShortDateString()),
                                TResultSeverity.Resv_Status));
                    }
                }

                return res;
            }
            catch (Exception e)
            {
                TLogging.Log("TPeriodIntervallConnector.TPeriodMonthEnd() throws " + e.ToString());
                AVerificationResults = new TVerificationResultCollection();
                AVerificationResults.Add(
                    new TVerificationResult(
                        Catalog.GetString("Month End"),
                        Catalog.GetString("Uncaught Exception: ") + e.Message,
                        TResultSeverity.Resv_Critical));


                return true;
            }
        }
Exemplo n.º 19
0
        /// <summary>
        /// Import data from a CSV file
        /// </summary>
        /// <param name="ANode"></param>
        /// <param name="AReferenceResults"></param>
        /// <returns></returns>
        public static PartnerImportExportTDS ImportData(XmlNode ANode, ref TVerificationResultCollection AReferenceResults)
        {
            PartnerImportExportTDS ResultDS = new PartnerImportExportTDS();

            TPartnerImportCSV.FLocationKey = -1;
            ResultsCol = AReferenceResults;
            TDBTransaction ReadTransaction = null;

            DBAccess.GDBAccessObj.BeginAutoReadTransaction(IsolationLevel.Serializable, ref ReadTransaction,
                delegate
                {
                    while (ANode != null)
                    {
                        ResultsContext = "CSV Import";
                        String PartnerClass = TXMLParser.GetAttribute(ANode, MPartnerConstants.PARTNERIMPORT_PARTNERCLASS).ToUpper();
                        Int64 PartnerKey = 0;
                        int LocationKey = 0;

                        if (PartnerClass.Length == 0)
                        {
                            PartnerClass = MPartnerConstants.PARTNERCLASS_FAMILY;
                        }

                        if ((PartnerClass == MPartnerConstants.PARTNERCLASS_FAMILY) || (PartnerClass == MPartnerConstants.PARTNERCLASS_PERSON))
                        {
                            ResultsContext = "CSV Import Family";
                            PartnerKey = CreateNewFamily(ANode, out LocationKey, ref ResultDS, ReadTransaction);
                            CreateSpecialTypes(ANode, PartnerKey, "SpecialTypeFamily_", ref ResultDS);
                        }

                        if (PartnerClass == MPartnerConstants.PARTNERCLASS_PERSON)
                        {
                            ResultsContext = "CSV Import person";
                            Int64 PersonKey = CreateNewPerson(PartnerKey, LocationKey, ANode, ref ResultDS, ReadTransaction);
                            CreateShortTermApplication(ANode, PersonKey, ref ResultDS, ReadTransaction);
                            CreateSpecialTypes(ANode, PersonKey, ref ResultDS);
                            CreateSubscriptions(ANode, PersonKey, ref ResultDS);
                            CreateContacts(ANode, PersonKey, ref ResultDS, "_1");
                            CreateContacts(ANode, PersonKey, ref ResultDS, "_2");
                            CreatePassport(ANode, PersonKey, ref ResultDS);
                        }

                        ANode = ANode.NextSibling;
                    }

                    CreatePartnerAttributes(ref ResultDS, ReadTransaction);
                });

            return ResultDS;
        }
Exemplo n.º 20
0
        public static bool PerformStewardshipCalculation(int ALedgerNumber,
            int APeriodNumber,
            out TVerificationResultCollection AVerificationResult)
        {
/*
 *          if (TLogging.DL >= 9)
 *          {
 *              Console.WriteLine("TStewardshipCalculationWebConnector.PerformStewardshipCalculation...");
 *          }
 */
            AVerificationResult = new TVerificationResultCollection();
            bool NewTransaction;

            TDBTransaction DBTransaction = DBAccess.GDBAccessObj.GetNewOrExistingTransaction(IsolationLevel.Serializable,
                out NewTransaction);

            try
            {
                if (GenerateAdminFeeBatch(ALedgerNumber, APeriodNumber, false, DBTransaction, ref AVerificationResult))
                {
                    if (NewTransaction)
                    {
                        DBAccess.GDBAccessObj.CommitTransaction();
                    }

                    return GenerateICHStewardshipBatch(ALedgerNumber, APeriodNumber, ref AVerificationResult);
                }
                else
                {
                    if (NewTransaction)
                    {
                        DBAccess.GDBAccessObj.RollbackTransaction();
                    }

                    return false;
                }
            }
            catch (Exception Exc)
            {
                TLogging.Log("An Exception occured while performing the Stewardship Calculations:" + Environment.NewLine + Exc.ToString());

                if (NewTransaction)
                {
                    DBAccess.GDBAccessObj.RollbackTransaction();
                }

                throw;
            }
        }
Exemplo n.º 21
0
        public static bool Revaluate(
            int ALedgerNum,
            string[] AForeignAccount,
            decimal[] ANewExchangeRate,
            String ACostCentre,
            out TVerificationResultCollection AVerificationResult)
        {
            CLSRevaluation revaluation = new CLSRevaluation(ALedgerNum,
                AForeignAccount, ANewExchangeRate, ACostCentre);

            bool blnReturn = revaluation.RunRevaluation();

            AVerificationResult = revaluation.VerificationResultCollection;
            return blnReturn;
        }
Exemplo n.º 22
0
        public static bool GetGiftsForReverseAdjust(
            Hashtable requestParams, ref GiftBatchTDS AGiftDS, out TVerificationResultCollection AMessages)
        {
            GiftAdjustmentFunctionEnum Function = (GiftAdjustmentFunctionEnum)requestParams["Function"];
            Int32 LedgerNumber = (Int32)requestParams["ALedgerNumber"];
            Int32 GiftDetailNumber = (Int32)requestParams["GiftDetailNumber"];
            Int32 GiftNumber = (Int32)requestParams["GiftNumber"];
            Int32 BatchNumber = (Int32)requestParams["BatchNumber"];

            AMessages = new TVerificationResultCollection();
            GiftBatchTDS MainDS = new GiftBatchTDS();

            TDBTransaction Transaction = null;

            DBAccess.GDBAccessObj.GetNewOrExistingAutoReadTransaction(IsolationLevel.ReadCommitted,
                TEnforceIsolationLevel.eilMinimum,
                ref Transaction,
                delegate
                {
                    // get data needed for new gifts
                    if (Function.Equals(GiftAdjustmentFunctionEnum.ReverseGiftBatch))
                    {
                        AGiftAccess.LoadViaAGiftBatch(MainDS, LedgerNumber, BatchNumber, Transaction);

                        foreach (AGiftRow gift in MainDS.AGift.Rows)
                        {
                            AGiftDetailAccess.LoadViaAGift(MainDS, LedgerNumber, BatchNumber, gift.GiftTransactionNumber, Transaction);
                        }
                    }
                    else
                    {
                        AGiftAccess.LoadByPrimaryKey(MainDS, LedgerNumber, BatchNumber, GiftNumber, Transaction);

                        if (Function.Equals(GiftAdjustmentFunctionEnum.ReverseGiftDetail))
                        {
                            AGiftDetailAccess.LoadByPrimaryKey(MainDS, LedgerNumber, BatchNumber, GiftNumber, GiftDetailNumber, Transaction);
                        }
                        else
                        {
                            AGiftDetailAccess.LoadViaAGift(MainDS, LedgerNumber, BatchNumber, GiftNumber, Transaction);
                        }
                    }
                });

            AGiftDS = MainDS;

            return CheckGiftsNotPreviouslyReversed(AGiftDS, out AMessages);
        }
        //
        // Put Methods for the validation of AP EditTransaction in this code file.
        //

        static partial void ValidateApDocumentDetailManual(ref TVerificationResultCollection AVerificationResult,
            TTypedDataTable ASubmitTable)
        {
            TValidationControlsDict ValidationControlsDict = new TValidationControlsDict();

            ValidationControlsDict.Add(ASubmitTable.Columns[AApDocumentDetailTable.ColumnAmountId],
                new TValidationControlsData(null, AApDocumentDetailTable.GetAmountDBName()));

            for (int Counter = 0; Counter < ASubmitTable.Rows.Count; Counter++)
            {
                TSharedFinanceValidation_AP.ValidateApDocumentDetailManual("TTransactionWebConnector" +
                    " (Error in Row #" + Counter.ToString() + ")",  // No translation of message text since the server's messages should be all in English
                    (AApDocumentDetailRow)ASubmitTable.Rows[Counter], ref AVerificationResult,
                    ValidationControlsDict);
            }
        }
        //
        // Put Methods for the validation of Partner Edit screen data in this code file.
        //

        static partial void ValidatePPartnerManual(ref TVerificationResultCollection AVerificationResult,
            TTypedDataTable ASubmitTable)
        {
            TValidationControlsDict ValidationControlsDict = new TValidationControlsDict();

            ValidationControlsDict.Add(ASubmitTable.Columns[PPartnerTable.ColumnStatusCodeId],
                new TValidationControlsData(null, Catalog.GetString("Partner &Status")));

            for (int Counter = 0; Counter < ASubmitTable.Rows.Count; Counter++)
            {
                TSharedPartnerValidation_Partner.ValidatePartnerManual("TPartnerEditUIConnector" +
                    " (Error in Row #" + Counter.ToString() + ")",  // No translation of message text since the server's messages should be all in English
                    (PPartnerRow)ASubmitTable.Rows[Counter], ref AVerificationResult,
                    ValidationControlsDict);
            }
        }
Exemplo n.º 25
0
        /// <summary>
        /// Checks wheter a given DateTime is an invalid date. A check whether it is an undefined DateTime is always performed.
        /// If Delegate <see cref="SharedGetDateVerificationResultDelegate" /> is set up and Argument
        /// <paramref name="AResultControl" /> isn't null, the 'DateVerificationResult' of the TtxtPetraDate Control is
        /// returned by this Method through this Method if it isn't null. That way the Data Validation Framework can
        /// use the detailed Data Verification error that is held by the Control.
        /// </summary>
        /// <returns>Null if validation succeeded, otherwise a <see cref="TVerificationResult" /> is
        /// returned that contains details about the problem.</returns>
        public static TVerificationResult IsNotInvalidDate(DateTime? ADate, String ADescription,
            TVerificationResultCollection AVerificationResultCollection, bool ATreatNullAsInvalid = false,
            object AResultContext = null, System.Data.DataColumn AResultColumn = null,
            Control AResultControl = null)
        {
            TVerificationResult VerificationResult;

            if (FDelegateSharedGetDateVerificationResult != null)
            {
                if ((AResultControl != null))
                {
                    VerificationResult = FDelegateSharedGetDateVerificationResult(AResultControl);

                    if (VerificationResult == null)
                    {
                        VerificationResult = TDateChecks.IsNotUndefinedDateTime(ADate,
                            ADescription, ATreatNullAsInvalid, AResultContext, AResultColumn, AResultControl);
                    }
                    else
                    {
                        VerificationResult.OverrideResultContext(AResultContext);
                        VerificationResult = new TScreenVerificationResult(VerificationResult, AResultColumn, AResultControl);
                    }
                }
                else
                {
                    VerificationResult = TDateChecks.IsNotUndefinedDateTime(ADate,
                        ADescription, ATreatNullAsInvalid, AResultContext, AResultColumn, AResultControl);
                }

                // Remove Verification Result that would have been recorded earlier for the same DataColumn
                TVerificationResult OtherRecordedVerificationResult = AVerificationResultCollection.FindBy(AResultColumn);

                if (OtherRecordedVerificationResult != null)
                {
                    AVerificationResultCollection.Remove(OtherRecordedVerificationResult);
                }
            }
            else
            {
                VerificationResult = TDateChecks.IsNotUndefinedDateTime(ADate,
                    ADescription, ATreatNullAsInvalid, AResultContext, AResultColumn, AResultControl);
            }

            return VerificationResult;
        }
Exemplo n.º 26
0
        /// <summary>
        /// todoComment
        /// </summary>
        /// <param name="e"></param>
        /// <param name="AVerificationResultCollection"></param>
        /// <param name="AVerificationResult"></param>
        /// <param name="FDataColumnComparedTo"></param>
        /// <returns></returns>
        public static Boolean VerifySubscriptionData(DataColumnChangeEventArgs e,
            TVerificationResultCollection AVerificationResultCollection,
            out TVerificationResult AVerificationResult,
            out DataColumn FDataColumnComparedTo)
        {
            Boolean ReturnValue;

            AVerificationResult = null;
            DataColumn FDataColumnComparedTo2 = null;

            if ((e.Column.ColumnName == PSubscriptionTable.GetDateCancelledDBName())
                || (e.Column.ColumnName == PSubscriptionTable.GetExpiryDateDBName())
                || (e.Column.ColumnName == PSubscriptionTable.GetDateNoticeSentDBName())
                || (e.Column.ColumnName == PSubscriptionTable.GetStartDateDBName())
                || (e.Column.ColumnName == PSubscriptionTable.GetSubscriptionRenewalDateDBName())
                || (e.Column.ColumnName == PSubscriptionTable.GetFirstIssueDBName()) || (e.Column.ColumnName == PSubscriptionTable.GetLastIssueDBName()))
            {
                VerifySubscriptionDates(e, AVerificationResultCollection, out AVerificationResult, out FDataColumnComparedTo2);
            }

            FDataColumnComparedTo = FDataColumnComparedTo2;

            // if (e.Column.Ordinal = (e.Column.Table as PPartnerLocationTable).ColumnEmailAddress.Ordinal) then
            // begin
            // VerifyEMailAddress(e, AVerificationResult);
            // end;
            if ((e.Column.ColumnName == PSubscriptionTable.GetPublicationCopiesDBName())
                || (e.Column.ColumnName == PSubscriptionTable.GetNumberIssuesReceivedDBName())
                || (e.Column.ColumnName == PSubscriptionTable.GetNumberComplimentaryDBName()))
            {
                VerifyInteger(e, out AVerificationResult);
            }

            // any verification errors?
            if (AVerificationResult == null)
            {
                ReturnValue = true;
            }
            else
            {
                ReturnValue = false;
            }

            return ReturnValue;
        }
        //
        // Put Methods for the validation of Gift Transactions in this code file.
        //

        static partial void ValidateGiftBatchManual(ref TVerificationResultCollection AVerificationResult,
            TTypedDataTable ASubmitTable)
        {
            TValidationControlsDict ValidationControlsDict = new TValidationControlsDict();

            ValidationControlsDict.Add(ASubmitTable.Columns[AGiftBatchTable.ColumnBatchDescriptionId],
                new TValidationControlsData(null, AGiftBatchTable.GetBatchDescriptionDBName()));
            ValidationControlsDict.Add(ASubmitTable.Columns[AGiftBatchTable.ColumnExchangeRateToBaseId],
                new TValidationControlsData(null, AGiftBatchTable.GetExchangeRateToBaseDBName()));

            for (int Counter = 0; Counter < ASubmitTable.Rows.Count; Counter++)
            {
                TSharedFinanceValidation_Gift.ValidateGiftBatchManual("TTransactionWebConnector" +
                    " (Error in Row #" + Counter.ToString() + ")",  // No translation of message text since the server's messages should be all in English
                    (AGiftBatchRow)ASubmitTable.Rows[Counter], ref AVerificationResult,
                    ValidationControlsDict);
            }
        }
Exemplo n.º 28
0
        //
        // Put Methods for the validation of Cacheable DataTables in this code file.
        //

        partial void ValidateMaritalStatusListManual(ref TVerificationResultCollection AVerificationResult, TTypedDataTable ASubmitTable)
        {
            TValidationControlsDict ValidationControlsDict = new TValidationControlsDict();

            ValidationControlsDict.Add(ASubmitTable.Columns[PtMaritalStatusTable.ColumnAssignableDateId],
                new TValidationControlsData(null, PtMaritalStatusTable.GetAssignableDateDBName()));

            for (int Counter = 0; Counter < ASubmitTable.Rows.Count; Counter++)
            {
                if (ASubmitTable.Rows[Counter].RowState != DataRowState.Deleted)
                {
                    TSharedValidation_CacheableDataTables.ValidateMaritalStatus(this.GetType().Name +
                        " (Error in Row #" + Counter.ToString() + ")",  // No translation of message text since the server's messages should be all in English
                        (PtMaritalStatusRow)ASubmitTable.Rows[Counter], ref AVerificationResult,
                        ValidationControlsDict);
                }
            }
        }
Exemplo n.º 29
0
        public static bool TPeriodYearEnd(
            int ALedgerNum,
            bool AIsInInfoMode,
            out TVerificationResultCollection AVerificationResult)
        {
            bool NewTransaction;

            DBAccess.GDBAccessObj.GetNewOrExistingTransaction(IsolationLevel.Serializable, out NewTransaction);

            try
            {
                TLedgerInfo LedgerInfo = new TLedgerInfo(ALedgerNum);
                bool res = new TYearEnd(LedgerInfo).RunYearEnd(AIsInInfoMode, out AVerificationResult);

                if (!res)
                {
                    String SuccessMsg = AIsInInfoMode ? "YearEnd check: No problems found." : "Success.";
                    AVerificationResult.Add(new TVerificationResult("Year End", SuccessMsg, "Success", TResultSeverity.Resv_Status));
                }

                if (NewTransaction)
                {
                    DBAccess.GDBAccessObj.CommitTransaction();
                }

                return res;
            }
            catch (Exception e)
            {
                TLogging.Log("TPeriodIntervalConnector.TPeriodYearEnd() throws " + e.ToString());
                AVerificationResult = new TVerificationResultCollection();
                AVerificationResult.Add(
                    new TVerificationResult(
                        Catalog.GetString("Year End"),
                        Catalog.GetString("Uncaught Exception: ") + e.Message,
                        TResultSeverity.Resv_Critical));

                DBAccess.GDBAccessObj.RollbackTransaction();

                return false;
            }
        }
Exemplo n.º 30
0
        //
        // Put Methods for the validation of Common Module WebConnectors and DataReaders in this code file.
        //

        static partial void ValidateInternationalPostalTypeManual(ref TVerificationResultCollection AVerificationResult,
            TTypedDataTable ASubmitTable)
        {
            TValidationControlsDict ValidationControlsDict = new TValidationControlsDict();

            ValidationControlsDict.Add(ASubmitTable.Columns[(short)PInternationalPostalTypeTable.ColumnInternatPostalTypeCodeId],
                new TValidationControlsData(null, PInternationalPostalTypeTable.GetInternatPostalTypeCodeDBName()));
            ValidationControlsDict.Add(ASubmitTable.Columns[(short)PInternationalPostalTypeTable.ColumnDescriptionId],
                new TValidationControlsData(null, PInternationalPostalTypeTable.GetDescriptionDBName()));
            ValidationControlsDict.Add(ASubmitTable.Columns[(short)PInternationalPostalTypeTable.ColumnDeletableId],
                new TValidationControlsData(null, PInternationalPostalTypeTable.GetDeletableDBName()));

            for (int Counter = 0; Counter < ASubmitTable.Rows.Count; Counter++)
            {
                PInternationalPostalTypeValidation.Validate("TCommonDataReader.ValidateInternationalPostalTypeManual" +
                    " (Error in Row #" + Counter.ToString() + ")",  // No translation of message text since the server's messages should be all in English
                    (PInternationalPostalTypeRow)ASubmitTable.Rows[Counter], ref AVerificationResult,
                    ValidationControlsDict);
            }
        }