2 - Demo application

   —   
For the purpose of the tutorial I have created simple Silverlight application called "SilverlightDemo" which brings you the possibility to find specified users.
How it works
1) Type search expression as user name, first name, middle name, last name, full name or e-mail address or part of one of them.
2) Choose data communication method which will be used to get the data from Kentico CMS database.
3) Press "Search" button. 
4)  Users who matched the search criteria are displayed bellow the form.



Helper methods
Following helper methods are used within the demo application by services to display the data:

Helper methods


Service helper
Most of the communication methods in my example would call the similar routines for retrieving data so it was necessary to create some helper method to avoid code redundancy:

1) Right click on the App_Code directory in your web project folder and choose Add New Item option:




2) Select Class as the type of the new item and name it as ServiceHelper.cs:



3) Define string GetUsers(string searchExpression) method which will search for users who match the specified search expression. Search expression can be set as UserName, FirstName, MiddleName, LastName, Email or part of one of them. Found users' data are returned as XML string containing users' full name and e-mail address. Of course, you can use DataSet.GetXml() to get the XML directly from the DataSet but that method doesn't format the output XML to follow our needs.
 


Data communication methods

In the following steps I will describe in more details each way of communication between the client (Silverlight application) and the server (web application with database).




This article is part of the Data communication in Silverlight 2.0 tutorial.
Share this article on   LinkedIn

Petr Vozak

Technology Partnership Product Owner at Kentico. He works with technology partners to enrich the Kentico product offering and bring greater value to those using our products.

Comments