Click or drag to resize

ControllerDataGridDataItemClassValidate Method

Data items validation with AppModule method Validate. Is data item not valid then show a message on desktop.

Namespace:  SOWIWin.Helper
Assembly:  SOWIWin.Helper (in SOWIWin.Helper.dll) Version: 19.1.23.1 (19.1.23.622)
Syntax
public virtual bool Validate()

Return Value

Type: Boolean
Is it data valid?

Implements

IControllerDataGridValidate
Remarks
Validating all data items on Action value Create, Update and Delete
Examples
This example checks whether records should be created or deleted. This is not supported.
/// <summary>
/// Checks whether records should be created or deleted. This is not supported.
/// </summary>
/// <returns>Is it data valid?</returns>
public override bool Validate()
{
    //* AppModule validation *
    bool lIsValid = base.Validate();

    if (lIsValid)
    {
        string lMessage = "";
        for (int i = 0; i < this.DataItems.Count; i++)
        {
            if (this.DataItems[i].ActionDB == SOWIData.Actions.Create)
            {   //* Create -> Insert *
                lMessage = "DB Action Create not supported!" + Environment.NewLine;
                lIsValid = false;
            }
            if (this.DataItems[i].ActionDB == SOWIData.Actions.Delete)
            {   //* Delete *
                lMessage = "DB Action Delete not supported!" + Environment.NewLine;
                lIsValid = false;
            }
        }
        if (lMessage.Length > 0)
        {
            SOWIWin.Helper.Message.Show(lMessage);
        }
    }
    return lIsValid;
}
See Also