本文整理汇总了C#中Ict.Common.Verification.TVerificationResult.OverrideResultText方法的典型用法代码示例。如果您正苦于以下问题:C# TVerificationResult.OverrideResultText方法的具体用法?C# TVerificationResult.OverrideResultText怎么用?C# TVerificationResult.OverrideResultText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ict.Common.Verification.TVerificationResult
的用法示例。
在下文中一共展示了TVerificationResult.OverrideResultText方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IsValidPartner
/// <summary>
/// Checks whether a Partner with a certain PartnerKey and a range of valid PartnerClasses exists.
/// </summary>
/// <param name="APartnerKey">PartnerKey.</param>
/// <param name="AValidPartnerClasses">An array of PartnerClasses. If the Partner exists, but its
/// PartnerClass isn't in the array, a TVerificationResult is still returned.</param>
/// <param name="AZeroPartnerKeyIsValid">Set to true if <paramref name="APartnerKey" /> 0 should be considered
/// as valid (Default: false)</param>
/// <param name="AErrorMessageText">Text that should be prepended to the ResultText. (Default: empty string)</param>
/// <param name="AResultContext">ResultContext (Default: null).</param>
/// <param name="AResultColumn">Which <see cref="System.Data.DataColumn" /> failed (can be null). (Default: null).</param>
/// <param name="AResultControl">Which <see cref="System.Windows.Forms.Control" /> is involved (can be null). (Default: null).</param>
/// <returns>Null if the Partner exists and its PartnerClass is in the <paramref name="AValidPartnerClasses" />
/// array. If the Partner exists, but its PartnerClass isn't in the array, a TVerificationResult
/// with details about the error is returned. This is also the case if the Partner doesn't exist at all
/// or got merged into another Partner, or if <paramref name="APartnerKey" /> is 0 and <paramref name="AZeroPartnerKeyIsValid" />
/// is false.
/// </returns>
public static TVerificationResult IsValidPartner(Int64 APartnerKey, TPartnerClass[] AValidPartnerClasses,
bool AZeroPartnerKeyIsValid = false, string AErrorMessageText = "", object AResultContext = null,
System.Data.DataColumn AResultColumn = null, System.Windows.Forms.Control AResultControl = null)
{
TVerificationResult ReturnValue = null;
string ShortName;
TPartnerClass PartnerClass;
bool PartnerExists;
bool IsMergedPartner;
string ValidPartnerClassesStr = String.Empty;
bool PartnerClassValid = false;
string PartnerClassInvalidMessageStr = Catalog.GetString("The Partner Class of the Partner needs to be '{0}', but it is '{1}'.");
string PartnerClassConcatStr = Catalog.GetString(" or ");
if ((AZeroPartnerKeyIsValid)
&& (APartnerKey == 0))
{
return null;
}
else if ((!AZeroPartnerKeyIsValid)
&& (APartnerKey == 0))
{
if (AErrorMessageText == String.Empty)
{
ReturnValue = new TVerificationResult(AResultContext, ErrorCodes.GetErrorInfo(
PetraErrorCodes.ERR_PARTNERKEY_INVALID_NOZERO, new string[] { APartnerKey.ToString("0000000000") }));
}
else
{
ReturnValue = new TVerificationResult(AResultContext, ErrorCodes.GetErrorInfo(
PetraErrorCodes.ERR_PARTNERKEY_INVALID_NOZERO));
ReturnValue.OverrideResultText(AErrorMessageText + Environment.NewLine + ReturnValue.ResultText);
}
}
else
{
bool VerificationOK = TSharedPartnerValidationHelper.VerifyPartner(APartnerKey, AValidPartnerClasses, out PartnerExists,
out ShortName, out PartnerClass, out IsMergedPartner);
if ((!VerificationOK)
|| (IsMergedPartner))
{
if (AErrorMessageText == String.Empty)
{
ReturnValue = new TVerificationResult(AResultContext, ErrorCodes.GetErrorInfo(
PetraErrorCodes.ERR_PARTNERKEY_INVALID, new string[] { APartnerKey.ToString("0000000000") }));
}
else
{
ReturnValue = new TVerificationResult(AResultContext, ErrorCodes.GetErrorInfo(
PetraErrorCodes.ERR_PARTNERKEY_INVALID, new string[] { APartnerKey.ToString("0000000000") }));
ReturnValue.OverrideResultText(AErrorMessageText + Environment.NewLine + ReturnValue.ResultText);
}
if ((PartnerExists)
&& (!IsMergedPartner))
{
if ((AValidPartnerClasses.Length == 1)
&& (AValidPartnerClasses[0] != PartnerClass))
{
ReturnValue.OverrideResultText(ReturnValue.ResultText + " " +
String.Format(PartnerClassInvalidMessageStr, AValidPartnerClasses[0], PartnerClass));
}
else if (AValidPartnerClasses.Length > 1)
{
for (int Counter = 0; Counter < AValidPartnerClasses.Length; Counter++)
{
ValidPartnerClassesStr += "'" + AValidPartnerClasses[Counter] + "'" + PartnerClassConcatStr;
if (AValidPartnerClasses[Counter] == PartnerClass)
{
PartnerClassValid = true;
}
}
if (!PartnerClassValid)
{
ValidPartnerClassesStr = ValidPartnerClassesStr.Substring(0,
ValidPartnerClassesStr.Length - PartnerClassConcatStr.Length - 1); // strip off "' or "
ReturnValue.OverrideResultText(ReturnValue.ResultText + " " +
String.Format(PartnerClassInvalidMessageStr, ValidPartnerClassesStr, PartnerClass));
}
//.........这里部分代码省略.........
示例2: AreVerificationResultsIdentical
//.........这里部分代码省略.........
{
if ((AVerificationResult1.ResultContext is UserControl)
&& (AVerificationResult2.ResultContext is Form))
{
if (((UserControl)AVerificationResult1.ResultContext)
!= AVerificationResult2.ResultContext)
{
return false;
}
}
else if ((AVerificationResult2.ResultContext is UserControl)
&& (AVerificationResult1.ResultContext is Form))
{
if (((UserControl)AVerificationResult2.ResultContext).ParentForm
!= AVerificationResult1.ResultContext)
{
return false;
}
}
}
else if (AVerificationResult1.ResultContext != AVerificationResult2.ResultContext)
{
return false;
}
}
else if (AVerificationResult1.ResultContext != AVerificationResult2.ResultContext)
{
return false;
}
}
else
{
if (ATreatUserControlAndFormContextsAsIdentical)
{
if ((AVerificationResult1.ResultContext is UserControl)
|| (AVerificationResult2.ResultContext is UserControl))
{
if ((AVerificationResult1.ResultContext is UserControl)
&& (AVerificationResult2.ResultContext is Form))
{
if (((UserControl)AVerificationResult1.ResultContext).ParentForm.ToString()
!= AVerificationResult2.ResultContext.ToString())
{
return false;
}
}
else if ((AVerificationResult2.ResultContext is UserControl)
&& (AVerificationResult1.ResultContext is Form))
{
if (((UserControl)AVerificationResult2.ResultContext).ParentForm.ToString()
!= AVerificationResult1.ResultContext.ToString())
{
return false;
}
}
}
else if (AVerificationResult1.ResultContext.ToString() != AVerificationResult2.ResultContext.ToString())
{
return false;
}
}
else if (AVerificationResult1.ResultContext.ToString() != AVerificationResult2.ResultContext.ToString())
{
return false;
}
}
if (AVerificationResult1.ResultSeverity != AVerificationResult2.ResultSeverity)
{
return false;
}
if (AVerificationResult1.ResultText != AVerificationResult2.ResultText)
{
// There may be some specific result codes that can allow the result text to differ so long as everything else is ok.
// This will happen when the result text changes with the user's INPUT (examples of this are rare!)
// Normally result text is either constant or depends on the current database content which will be constant during a verification run.
// But, for example, the result text for a duplicate record contains a hint indicating the entered data that might be wrong.
// So if the user makes the same error twice but with two different attempts at making a non-duplicate, we need to accept the result
// as the same but update the old text, replacing it with the latest.
// Other examples of this behaviour may be created in the future, and can be OR'd with the ERR_DUPLICATE_RECORD case
if (AVerificationResult1.ResultCode == CommonErrorCodes.ERR_DUPLICATE_RECORD)
{
// ensure that the ResultText is the most recent instance
AVerificationResult1.OverrideResultText(AVerificationResult2.ResultText);
}
else
{
return false;
}
}
if (AVerificationResult1.ResultTextCaption != AVerificationResult2.ResultTextCaption)
{
return false;
}
}
return true;
}
示例3: IsValidRecipientFieldForMotivationGroup
/// <summary>
/// Checks whether a Partner with Field 0 has a non-gift Motivation Group code.
/// </summary>
/// <param name="APartnerKey">PartnerKey.</param>
/// <param name="APartnerField">The field associated with the partner key</param>
/// <param name="AMotivationGroup">The current motivation group</param>
/// <param name="AErrorMessageText">Text that should be prepended to the ResultText. (Default: empty string)</param>
/// <param name="AResultContext">ResultContext (Default: null).</param>
/// <param name="AResultColumn">Which <see cref="System.Data.DataColumn" /> failed (can be null). (Default: null).</param>
/// <param name="AResultControl">Which <see cref="System.Windows.Forms.Control" /> is involved (can be null). (Default: null).</param>
/// <returns>Null if the Partner Field is non-zero or Motivation Group code is not Gift.
/// If the Partner Field is zero and Motivation Group is Gift, a TVerificationResult
/// with details about the error is returned.
/// </returns>
public static TVerificationResult IsValidRecipientFieldForMotivationGroup(Int64 APartnerKey, Int64 APartnerField,
string AMotivationGroup, string AErrorMessageText = "", object AResultContext = null,
System.Data.DataColumn AResultColumn = null, System.Windows.Forms.Control AResultControl = null)
{
TVerificationResult ReturnValue = null;
if ((APartnerField == 0) && (AMotivationGroup == MFinanceConstants.MOTIVATION_GROUP_GIFT))
{
if (AErrorMessageText == String.Empty)
{
ReturnValue = new TVerificationResult(AResultContext, ErrorCodes.GetErrorInfo(
PetraErrorCodes.ERR_RECIPIENT_FIELD_MOTIVATION_GROUP, new string[] { APartnerKey.ToString() }));
}
else
{
ReturnValue = new TVerificationResult(AResultContext, ErrorCodes.GetErrorInfo(
PetraErrorCodes.ERR_RECIPIENT_FIELD_MOTIVATION_GROUP));
ReturnValue.OverrideResultText(AErrorMessageText + Environment.NewLine + ReturnValue.ResultText);
}
}
else
{
return null;
}
if ((ReturnValue != null)
&& (AResultColumn != null))
{
ReturnValue = new TScreenVerificationResult(ReturnValue, AResultColumn, AResultControl);
}
return ReturnValue;
}