Showing posts with label C#. Show all posts
Showing posts with label C#. Show all posts

Monday, May 21, 2012

ASP.NET MVC 3 (w/ C#): Student Information System


This is a simple Student Information System I created using ASP.NET MVC 3 and C#.

You can download the zip file here.


Because I'm new to ASP.NET MVC, I will list some interesting things for beginners that I used in this project:
  1. Adding attributes to entity classes generated by Entity Framework
  2. Creating AJAX search form
  3. Using Html.DropDownListFor() helper
  4. Using jQuery UI Datepicker

Friday, March 30, 2012

ASP.NET: Personality Temperament Test Project



This project is created using ASP.NET with C# as the language used in code-behind files.

If you are interested with the source code, you can download it from Google docs or from Planet Source Code.

You can use the following as your initial username and password:
Username: user1
Password: user1!234


Monday, February 27, 2012

Jboy Library System - Using WPF & EF of .NET


This is a simple Library System I made using the .NET Framework's Windows Presentation Foundation (WPF) for the GUI and Entity Framework (EF) for data access. (Not layered)

You can download the source code at Google Docs (click File -> Download) or at Planet-Source-Code.
You can download the stand-alone executable at Google Docs.

For username and password:
     Username: admin
     Password: admin

Enjoy!!!




Monday, August 29, 2011

Solution to Decorator Pattern Exercises of C# 3.0 Design Patterns

Decorator Pattern (this description is directly taken from the book C# 3.0 Design Patterns by Judith Bishop)

The role of the Decorator pattern is to provide a way of attaching new state and behavior to an object dynamically. The object does not know it is being “decorated,” which makes this a useful pattern for evolving systems. A key implementation point in the Decorator pattern is that decorators both inherit the original class and contain an instantiation of it.

Image is taken from www.dofactory.com

Click here to download my solution to the exercises.

These are the exercises from the book with a few comments oh how I coded my solution for each:

1. Assume that the Photo class was written with Drawer as a plain (not virtual) method and it cannot be altered. Reconstruct Example 2-2 so that it works under this constraint. (Hint: use an interface as in the theory example.)

2. Add to the Photo Decorator system a second type of component called Hominid. Use the drawing methods for ovals and lines to draw an approximation of a person. Then, use the same two  decorators—Tag and Border—to decorate Hominid objects.

3. Add other event handlers to the constructors of the decorators, together with additional behavior. For example, an OnClick event could cause a tag to appear, rather than having it appear  automatically.

4. Decorate the Console class so that Write and WriteLine methods are trapped and the output is reformatted for lines of a given size, avoiding unsightly wraparounds. Test your decorator with the program in Example 2-1.
Comments:
The Console class cannot be inherited because it is static. What I did here is I created a constructor that has a parameter that takes a TextWriter. The client needs to pass the Console.Out as parameter to the ConsoleDecorator's constructor.


5. Write a program that decorates the Stream class and shows how much of a file has been read in, using a trackbar.

Comments:
I used a ProgressBar instead of a TrackBar.
I created an event that will be raised each time a character is read by the TrackStream.Read() method.

 
6. Write a program that decorates the Stream class and asks for a password before allowing reading to continue.

7. Write a program that decorates a text message with a simple cipher. Include a second decorator that transforms the encrypted message back to plain text.
Comments:
I used a simple cipher called the Caesar's Cipher