PostCustomEditValidator assembly
- Last UpdatedApr 24, 2025
- 2 minute read
When the constructor is called, the input arguments are loaded into the members of the base class ADEBaseEditFormPopUp. The custom class can use these members/properties for data manipulations:
-
Form formThatOpenedThisForm
-
string dalAlias
-
BindingSource baseBindingSource
-
string tableName
-
string columnName
-
Control ControlThatOpened
In the following example, the PostValidate method evaluates column values and marks errors in the RealTime database (RTDB) almdisturbance table configuration.
///<summary>Class for customized ADE Post Validation for almdisturbance table configuration </summary>
public partial class AlmdisturbancePostValidationPopUp: ADEBaseEditFormPopUp
{
string table_name = "";
DataSet ds;
DataTable dt;
DataRow dr;
/// <summary>
/// Constructor
/// </summary>
public AlmdisturbancePostValidationPopUp () : base()
{
InitializeComponent();
}
/// <summary>
/// Constructor
/// </summary>
/// <param name="argsIn">Optional arguments where:
/// argsIn[0] is the parent form (type Form),
/// argsIn[1] is the DAL alias (type string),
/// argsIn[2] is the Binding Source (type BindingSource),
/// argsIn[3] is the parent table name (type string),
/// argsIn[4] is the table’s column name (type string),
/// argsIn[5] is the control that invoked this popup (type Control)
/// </param>
public AlmdisturbancePostValidationPopUp (object[] argsIn): base(argsIn)
{
InitializeComponent();
……
}
public void PostValidate(object[] argsIn)
{
try
{
if (string.Compare(tableName, ALMDISTURBANCE_TABLE, StringComparison.InvariantCultureIgnoreCase) == 0)
{
DataSet ds = baseBindingSource.DataSource as DataSet;
DataTable dt = ds.Tables[baseBindingSource.DataMember];
DataRow dr = dt.Rows[baseBindingSource.Position];
string name = (string)dr[NAME_FIELDNAME];
string system = (string)dr[SYSTEM_FIELDNAME];
if (string.Compare(name, system, StringComparison.InvariantCultureIgnoreCase) != 0)
{
// The name and system do no match. Put the 'name' column in an error
// state.
dr.SetColumnError(NAME_FIELDNAME, DBEditHelperFormsResources_Wrapper.AlmdisturbancePostValidationError);
}
else
{
// Clear errors and allow the user to save the data. Any other
// invalid data will be caught and flagged by the DataSet.
dr.ClearErrors();
}
}
}
catch (Exception ex)
{
DNALog.WriteLog(DNALog.LogLevel.Always, ex.Message);
}
finally
{
this.Close();
}
}
}
Ensure that the assembly, class, and method names are correctly defined in the XML file.