Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
CheckRulesHook Best Practices
Message
De
27/04/2005 09:26:18
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Titre:
CheckRulesHook Best Practices
Versions des environnements
Environment:
VB.NET 1.1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01008812
Message ID:
01008812
Vues:
51
I've noticed various ways to use the CheckRuleHook.
It seems that one might work better with child objects and the other with parent objects.
Could someone help indicate what the idea behind each of the following syntaxes is and when whould each be used?
' Checks business rules against the specified DataTable
Public Overrides Function CheckRulesHook(ByVal ds As DataSet, ByVal tableName As String) As Boolean
    Dim result As Boolean = True
    Dim RowCount As Integer = ds.Tables(tableName).Rows.Count
    Dim row As Integer

    For row = 0 To RowCount - 1
        Me.DataRow = ds.Tables(tableName).Rows(row)
        Me.CurrentRow = row

        If TypeOf Me.DataRow("Quantity") Is Int16 Then
            Me.ValidateQuantity(CType(Me.DataRow("Quantity"), System.Int16))
            Me.ValidateProductID(CInt(Me.DataRow("ProductID")))
        End If
    Next row

    Return result
End Function
' Checks business rules against the specified DataTable
Public Overrides Function CheckRulesHook(ByVal ds As DataSet, ByVal tableName As String) As Boolean
    Me.ValidateShipName(Me.DataRow("ShipName"))
    Me.ValidateShipRegion(Me.DataRow("ShipRegion").ToString())

    Return Me.ErrorProviderBrokenRuleCount = 0
End Function
    ' Checks business rules against the specified DataTable
    Public Overrides Function CheckRulesHook _
    (ByVal ds As DataSet, ByVal tableName As String) As Boolean
        If Not (ds Is Nothing) Then
            Dim dr As DataRow = ds.Tables(tableName).Rows(0)

            Me.ValidateVisitId(CInt(Me.DataRow("VisitId")))

        End If
        Return Me.ErrorProviderBrokenRuleCount = 0
    End Function
Perhaps a brief walkthough of what each of these examples is attempting to do would be useful.
THANKS
Joe Salvatore, Programmer/Analyst - The Stellar Group
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform