IIO91110 .NET Programming Distances tasks

Spring 2009

The distance task 1: A pre-task Before Kick Start

Goal: learn to create a console application, to use arrays 

Task: In Finnish Lotto there is 39 numbers, and seven (7) numbers are drawn at randomly. Create a console application that draws seven numbers out of 39 and shows numbers in order in the console. Example: 1, 10, 20, 21, 37, 38, 39. (of course same number cannot occur). An end user can select how many drawns will be made, by given it as an start argument, if argument is not given, default is one (1). If more draws is done, every draw will be presented at own line.

Task 2: Use object-orientated solution, so it means that seperate business logic (drawing Lotto numbers) and User interface to own classes.

The distance task 2: Handling files and exceptions

Goal: learn to handle text- and XML-files in .NET, console programming, proper error handling

Background: look http://msdn.microsoft.com/en-us/library/seyhszts.aspx

Reading data from a text file

Create a console application that reads our customer's names from a text file (for example Brown Charlie, Peanuts ltd). Sort the names to alphabetical order and show them in a console each name in own line. In the file each name is own row, and there can be rows from one to about a almost infinite. Create and name a test text file yourself, put about 10 different names and place the file to c:\temp folder. The file name must be defined in the starting argument of the program. Check in the beginning that the given file exists and it is accessible. Use normal try-catch-finally -exception handling.

Reading data from console and writing to a XML file

Create a console application that reads customers name that an end user gives as long as user want to stop giving names. If the end user gives a valid name (for example "Donald Duck"), put the name to an array. If user gives number zero-length string we will end the reading. If user gives an invalid name (for example only a last name "Duck", the application gives a warning.
After the user has ended giving names, the application writes the names to a XML file named in the starting argument of the program. Create a suitable XML schema for the application.
Use normal try-catch-finally -exception handling, .

The distance task 3: Windows Forms

Task 1: WinLotto

Voluntary, do this if you have not done any Windows application with .NET

Goal: Learn to create a Windows application and how to use basic controls

Task: Take your pre-task Lotto and create itLotto.dll -Create a Windows application for Lotto. There is a combobox where to select what Lotto to play, there are textboxes where to give how many drawns will be made and there is a control where to show drawns, of course there are needed buttons where to start playing.

Task 2: Four Windows Forms

Goal: Learn to create a Windows application and how to transfer data between forms.

Usable information: Best Practices for Windows Forms Applications

Task: Build a Windows application with four forms (and one message box). An end-user must log in the application. In the application there is one prebuild user account (username=Charlie password=Brown) [not very good in we think security issues, but in this task we will not pay attention to this very important issue]. When the application is started it automatically shows the Login form. An end user must log on successfully before she or he can go the Main form. If an end user has not user account he/she can create a new user account for him/her. Store created user accounts in XML-file UserAccounts.xml, create suitable XML schema for user accounts.

The distance task 4: "Strange" objects

Strange objects in SM-Liiga

Goal: to learn classes, C# oo-programming, ArrayList, Arrays, List, generics

Task: Create GUI presented in picture 1 and create needed functionality for it. Create these three classes: Person, Employee and HockeyPlayer. Inherit classes HockeyPlayer and Employee from Person. Add possibility to store two types of persons: employee and players. The end user will select the type of person, add proper control to UI to select the type.
Needed public properties and methods are presented in picture 1. Create properties as they should create in C# (not like in Java). Use MVC model and create all functionality to a separate class.

The application has following functions:

- when the application is started, the Team combobox is filled with fourteen teams in SM-Liiga ( you can find teams from www.sm-liiga.fi) , use enum list here and think what would be best place to store that data

- when the person type is selected the Texts in buttons are changed accordin the type

- Create Player: check that all fields has proper value and check that there is not all ready player with same name. Then create a Player object, add it the Players –array and add it to the Player listbox. The player is presented in listbox in format ”Lastname Firstname, Team” for example “Straka Joseph, Lukko”.

- listbox shows all time the all players, if any changes are made, the listbox is automatically refreshed.

- If a player’s name is clicked in the listbox then all information of the player is presented in textboxes for editing. Save player button is disabled as long as some changes in any textbox has been made.

- Save player: The application does not create a new player, it saves the information of the player and shows the saved information also in the list boxes if needed. - Delete Player: Delete the selected player from the listbox (and from the array). Button is disabled as long as no player is selected.

- Write Players to …: look the Extra task [this is voluntary, only for those are really interested learn to program with C#]

- End: Ends the application

- statuBar shows all action that the application makes

Additional task: Where would you store the data of the players? What are reasonable possibilities?
Create a function that asks from an end user where to save data, possibilities are: 1) an ASCII text file 2) a xml file 3) Windows registry 4) serialization 5) a database. Use a class myIO to handle that functionality.

Create methods for 1-4, number 5 database is no need to yet (you can do that later).

Add also button “Read Players from…” and create a proper functionality for that.

Picture 1: UI

Picture 2a Classes

Picture 2b Extra Task: saving players’ data to external data stores

The distance task 5: Hockey database

Goal: to get experience how to read/write data from/to database, specially SQL Server

Check this before you start: Data Walkthroughs

Task: We created a little application in the distance task 4, let's continue it.
You have to create a SQLServer based database application to handle HockeyPlayer data. Look the picture.

Make needed changes/addings to UI. Use the readymade HockeyPlayer-class in the application and  create needed BLHandler and DBHandler classes with attributes and operations. Create two tables to the database, create creating scripts and send them with you email. Create a dbuser named "koodari" (password "pwkoodari") to SQLServer, give him needed permission to tables. 
Put the connection string to the App.Config configuration file.
Add a ListBox-control to the form. Fill the control with team names. If an end-user select a team, player of the selected team are shown in the resultpane.
Add also The Search-button. If an end-user writes some chars to textboxes and push the button, all players how fill the search criteria are shown in the resultpane. If there are texts in many textboxes use boolean operator AND in search, also wildcard is always added automatically to the end of strings. Example: so if an end-user writes "Pel" to the lastname field and ">100000"; all players who lastname are starting with "Pel" and price is more than 100000€ are shown in the resultpane.

Test your application carefully. List all presented requirements and created functions and changes and present is the test made and was it succesful or not.

All justified adds and changes to the task are allowed, please just give explanation why changes were made.

The distance task 6: Databased WebApplication

Goal: to learn how to create database webapplication  with readymade databinded controls

Background: ASP.NET includes many databinded controls. In ASP.NET 2.0 there was introduced some changes and additions to those controls, look What is new in ASP.NET 2.0. Before the task look this: Binding to Databases.

Task: You task is create a Web-application WineCellary, where end users can search, browse wines. Browsing is allowed to everyone. Adding, editing and deleting wine data is allowed only for authorized users. Create a Web site for WineCellary. Create needed pages, functionality, etc. Design UI yourself, create nicelooking and user friendly outlook for pages. I hope that everyone of you will design and build as individual and artistic website as possible, show me what kind of webartist you are, try avoid "standard engineer look" :-)

Use so many different databinded ASP.NET control as possible. Use SQL Server or SQL Server Express, you can use this SQL scripts to generate the database and some test data to tables. In the db creating script could be wise to set/change the location of the db files before running it. Create needed users/logins to your database, use Web.Config to set the connection string to the database.

After you have done you website evaluate your work. Describe main design goals, describe also keypoints of implemantation, list controls that you used. Describe also what you have learned and how well you succeeded. Good luck!

Extra task For those who will get more challenges:

Add pictures (labels of wines) to the database. Make needed changes to UI, that the label of the wine is shown in webpages. There must be also possibility to add pictures to the database via webpages.

The distance task 7: Using Web Services

Goal: to get idea how to use Web Services in .NET

Background: Web Services and SOA will have (and they allready have) very big influence to business systems now and future. They are generally and widely used in different  enviroments, they are one solution how to connect different systems in heterogeneous environments. They are not used or creatd only .NET, you can use and create them with Java etc. Of course Web Services has one big role also in .NET Framework. Search and study some essential articles before you start to do you week tasks.
Task:
Create a simple Web Services and a test web application for it.
 
So plan and build a Web Services that offers data about NHL players. Get some data from top scorers in NHL in current season and put data to database. Use SQL Server as database. Generate scripts to create tables and data, return also scripts.
Create a Web Service which returns asked data. Create for example two different methods to call. Another one returns list of the names and goals of top scorers, in passing argument the calling procedure sends how many scorers it wants. In another one, calling procedure sends part of name = search criteria, and methods returns all players hows lastname has searched criteria. Create first a simple Windows application where to test this Web Services. And after that create for our end users a simple Web application that uses web services.
 

This is the last week task! Good luck and thanks for everyone.

Seminar subjects: ExPerienCe

Goal: to extend knowledge and knowhow where .NET can be used

Background: .NET covers huge area. You can build robust Windows and  Web software. It offers lot of readymade components, functionality and so on, it has many possibilities. Now it is you turn to explore possibilities of the .NET Framework.

Task:  You task is to innovate something new.
So plan and build a solution of your own with .NET. It can be whatever, it can be something about your hobbies, about your professional interest etc. It can be a mathematical software, it can be a game, it can use Direct X, it can be a study of WPF etc. The main point is that you try to do something new. You can test what are "limits" of the .NET Framework or you can research how something should be done in .NET. The choice is yours.

Before you begin use some time to research what can be done. Try to be as open-minded as possible. This is a good opportunity to learn something new. Remember that you are doing this for yourself...

First think a rough idea what you will do. List what are main goals.

Secondly analyze and write requirements, share them to two categories: must-have and nice-to-have.

Thirdly create a coarse archcitectural design for your solution, it can be quite general. Make also main design and implementation decisions.

Create your solution. Test it.

Finally evaluate how well you achieved goals and what you have learned.

Join all documentation with your return.

Why, what: .NET Framework

 

Back