Share via


SimpleLeafCondition Constructor (Argument, SimpleOperator, Argument)

Initializes a new instance of the SimpleLeafCondition class with two arguments objects and an operator.

Namespace: Microsoft.SqlServer.NotificationServices.Rules
Assembly: Microsoft.SqlServer.NotificationServices.Rules (in microsoft.sqlserver.notificationservices.rules.dll)

Syntax

'Declaration
Public Sub New ( _
    left As Argument, _
    op As SimpleOperator, _
    right As Argument _
)
public SimpleLeafCondition (
    Argument left,
    SimpleOperator op,
    Argument right
)
public:
SimpleLeafCondition (
    Argument^ left, 
    SimpleOperator op, 
    Argument^ right
)
public SimpleLeafCondition (
    Argument left, 
    SimpleOperator op, 
    Argument right
)
public function SimpleLeafCondition (
    left : Argument, 
    op : SimpleOperator, 
    right : Argument
)

Parameters

  • right
    The Argument for the Right property.

Example

The following examples show how to use a SimpleLeafCondition to define the conditions that need to be met by an event in order for Notification Services to generate a notification for the subscriber:

// Create the NSInstance object.
NSInstance testInstance = 
    new NSInstance("InventoryTrackerInstance");

// Create the NSApplication object.
NSApplication testApplication =
    new NSApplication(testInstance, "InventoryTracker");

// Create Subscription object.
Subscription s = new Subscription(testApplication, 
    "InventoryTrackerSubscriptions");

// Define subscription properties
s.SubscriberId = "TestUser1";
s.Enabled = true;
s.RuleName = "InventoryTrackerRule";
s["DeviceName"] = "Work e-mail";
s["SubscriberLocale"] = "en-US";

// Define OrCondition
s.Condition = new AndCondition(
    new SimpleLeafCondition(new FieldValue("ProductName"),
                    SimpleOperator.Equals,
                    "Road-250 Black, 48"),
    new SimpleLeafCondition(new FieldValue("LocationName"),
                    SimpleOperator.Equals,
                    "Final Assembly"),
    new SimpleLeafCondition(new FieldValue("Quantity"),
                    SimpleOperator.LessThanOrEqualTo,
                    35)
);

// Add subscription
s.Add();
' Create the NSInstance object.
Dim testInstance As New NSInstance("InventoryTrackerInstance")
 
' Create the NSApplication object.
Dim testApplication As _
    New NSApplication(testInstance, "InventoryTracker")
 
' Create Subscription object.
Dim s As New Subscription(testApplication, _
    "InventoryTrackerSubscriptions")
 
' Define subscription properties
s.SubscriberId = "TestUser1"
s.Enabled = True
s.RuleName = "InventoryTrackerRule"
s("DeviceName") = "Work e-mail"
s("SubscriberLocale") = "en-US"
 
' Define OrCondition
s.Condition = New AndCondition( _
    New SimpleLeafCondition( _
        New FieldValue("ProductName"), _
        SimpleOperator.Equals, _
        "Road-250 Black, 48"), _
    New SimpleLeafCondition( _
        New FieldValue("LocationName"), _
        SimpleOperator.Equals, _
        "Final Assembly"), _
    New SimpleLeafCondition( _
        New FieldValue("Quantity"), _
        SimpleOperator.LessThanOrEqualTo, _
        35))
 
' Add subscription
s.Add()

Platforms

Development Platforms

For a list of the supported platforms, see Hardware and Software Requirements for Installing SQL Server 2005.

Target Platforms

For a list of the supported platforms, see Hardware and Software Requirements for Installing SQL Server 2005.

See Also

Reference

SimpleLeafCondition Class
SimpleLeafCondition Members
Microsoft.SqlServer.NotificationServices.Rules Namespace