Chapter 1 - Challenge #3 - Training Workshops
Your company likes to present training workshops that help people in the information technology industry improve their skills. Your task is to write and object-oriented application that will let the company display and edit workshops.
There are several workshop categories: (1) application development, (2) databases, (3) networking, and (4) systems administration. You will create an enumerated type that matches these categories. A workshop consists of: (1) title, (2) length in days, (3) category, and (4) cost. Create a Class named Workshop that holds this information, with a complete set of properties and ToString method. It should also contain a public shared string array such as the following:
Public Shared CategoryNames ( ) As String = {"Application development" , "Databases" ,
"Networking" , "System Administration" }
Data File
When the application starts, it must read a list of workshops from a data file and store them in an array or collection. Each line in the file will be a different workshop, with the fields separated by the \ or , (backslash or comma) character. Here is a sample line from the file:
0\3\800\Programming in Java or 0,3,800,Programming in Java
(Category = 0, Days = 3, Cost = $800, Title = Programming in Java)
Create a user interface that lets the user complete the following tasks:
1. Display all workshops in a list in the startup form, as shown in Figure 1-21.
2. Select a single workshop to display in detail format in a separate window, as shown in
Figure 1-22. A combo box control should display a list of categories, with the workshop's actual category as the current selection. This window permits the user to modify the workshop fields and save all changes. If the user modifies a workshop, clicks the Save and Close button, and returns to the startup form, the workshop changes should appear in the list box.
** None of the changes are permanent because you are not required to save the modified workshop list back to the data file.
Implementation Suggestions
You can create a property of type Workshop in the Workshop Detailsform. Before displaying this form, assign the selected workshop (from the list box) to the Workshop Details form's Text property. When the form loads, copy the workshop property values into the text boxes and combo box.
Chapter 5 - Challenge #5 - Training Workshops
Use the Programming Challenge 3 from Chapter 1 as a starting point for this challenge.
This version is a 3-tier application.
1. Add an ID property to the Workshop class.
2. Create a database to replace the data file that was used for input in Chapter 1. In it, create a database table named Workshops that contains the workshop ID, category ID, number of days, cost of the workshop, and workshop title. Also in the database, create a Categories table that contains category ID and category description columns.
3. Create a DataSet containing table adapters based on the two database tables. In addition, create a TableAdapter That joins the two tables and contains the workshop ID, workshop category name, number of days, cost, and workshop description.
4. The Workshop class represents the middle tier. In this class, declare an instance of the TableAdaper class so you can call the TableAdapter method. Provide properties and methods in the Workshop class that are called by your MainForm and DetailsForm classes
5. Display the list of workshops in a DataGridView control, as shown in Figure 5-32. When the user selects a workshop in the grid, display the Workshop Details form, as shown in Figure 5-33. The combo box is filled from the Categories TableAdapter. The user must be able to modify a workshop in this window and save his or her changes. When the details form closes, the grid must be refreshed, so the user can see the changes he or she made. Additionally, the changes must be saved back to the database as well.