Business Logic Framework - How To:
Assuming that you would like to search for all customers whose email address contains 'a' or the email is null, the following code snippet shows how to achieve this:
| 1 |
using (Customers customer = new Customers()) |
| 2 |
{ |
| 3 |
// Let the object know that you intend to perform a search by setting the ObjectMode property to ObjectModes.Search |
| 4 |
customer.ObjectMode = Akal.QuickObjects.ObjectBase.ObjectModes.Search; |
| 5 |
|
| 6 |
|
| 7 |
// PartialTextMatch property indicates that we would like the business object to perform partial text search. |
| 8 |
// This can be overridden or set at the field level as well. |
| 9 |
customer.PartialTextMatch = true; |
| 10 |
|
| 11 |
|
| 12 |
// Assign the value we would like to search for. |
| 13 |
customer.Email.Value = "a"; |
| 14 |
|
| 15 |
// Change the SearchMode property to SearchModes.ValueOrNull and the business object will automatically search for |
| 16 |
// either the value OR a NULL in the email field. |
| 17 |
customer.Email.SearchMode = Akal.QuickObjects.ObjectBase.SearchModes.ValueOrNull; |
| 18 |
|
| 19 |
|
| 20 |
// For the above line to work correctly we must set the IsNull property to true. |
| 21 |
customer.Email.IsNull = true; |
| 22 |
this.GridView.DataSource = customer.Find(); |
| 23 |
this.GridView.DataMember = customer.GetResultSetName(); |
| 24 |
} |
| 25 |
|
| 1 |
Using customer As New Customers() |
| 2 |
' Let the object know that you intend to perform a search by setting the ObjectMode property to ObjectModes.Search |
| 3 |
customer.ObjectMode = Akal.QuickObjects.ObjectBase.ObjectModes.Search |
| 4 |
|
| 5 |
|
| 6 |
' PartialTextMatch property indicates that we would like the business object to perform partial text search. |
| 7 |
' This can be overridden or set at the field level as well. |
| 8 |
customer.PartialTextMatch = True |
| 9 |
|
| 10 |
|
| 11 |
' Assign the value we would like to search for. |
| 12 |
customer.Email.Value = "a" |
| 13 |
|
| 14 |
' Change the SearchMode property to SearchModes.ValueOrNull and the business object will automatically search for |
| 15 |
' either the value OR a NULL in the email field. |
| 16 |
customer.Email.SearchMode = Akal.QuickObjects.ObjectBase.SearchModes.ValueOrNull |
| 17 |
|
| 18 |
|
| 19 |
' For the above line to work correctly we must set the IsNull property to true. |
| 20 |
customer.Email.IsNull = True |
| 21 |
Me.GridView.DataSource = customer.Find() |
| 22 |
Me.GridView.DataMember = customer.GetResultSetName() |
| 23 |
End Using |