本文整理汇总了C#中TValidationControlsDict.TryGetValue方法的典型用法代码示例。如果您正苦于以下问题:C# TValidationControlsDict.TryGetValue方法的具体用法?C# TValidationControlsDict.TryGetValue怎么用?C# TValidationControlsDict.TryGetValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TValidationControlsDict
的用法示例。
在下文中一共展示了TValidationControlsDict.TryGetValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ValidateApDocumentDetailManual
/// <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);
}
}
示例2: ValidateConferenceCostType
/// <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);
}
}
示例3: ValidateAccountDetailManual
/// <summary>
/// Check that Foreign Currency Accounts are using a valid currency
/// </summary>
/// <param name="AContext">Context that describes what I'm validating.</param>
/// <param name="ARow">DataRow with the the data I'm validating</param>
/// <param name="AVerificationResultCollection">Will be filled with 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 ValidateAccountDetailManual(object AContext, GLSetupTDSAAccountRow ARow,
ref TVerificationResultCollection AVerificationResultCollection, TValidationControlsDict AValidationControlsDict)
{
// Don't validate deleted DataRows
if (ARow.RowState == DataRowState.Deleted)
{
return;
}
TValidationControlsData ValidationControlsData;
// If this account is foreign, its currency must be assigned!
if (ARow.ForeignCurrencyFlag)
{
if (ARow.ForeignCurrencyCode == "")
{
DataColumn ValidationColumn = ARow.Table.Columns[AAccountTable.ColumnForeignCurrencyCodeId];
Control targetControl = null;
if (AValidationControlsDict.TryGetValue(ValidationColumn, out ValidationControlsData))
{
targetControl = ValidationControlsData.ValidationControl;
}
TScreenVerificationResult VerificationResult = new TScreenVerificationResult(
AContext,
ValidationColumn,
Catalog.GetString("Currency Code must be specified for foreign accounts."),
targetControl,
TResultSeverity.Resv_Critical);
// Handle addition/removal to/from TVerificationResultCollection
AVerificationResultCollection.Auto_Add_Or_AddOrRemove(AContext, VerificationResult, ValidationColumn);
}
}
else // If the Account is not foreign, I have nothing at all to say about the contents of the currency field.
{
AVerificationResultCollection.AddOrRemove(null, ARow.Table.Columns[AAccountTable.ColumnForeignCurrencyCodeId]);
}
}
示例4: ValidateSUserDetails
/// <summary>
/// Validates SUser Details
/// </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 ValidateSUserDetails(object AContext, SUserRow ARow,
ref TVerificationResultCollection AVerificationResultCollection, TValidationControlsDict AValidationControlsDict)
{
DataColumn ValidationColumn;
TValidationControlsData ValidationControlsData;
TVerificationResult VerificationResult = null;
// Don't validate deleted DataRows
if (ARow.RowState == DataRowState.Deleted)
{
return;
}
ValidationColumn = ARow.Table.Columns[SUserTable.ColumnPasswordHashId];
AValidationControlsDict.TryGetValue(ValidationColumn, out ValidationControlsData);
// PasswordHash must not be empty.
if ((ARow.RowState != DataRowState.Unchanged) && string.IsNullOrEmpty(ARow.PasswordHash))
{
VerificationResult = new TScreenVerificationResult(new TVerificationResult(AContext,
ErrorCodes.GetErrorInfo(PetraErrorCodes.ERR_MISSING_PASSWORD, new string[] { ARow.UserId })),
ValidationColumn, ValidationControlsData.ValidationControl);
// Handle addition to/removal from TVerificationResultCollection
AVerificationResultCollection.Auto_Add_Or_AddOrRemove(AContext, VerificationResult, ValidationColumn);
}
// If this is a first password (no salt) check that the password is valid.
if ((ARow.RowState != DataRowState.Unchanged) && string.IsNullOrEmpty(ARow.PasswordSalt) && !string.IsNullOrEmpty(ARow.PasswordHash))
{
VerificationResult = null;
if (!CheckPasswordQuality(ARow.PasswordHash, out VerificationResult))
{
VerificationResult = new TScreenVerificationResult(VerificationResult, ValidationColumn, ValidationControlsData.ValidationControl);
AVerificationResultCollection.Auto_Add_Or_AddOrRemove(AContext, VerificationResult, ValidationColumn);
}
}
}
示例5: ValidateDailyExchangeRate
/// <summary>
/// Validates the Daily Exchange Rates 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="AMinDateTime">The earliest allowable date.</param>
/// <param name="AMaxDateTime">The latest allowable date.</param>
public static void ValidateDailyExchangeRate(object AContext,
ADailyExchangeRateRow ARow,
ref TVerificationResultCollection AVerificationResultCollection,
TValidationControlsDict AValidationControlsDict,
DateTime AMinDateTime,
DateTime AMaxDateTime)
{
DataColumn ValidationColumn;
TValidationControlsData ValidationControlsData;
TVerificationResult VerificationResult;
// Don't validate deleted DataRows
if (ARow.RowState == DataRowState.Deleted)
{
return;
}
// RateOfExchange must be positive (definitely not zero because we can invert it)
ValidationColumn = ARow.Table.Columns[ADailyExchangeRateTable.ColumnRateOfExchangeId];
if (AValidationControlsDict.TryGetValue(ValidationColumn, out ValidationControlsData))
{
VerificationResult = TNumericalChecks.IsPositiveDecimal(ARow.RateOfExchange,
ValidationControlsData.ValidationControlLabel,
AContext, ValidationColumn, ValidationControlsData.ValidationControl);
// Handle addition/removal to/from TVerificationResultCollection
AVerificationResultCollection.Auto_Add_Or_AddOrRemove(AContext, VerificationResult, ValidationColumn);
}
// Date must not be empty and must be in range
ValidationColumn = ARow.Table.Columns[ADailyExchangeRateTable.ColumnDateEffectiveFromId];
if (AValidationControlsDict.TryGetValue(ValidationColumn, out ValidationControlsData))
{
VerificationResult = TSharedValidationControlHelper.IsNotInvalidDate(ARow.DateEffectiveFrom,
ValidationControlsData.ValidationControlLabel, AVerificationResultCollection, true,
AContext, ValidationColumn, ValidationControlsData.ValidationControl);
// Handle addition to/removal from TVerificationResultCollection
AVerificationResultCollection.Auto_Add_Or_AddOrRemove(AContext, VerificationResult, ValidationColumn);
if (VerificationResult == null)
{
if ((AMinDateTime > DateTime.MinValue) && (AMaxDateTime < DateTime.MaxValue))
{
// Check that the date is in range
VerificationResult = TDateChecks.IsDateBetweenDates(ARow.DateEffectiveFrom,
AMinDateTime,
AMaxDateTime,
ValidationControlsData.ValidationControlLabel,
TDateBetweenDatesCheckType.dbdctUnspecific,
TDateBetweenDatesCheckType.dbdctUnspecific,
AContext,
ValidationColumn,
ValidationControlsData.ValidationControl);
// Handle addition to/removal from TVerificationResultCollection
AVerificationResultCollection.Auto_Add_Or_AddOrRemove(AContext, VerificationResult, ValidationColumn);
}
else if (AMaxDateTime < DateTime.MaxValue)
{
VerificationResult = TDateChecks.FirstLesserOrEqualThanSecondDate(ARow.DateEffectiveFrom, AMaxDateTime,
ValidationControlsData.ValidationControlLabel, Ict.Common.StringHelper.DateToLocalizedString(AMaxDateTime),
AContext, ValidationColumn, ValidationControlsData.ValidationControl);
// Handle addition to/removal from TVerificationResultCollection
AVerificationResultCollection.Auto_Add_Or_AddOrRemove(AContext, VerificationResult, ValidationColumn);
}
else if (AMinDateTime > DateTime.MinValue)
{
VerificationResult = TDateChecks.FirstGreaterOrEqualThanSecondDate(ARow.DateEffectiveFrom, AMinDateTime,
ValidationControlsData.ValidationControlLabel, Ict.Common.StringHelper.DateToLocalizedString(AMinDateTime),
AContext, ValidationColumn, ValidationControlsData.ValidationControl);
// Handle addition to/removal from TVerificationResultCollection
AVerificationResultCollection.Auto_Add_Or_AddOrRemove(AContext, VerificationResult, ValidationColumn);
}
}
}
// Time must not be negative (indicating an error)
ValidationColumn = ARow.Table.Columns[ADailyExchangeRateTable.ColumnTimeEffectiveFromId];
if (AValidationControlsDict.TryGetValue(ValidationColumn, out ValidationControlsData))
{
VerificationResult = TTimeChecks.IsValidIntegerTime(ARow.TimeEffectiveFrom,
ValidationControlsData.ValidationControlLabel,
AContext, ValidationColumn, ValidationControlsData.ValidationControl);
//.........这里部分代码省略.........
示例6: ValidatePartnerManual
/// <summary>
/// Validates the Partner data of a Partner.
/// </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>
/// <returns>void</returns>
public static void ValidatePartnerManual(object AContext, PPartnerRow ARow,
ref TVerificationResultCollection AVerificationResultCollection, TValidationControlsDict AValidationControlsDict)
{
DataColumn ValidationColumn;
TValidationControlsData ValidationControlsData;
TScreenVerificationResult VerificationResult;
// Don't validate deleted DataRows
if (ARow.RowState == DataRowState.Deleted)
{
return;
}
// 'PartnerStatus' must not be set to MERGED
ValidationColumn = ARow.Table.Columns[PPartnerTable.ColumnStatusCodeId];
if (AValidationControlsDict.TryGetValue(ValidationColumn, out ValidationControlsData))
{
if (ARow.StatusCode == SharedTypes.StdPartnerStatusCodeEnumToString(TStdPartnerStatusCode.spscMERGED))
{
VerificationResult = new TScreenVerificationResult(new TVerificationResult(AContext,
ErrorCodes.GetErrorInfo(PetraErrorCodes.ERR_PARTNERSTATUSMERGEDCHANGEUNDONE)),
ValidationColumn, ValidationControlsData.ValidationControl);
// Note: The error code 'ERR_PARTNERSTATUSMERGEDCHANGEUNDONE' sets VerificationResult.ControlValueUndoRequested = true!
}
else
{
VerificationResult = null;
}
// Handle addition/removal to/from TVerificationResultCollection
AVerificationResultCollection.Auto_Add_Or_AddOrRemove(AContext, VerificationResult, ValidationColumn);
}
}
示例7: ValidateAccountingPeriod
/// <summary>
///
/// </summary>
/// <param name="AContext"></param>
/// <param name="ARow"></param>
/// <param name="AVerificationResultCollection"></param>
/// <param name="AValidationControlsDict"></param>
public static void ValidateAccountingPeriod(object AContext, AAccountingPeriodRow ARow,
ref TVerificationResultCollection AVerificationResultCollection, TValidationControlsDict AValidationControlsDict)
{
DataColumn ValidationColumn;
TValidationControlsData ValidationControlsData;
TVerificationResult VerificationResult;
// 'Period End Date' must be later than 'Period Start Date'
ValidationColumn = ARow.Table.Columns[AAccountingPeriodTable.ColumnPeriodEndDateId];
if (AValidationControlsDict.TryGetValue(ValidationColumn, out ValidationControlsData))
{
VerificationResult = TDateChecks.FirstGreaterOrEqualThanSecondDate(ARow.PeriodEndDate, ARow.PeriodStartDate,
ValidationControlsData.ValidationControlLabel, ValidationControlsData.SecondValidationControlLabel,
AContext, ValidationColumn, ValidationControlsData.ValidationControl);
// Handle addition to/removal from TVerificationResultCollection
AVerificationResultCollection.Auto_Add_Or_AddOrRemove(AContext, VerificationResult, ValidationColumn);
}
}
示例8: ValidatePartnerFamilyManual
/// <summary>
/// Validates the Partner Detail data of a Partner of PartnerClass FAMILY.
/// </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>
/// <returns>void</returns>
public static void ValidatePartnerFamilyManual(object AContext, PFamilyRow ARow,
ref TVerificationResultCollection AVerificationResultCollection, TValidationControlsDict AValidationControlsDict)
{
DataColumn ValidationColumn;
TValidationControlsData ValidationControlsData;
TVerificationResult VerificationResult;
// Don't validate deleted DataRows
if (ARow.RowState == DataRowState.Deleted)
{
return;
}
// 'Marital Status' must not be unassignable
ValidationColumn = ARow.Table.Columns[PFamilyTable.ColumnMaritalStatusId];
if (AValidationControlsDict.TryGetValue(ValidationColumn, out ValidationControlsData))
{
PtMaritalStatusTable TypeTable;
PtMaritalStatusRow TypeRow;
VerificationResult = null;
if ((!ARow.IsMaritalStatusNull())
&& (ARow.MaritalStatus != String.Empty))
{
TypeTable = (PtMaritalStatusTable)TSharedDataCache.TMPartner.GetCacheablePartnerTable(
TCacheablePartnerTablesEnum.MaritalStatusList);
TypeRow = (PtMaritalStatusRow)TypeTable.Rows.Find(ARow.MaritalStatus);
// 'Marital Status' must not be unassignable
if ((TypeRow != null)
&& !TypeRow.AssignableFlag
&& (TypeRow.IsAssignableDateNull()
|| (TypeRow.AssignableDate <= DateTime.Today)))
{
// if 'Marital Status' is unassignable then check if the value has been changed or if it is a new record
if (TSharedValidationHelper.IsRowAddedOrFieldModified(ARow, PFamilyTable.GetMaritalStatusDBName()))
{
VerificationResult = new TScreenVerificationResult(new TVerificationResult(AContext,
ErrorCodes.GetErrorInfo(PetraErrorCodes.ERR_VALUEUNASSIGNABLE_WARNING,
new string[] { ValidationControlsData.ValidationControlLabel, ARow.MaritalStatus })),
ValidationColumn, ValidationControlsData.ValidationControl);
}
}
}
// Handle addition/removal to/from TVerificationResultCollection
AVerificationResultCollection.Auto_Add_Or_AddOrRemove(AContext, VerificationResult, ValidationColumn);
}
// 'MaritalStatusSince' must be valid
ValidationColumn = ARow.Table.Columns[PFamilyTable.ColumnMaritalStatusSinceId];
if (AValidationControlsDict.TryGetValue(ValidationColumn, out ValidationControlsData))
{
VerificationResult = TSharedValidationControlHelper.IsNotInvalidDate(ARow.MaritalStatusSince,
ValidationControlsData.ValidationControlLabel, AVerificationResultCollection, false,
AContext, ValidationColumn, ValidationControlsData.ValidationControl);
// Handle addition to/removal from TVerificationResultCollection
AVerificationResultCollection.Auto_Add_Or_AddOrRemove(AContext, VerificationResult, ValidationColumn);
}
}
示例9: ValidateContactTypesSetupManual
/// <summary>
/// Validates the Partner Contact Types Setup usercontrol 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 ValidateContactTypesSetupManual(object AContext, PPartnerAttributeTypeRow ARow,
ref TVerificationResultCollection AVerificationResultCollection, TValidationControlsDict AValidationControlsDict)
{
DataColumn ValidationColumn;
TValidationControlsData ValidationControlsData;
TVerificationResult VerificationResult = null;
// Don't validate deleted DataRows
if (ARow.RowState == DataRowState.Deleted)
{
return;
}
// 'HyperLink Format' must be correct if ARow.AttributeTypeValueKind is "CONTACTDETAIL_HYPERLINK_WITHVALUE"
ValidationColumn = ARow.Table.Columns[PPartnerAttributeTypeTable.ColumnHyperlinkFormatId];
if (AValidationControlsDict.TryGetValue(ValidationColumn, out ValidationControlsData))
{
if (ARow.AttributeTypeValueKind == "CONTACTDETAIL_HYPERLINK_WITHVALUE")
{
// Remove any Data Validation errors that might have been recorded
AVerificationResultCollection.Remove(ValidationColumn);
// 'HyperLink Format' must not be empty string
VerificationResult = TGeneralChecks.ValueMustNotBeNullOrEmptyString(ARow.HyperlinkFormat, Catalog.GetString("Link Format"),
AContext, ValidationColumn, ValidationControlsData.ValidationControl);
if ((VerificationResult == null)
&& (ARow.HyperlinkFormat == THyperLinkHandling.HYPERLINK_WITH_VALUE_VALUE_PLACEHOLDER_IDENTIFIER))
{
// 'HyperLink Format' must contain more than just THyperLinkHandling.HYPERLINK_WITH_VALUE_VALUE_PLACEHOLDER_IDENTIFIER
VerificationResult = new TScreenVerificationResult(new TVerificationResult(AContext,
ErrorCodes.GetErrorInfo(PetraErrorCodes.ERR_INVALID_HYPERLINK_WITH_VALUE_JUST_CONTAINING_PLACEHOLDER,
new string[] { THyperLinkHandling.HYPERLINK_WITH_VALUE_VALUE_PLACEHOLDER_IDENTIFIER })),
ValidationColumn, ValidationControlsData.ValidationControl);
}
if ((VerificationResult == null)
&& (ARow.HyperlinkFormat.IndexOf(THyperLinkHandling.HYPERLINK_WITH_VALUE_VALUE_PLACEHOLDER_IDENTIFIER,
StringComparison.InvariantCulture) == -1))
{
// 'HyperLink Format' must contain THyperLinkHandling.HYPERLINK_WITH_VALUE_VALUE_PLACEHOLDER_IDENTIFIER,
VerificationResult = new TScreenVerificationResult(new TVerificationResult(AContext,
ErrorCodes.GetErrorInfo(PetraErrorCodes.ERR_INVALID_HYPERLINK_WITH_VALUE_NOT_CONTAINING_PLACEHOLDER,
new string[] { THyperLinkHandling.HYPERLINK_WITH_VALUE_VALUE_PLACEHOLDER_IDENTIFIER })),
ValidationColumn, ValidationControlsData.ValidationControl);
}
// Handle addition to/removal from TVerificationResultCollection
AVerificationResultCollection.Auto_Add_Or_AddOrRemove(AContext, VerificationResult, ValidationColumn);
}
else
{
// Remove any Data Validation errors that might have been recorded
AVerificationResultCollection.Remove(ValidationColumn);
}
}
VerificationResult = null;
// 'Unssignable Date' must not be empty if the flag is set
ValidationColumn = ARow.Table.Columns[PPartnerAttributeTypeTable.ColumnUnassignableDateId];
if (AValidationControlsDict.TryGetValue(ValidationColumn, out ValidationControlsData))
{
if (ARow.Unassignable)
{
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);
}
}
示例10: ValidateGiftMotivationSetupManual
/// <summary>
/// Validates the Gift Motivation Setup.
/// </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="ATaxDeductiblePercentageEnabled">True if Tax Deductible Percentage is enabled</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>
/// <returns>void</returns>
public static void ValidateGiftMotivationSetupManual(object AContext, AMotivationDetailRow ARow, bool ATaxDeductiblePercentageEnabled,
ref TVerificationResultCollection AVerificationResultCollection, TValidationControlsDict AValidationControlsDict)
{
DataColumn ValidationColumn;
TValidationControlsData ValidationControlsData;
TVerificationResult VerificationResult;
// Don't validate deleted DataRows
if (ARow.RowState == DataRowState.Deleted)
{
return;
}
// 'Motivation Group' must not be unassignable
ValidationColumn = ARow.Table.Columns[AMotivationDetailTable.ColumnMotivationGroupCodeId];
if (AValidationControlsDict.TryGetValue(ValidationColumn, out ValidationControlsData))
{
AMotivationGroupTable MotivationGroupTable;
AMotivationGroupRow MotivationGroupPointRow;
VerificationResult = null;
if ((!ARow.IsMotivationGroupCodeNull())
&& (ARow.MotivationGroupCode != String.Empty))
{
MotivationGroupTable = (AMotivationGroupTable)TSharedDataCache.TMFinance.GetCacheableFinanceTable(
TCacheableFinanceTablesEnum.MotivationGroupList);
MotivationGroupPointRow = (AMotivationGroupRow)MotivationGroupTable.Rows.Find(
new object[] { ARow.LedgerNumber, ARow.MotivationGroupCode });
// 'Motivation Group' must not be unassignable
if ((MotivationGroupPointRow != null)
&& !MotivationGroupPointRow.GroupStatus)
{
// if 'Motivation Group' is unassignable then check if the value has been changed or if it is a new record
if (TSharedValidationHelper.IsRowAddedOrFieldModified(ARow, AMotivationDetailTable.GetMotivationGroupCodeDBName()))
{
VerificationResult = new TScreenVerificationResult(new TVerificationResult(AContext,
ErrorCodes.GetErrorInfo(PetraErrorCodes.ERR_VALUEUNASSIGNABLE_WARNING,
new string[] { ValidationControlsData.ValidationControlLabel, ARow.MotivationGroupCode })),
ValidationColumn, ValidationControlsData.ValidationControl);
}
}
}
// Handle addition/removal to/from TVerificationResultCollection
AVerificationResultCollection.Auto_Add_Or_AddOrRemove(AContext, VerificationResult, ValidationColumn);
}
if (ATaxDeductiblePercentageEnabled)
{
// 'TaxDeductibleAccount' must have a value (NOT NULL constraint)
ValidationColumn = ARow.Table.Columns[AMotivationDetailTable.ColumnTaxDeductibleAccountCodeId];
if (AValidationControlsDict.TryGetValue(ValidationColumn, out ValidationControlsData))
{
VerificationResult = TStringChecks.StringMustNotBeEmpty(ARow.TaxDeductibleAccountCode,
ValidationControlsData.ValidationControlLabel,
AContext, ValidationColumn, ValidationControlsData.ValidationControl);
// Handle addition to/removal from TVerificationResultCollection
AVerificationResultCollection.Auto_Add_Or_AddOrRemove(AContext, VerificationResult, ValidationColumn);
}
}
}
示例11: ValidateGiftBatchManual
/// <summary>
/// Validates the Gift 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="AAccountTableRef">Account Table. A reference to this table is REQUIRED when importing - optional otherwise</param>
/// <param name="ACostCentreTableRef">Cost centre table. A reference to this table is REQUIRED when importing - optional otherwise</param>
/// <param name="AAccountPropertyTableRef">Account Property Table. A reference to this table is REQUIRED when importing - optional otherwise</param>
/// <param name="AAccountingPeriodTableRef">Accounting Period Table. A reference to this table is REQUIRED when importing - optional otherwise</param>
/// <param name="ACorporateExchangeTableRef">Corporate exchange rate table. A reference to this table is REQUIRED when importing - optional otherwise</param>
/// <param name="ACurrencyTableRef">Currency table. A reference to this table is REQUIRED when importing - optional otherwise</param>
/// <param name="ABaseCurrency">Ledger base currency. Required when importing</param>
/// <param name="AInternationalCurrency">Ledger international currency. Required when importing</param>
/// <returns>True if the validation found no data validation errors, otherwise false.</returns>
public static bool ValidateGiftBatchManual(object AContext,
AGiftBatchRow ARow,
ref TVerificationResultCollection AVerificationResultCollection,
TValidationControlsDict AValidationControlsDict,
AAccountTable AAccountTableRef = null,
ACostCentreTable ACostCentreTableRef = null,
AAccountPropertyTable AAccountPropertyTableRef = null,
AAccountingPeriodTable AAccountingPeriodTableRef = null,
ACorporateExchangeRateTable ACorporateExchangeTableRef = null,
ACurrencyTable ACurrencyTableRef = null,
string ABaseCurrency = null,
string AInternationalCurrency = 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))
{
return true;
}
bool IsImporting = AContext.ToString().Contains("Importing");
// Bank Account Code must be active
ValidationColumn = ARow.Table.Columns[AGiftBatchTable.ColumnBankAccountCodeId];
ValidationContext = ARow.BankAccountCode;
if (AValidationControlsDict.TryGetValue(ValidationColumn, out ValidationControlsData))
{
if (!ARow.IsBankAccountCodeNull() && (AAccountTableRef != null))
{
// We even need to check that the code exists!
AAccountRow foundRow = (AAccountRow)AAccountTableRef.Rows.Find(new object[] { ARow.LedgerNumber, ARow.BankAccountCode });
if ((foundRow == null)
&& AVerificationResultCollection.Auto_Add_Or_AddOrRemove(
AContext,
new TVerificationResult(ValidationContext,
String.Format(Catalog.GetString("Unknown bank account code '{0}'."), ARow.BankAccountCode),
TResultSeverity.Resv_Critical),
ValidationColumn))
{
VerifResultCollAddedCount++;
}
// If it does exist and the account is a foreign currency account then the batch currency must match
if ((foundRow != null) && foundRow.ForeignCurrencyFlag)
{
if ((foundRow.ForeignCurrencyCode != ARow.CurrencyCode) && AVerificationResultCollection.Auto_Add_Or_AddOrRemove(
AContext,
new TVerificationResult(ValidationContext,
String.Format(Catalog.GetString(
"The bank account code '{0}' is a foreign currency account so the currency code for the batch must be '{1}'."),
ARow.BankAccountCode, foundRow.ForeignCurrencyCode),
TResultSeverity.Resv_Critical),
ValidationColumn))
{
VerifResultCollAddedCount++;
}
}
// If it does exist it must be a posting account
if (foundRow != null)
{
if (!foundRow.PostingStatus && AVerificationResultCollection.Auto_Add_Or_AddOrRemove(
AContext,
new TVerificationResult(ValidationContext,
String.Format(Catalog.GetString(
"The bank account code '{0}' is not a posting account."),
ARow.BankAccountCode),
TResultSeverity.Resv_Critical),
ValidationColumn))
{
VerifResultCollAddedCount++;
}
}
if ((foundRow != null) && (ARow.GiftType == MFinanceConstants.GIFT_TYPE_GIFT))
//.........这里部分代码省略.........
示例12: ValidateAcquisitionCodeSetup
/// <summary>
/// Validates the Setup Partner Acquisition Code 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 ValidateAcquisitionCodeSetup(object AContext, PAcquisitionRow ARow,
ref TVerificationResultCollection AVerificationResultCollection, TValidationControlsDict AValidationControlsDict)
{
DataColumn ValidationColumn;
TValidationControlsData ValidationControlsData;
TVerificationResult VerificationResult;
// Don't validate deleted DataRows
if (ARow.RowState == DataRowState.Deleted)
{
return;
}
// 'AcquisitionDescription' must have a value
ValidationColumn = ARow.Table.Columns[PAcquisitionTable.ColumnAcquisitionDescriptionId];
if (AValidationControlsDict.TryGetValue(ValidationColumn, out ValidationControlsData))
{
VerificationResult = TStringChecks.StringMustNotBeEmpty(ARow.AcquisitionDescription,
ValidationControlsData.ValidationControlLabel,
AContext, ValidationColumn, ValidationControlsData.ValidationControl);
// Handle addition to/removal from TVerificationResultCollection
AVerificationResultCollection.Auto_Add_Or_AddOrRemove(AContext, VerificationResult, ValidationColumn);
}
}
示例13: ValidateLocalDataFieldSetup
/// <summary>
/// Validates the MCommon Local Data Field 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>
public static void ValidateLocalDataFieldSetup(object AContext, PDataLabelRow ARow,
ref TVerificationResultCollection AVerificationResultCollection, TValidationControlsDict AValidationControlsDict)
{
DataColumn ValidationColumn;
TValidationControlsData ValidationControlsData;
TVerificationResult VerificationResult = null;
// Don't validate deleted DataRows
if (ARow.RowState == DataRowState.Deleted)
{
return;
}
// If the 'DataType' is 'lookup' then categoryCode cannot be empty string (which would indicate no entries in the DataLabelCategory DB table)
VerificationResult = null;
ValidationColumn = ARow.Table.Columns[PDataLabelTable.ColumnLookupCategoryCodeId];
if (AValidationControlsDict.TryGetValue(ValidationColumn, out ValidationControlsData))
{
if (String.Compare(ARow.DataType, "lookup", true) == 0)
{
VerificationResult = TStringChecks.StringMustNotBeEmpty(ARow.LookupCategoryCode,
ValidationControlsData.ValidationControlLabel,
AContext, ValidationColumn, ValidationControlsData.ValidationControl);
if (VerificationResult != null)
{
VerificationResult.OverrideResultText(Catalog.GetString(
"You cannot use the option list until you have defined at least one option using the 'Local Data Option List Names' main menu selection"));
}
}
// Handle addition to/removal from TVerificationResultCollection
AVerificationResultCollection.Auto_Add_Or_AddOrRemove(AContext, VerificationResult, ValidationColumn);
}
}
示例14: ValidateFormDesignManual
/// <summary>
/// Additional manual validation for Form Design Setup
/// </summary>
/// <param name="AContext">Context that describes what I'm validating.</param>
/// <param name="ARow">DataRow with the the data I'm validating</param>
/// <param name="AVerificationResultCollection">Will be filled with 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 ValidateFormDesignManual(object AContext, PFormRow ARow,
ref TVerificationResultCollection AVerificationResultCollection, TValidationControlsDict AValidationControlsDict)
{
// Don't validate deleted DataRows
if (ARow.RowState == DataRowState.Deleted)
{
return;
}
TValidationControlsData ValidationControlsData;
TVerificationResult VerificationResult;
// FormTypeCode must not be blank
DataColumn ValidationColumn = ARow.Table.Columns[PFormTable.ColumnFormTypeCodeId];
if (AValidationControlsDict.TryGetValue(ValidationColumn, out ValidationControlsData))
{
VerificationResult = TStringChecks.StringMustNotBeEmpty(ARow.FormTypeCode, ValidationControlsData.ValidationControlLabel,
AContext, ValidationColumn, ValidationControlsData.ValidationControl);
// Handle addition to/removal from TVerificationResultCollection
AVerificationResultCollection.Auto_Add_Or_AddOrRemove(AContext, VerificationResult, ValidationColumn);
}
// MinimumAmount must be zero or positive
ValidationColumn = ARow.Table.Columns[PFormTable.ColumnMinimumAmountId];
if (AValidationControlsDict.TryGetValue(ValidationColumn, out ValidationControlsData))
{
VerificationResult = TNumericalChecks.IsPositiveOrZeroDecimal(ARow.MinimumAmount, ValidationControlsData.ValidationControlLabel,
AContext, ValidationColumn, ValidationControlsData.ValidationControl);
// Handle addition to/removal from TVerificationResultCollection
AVerificationResultCollection.Auto_Add_Or_AddOrRemove(AContext, VerificationResult, ValidationColumn);
}
// Description must not be blank
ValidationColumn = ARow.Table.Columns[PFormTable.ColumnFormDescriptionId];
if (AValidationControlsDict.TryGetValue(ValidationColumn, out ValidationControlsData))
{
VerificationResult = TStringChecks.StringMustNotBeEmpty(ARow.FormDescription, ValidationControlsData.ValidationControlLabel,
AContext, ValidationColumn, ValidationControlsData.ValidationControl);
// Handle addition to/removal from TVerificationResultCollection
AVerificationResultCollection.Auto_Add_Or_AddOrRemove(AContext, VerificationResult, ValidationColumn);
}
// Formality level must be between 1 and 6
ValidationColumn = ARow.Table.Columns[PFormTable.ColumnFormalityLevelId];
if (AValidationControlsDict.TryGetValue(ValidationColumn, out ValidationControlsData))
{
VerificationResult = TNumericalChecks.IsInRange(ARow.FormalityLevel, 1, 6, ValidationControlsData.ValidationControlLabel,
AContext, ValidationColumn, ValidationControlsData.ValidationControl);
// Handle addition to/removal from TVerificationResultCollection
AVerificationResultCollection.Auto_Add_Or_AddOrRemove(AContext, VerificationResult, ValidationColumn);
}
}
示例15: ValidateFrequencySetupManual
/// <summary>
/// Validates the Setup Frequency 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 ValidateFrequencySetupManual(object AContext, AFrequencyRow ARow,
ref TVerificationResultCollection AVerificationResultCollection, TValidationControlsDict AValidationControlsDict)
{
DataColumn ValidationColumn;
TValidationControlsData ValidationControlsData;
TVerificationResult VerificationResult;
bool bFoundNegativeValue = false;
// Don't validate deleted DataRows
if (ARow.RowState == DataRowState.Deleted)
{
return;
}
// 'NumberOfYears' cannot be negative
ValidationColumn = ARow.Table.Columns[AFrequencyTable.ColumnNumberOfYearsId];
if (AValidationControlsDict.TryGetValue(ValidationColumn, out ValidationControlsData))
{
VerificationResult = TNumericalChecks.IsPositiveOrZeroInteger(ARow.NumberOfYears,
ValidationControlsData.ValidationControlLabel,
AContext, ValidationColumn, ValidationControlsData.ValidationControl);
// Handle addition/removal to/from TVerificationResultCollection
AVerificationResultCollection.Auto_Add_Or_AddOrRemove(AContext, VerificationResult, ValidationColumn);
bFoundNegativeValue |= (VerificationResult != null);
}
// 'NumberOfMonths' cannot be negative
ValidationColumn = ARow.Table.Columns[AFrequencyTable.ColumnNumberOfMonthsId];
if (AValidationControlsDict.TryGetValue(ValidationColumn, out ValidationControlsData))
{
VerificationResult = TNumericalChecks.IsPositiveOrZeroInteger(ARow.NumberOfMonths,
ValidationControlsData.ValidationControlLabel,
AContext, ValidationColumn, ValidationControlsData.ValidationControl);
// Handle addition/removal to/from TVerificationResultCollection
AVerificationResultCollection.Auto_Add_Or_AddOrRemove(AContext, VerificationResult, ValidationColumn);
bFoundNegativeValue |= (VerificationResult != null);
}
// 'NumberOfDays' cannot be negative
ValidationColumn = ARow.Table.Columns[AFrequencyTable.ColumnNumberOfDaysId];
if (AValidationControlsDict.TryGetValue(ValidationColumn, out ValidationControlsData))
{
VerificationResult = TNumericalChecks.IsPositiveOrZeroInteger(ARow.NumberOfDays,
ValidationControlsData.ValidationControlLabel,
AContext, ValidationColumn, ValidationControlsData.ValidationControl);
// Handle addition/removal to/from TVerificationResultCollection
AVerificationResultCollection.Auto_Add_Or_AddOrRemove(AContext, VerificationResult, ValidationColumn);
bFoundNegativeValue |= (VerificationResult != null);
}
// 'NumberOfHours' cannot be negative
ValidationColumn = ARow.Table.Columns[AFrequencyTable.ColumnNumberOfHoursId];
if (AValidationControlsDict.TryGetValue(ValidationColumn, out ValidationControlsData))
{
VerificationResult = TNumericalChecks.IsPositiveOrZeroInteger(ARow.NumberOfHours,
ValidationControlsData.ValidationControlLabel,
AContext, ValidationColumn, ValidationControlsData.ValidationControl);
// Handle addition/removal to/from TVerificationResultCollection
AVerificationResultCollection.Auto_Add_Or_AddOrRemove(AContext, VerificationResult, ValidationColumn);
bFoundNegativeValue |= (VerificationResult != null);
}
// 'NumberOfMinutes' cannot be negative
ValidationColumn = ARow.Table.Columns[AFrequencyTable.ColumnNumberOfMinutesId];
if (AValidationControlsDict.TryGetValue(ValidationColumn, out ValidationControlsData))
{
VerificationResult = TNumericalChecks.IsPositiveOrZeroInteger(ARow.NumberOfMinutes,
ValidationControlsData.ValidationControlLabel,
AContext, ValidationColumn, ValidationControlsData.ValidationControl);
// Handle addition/removal to/from TVerificationResultCollection
AVerificationResultCollection.Auto_Add_Or_AddOrRemove(AContext, VerificationResult, ValidationColumn);
bFoundNegativeValue |= (VerificationResult != null);
}
// Finally, having checked that no single box is negative, at least one of the boxes (any box) must be a positive number
// So our test is going to fail if the sum of the boxes is 0 and we did not get any negatives
// We pick the first box and invalidate that, because this is only one error despite all boxes being 0.
// This does mean that the tooltip will only pop up if the focus is associated with this one box, but the validation will still work.
// It will not be possible to leave this record.
ValidationColumn = ARow.Table.Columns[AFrequencyTable.ColumnNumberOfYearsId];
//.........这里部分代码省略.........