31/8/10

Sample C#, Silverlight 4, WCF project

This project is called The Gardener. It is a C#, .NET, Silverlight application which connects to an MS SQL Server 2008 via WCF Services.

The project in based on the ideas and techniques used in Pro Silverlight 3 in C# and Microsoft Silverlight 4 Business Application Development Beginners Guide books, which provide a great way on getting to know Silverlight 3 and 4 and develop a small scale business application

Find the whole code along with its Database and log file in .mdf format here

The Gardener was built using:

-    MS Visual Studio 2010
-    MS SQL Server 2008
-    Expression Blend 3
-    Silverlight 4
-    WCF Services
-    Pages and Frames for navigation
-    Animations
-    Animation Easing
-    Bing Maps
-    InkPresenter
-    UriMapping
-    Silverlight themes

The Gardener makes use of asynchronous WCF Service calls to store sketches that users make in the Database, by converting the Strokes Collection of the InkPresenter into XML format. Users can after that talk about their dream garden with the people of the Gardener.

The Gardener also uses Bing Maps to pin point the location of the stores upon the map. Bing Maps is the only map control that incorporates fully with Silverlight, as mentioned in Microsoft Silverlight 4 Business Application Development Beginners Guide. Note that you must make an account in Bing Maps and get a key which you must incorporate in the Map control, in your XAML, to get rid of that annoying alert on the Bing Map, which informs you that you provided invalid credentials.

In the Products section, I made use of the Silverlight DataGrid. I must say that this control not only looks great without any customization but it is also very powerful. Sorting, column resizing/moving and field editing with no or with very little code, unlike the ASP.NET GridView.

I used Pages and Frames for navigation in this project, since in this way I can keep track of the browser's history and navigate using the backwards and forward buttons of the browsers.

Animations and Animation Easing gives a better look and feel on the Pages of the application and makes it even better in the eyes of the customers.

Finally, my overall experience using the tools, technologies, techniques and IDEs was great, although I had a little bit of a hard time installing MS SQL Server 2008 and MS Visual Studio on my Windows 7 machine.

Next project I am looking forward to implementing is a full scale business Silverlight 4 application, using the Silverlight business application template of MS Visual Studio 2010 which will connect to the Database using RIA Services. For that I intend to study from Pro Business Applications with Silverlight 4 by Chris Anderson.

25/8/10

Sample C#, .NET Framework 3.5 project

I always want to provide possible employers with a sample of my work. I decided to write a Web Application in C# along with .NET Framework 3.5 in order for employers to get a grasp on whether I am suitable for the job. The project is called NewCertification and it is all about data retrieval and manipulation on the MS SQL Database, by communicating with it using an asmx Web Service

Visit this for some code implemented for the NewCertification project
Find the whole project, along with the Database and its log file in mdf format here
You will probably have to change the connection string in the WebService Web Config file to make a successful connection to the Database
Technologies/Techniques used
·         MasterPages
·         WebServices
·         ADO.NET
·         AJAX
·         User roles
·         Localization
·         Exception Handling/Logging
·         Authorization/Authentication
·         C# object oriented programming
·         Stored Procedures
·         Cryptography
·         Configuration Files
·         CSS Files
·         Encrypted Passwords in Database



Logging in the Web Application

1.       LoginUser.aspx
a.       The user enters a username and password
b.      Online Certification makes a Web Service call to validate the credentials and returns a Dataset
c.       If the Dataset contains no rows, the System alerts that there is no such user
d.      If the Dataset contains more than one row, this means that the user is joined to more than one role. Note that due to the implementation on newUser.aspx, the usernames are unique. The system redirects the user to userRoles.aspx to choose the desired role and continue to the specific homepage.
e.      If the Dataset contains a single row, redirect the user to his/hers homepage according to his/hers role

Authorization/Authentication
All WebContentForms use pageBase as their MasterPage. In the page load event of pageBase, the system checks if the Session userPk, username etc are set which can only be done with proper logging in. If these are not set Online Certification redirects the user to loginAgain.aspx, prompting for logging in. Thus if someone tries to bypass the log in page, by changing the text of the address bar to newUser.aspx for example, he/she will not be able to.

Exception Logging
Just like every system, Online Certification, will face exceptions. In order to provide better and faster support for the users, every exception will be logged in the Database. In the case of an exception, the user will be redirected to the exception page where he/she will receive the exception pk. After that he/she will be able to contact the system developers and provide them the pk, which will help them better understand what went wrong by querying the Database for the StackTrace and Message that corresponds to the specific pk.