예제 #1
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);
        }