Você está na página 1de 7

Algonquin College

DAT2335 C# - Programming Interfaces

Page 1 of 7

Group Project - 3 students in a group,


Due Date: The due date is Mar 21, 2012.

Project 1

Olympics Viewer

Problem Statement:
The Olympics Viewer is an interactive database-based project, implementing Layered Architecture and built on Object-Oriented programming principles, utilizing Inheritance and Polymorphism. The Olympics Viewer project implements the menu-based graphical-user interface for managing a multi-sport competition. In particular: The project is organized as the MDI Interface: The main form the mdi parent FormMain displays the menu and allows choosing the sport type and the particular sport event (top right, design mode). The picture (bottom right, design mode) FormRunners displays the mdi child form for the selected competition with the list of competing athletes in the DataGridView control (gray background)

The gui allows entry results for individual athletes into the Results (Times) column of the DataGridView as the competition progresses; the format and range of input data should be validated at entry time against business rules set by the Olympic committee.

______________________________________________________________________________________ Violet Batkin Winter 2012

Algonquin College

DAT2335 C# - Programming Interfaces

Page 2 of 7

Business rules and Judging System includes rules affecting the results of the competition and ranking such as Disqualify the athlete, Result Error, Not Finished the competition and such; Entering every individual result causes instant automatic re-ranking of competing athletes by results (times, scores); ranks are displayed in the DataGridView in Ranks column; Data can be updated in the database at any time.

Programming Tasks: - Use data of real sport events for Summer Olympics 2008

Use sport disciplines different from ones used in this project implement the MS Access database OlympicDatabase.mdb to store necessary data about athletes and results of competitions; use ADO.NET Connected or Disconnected models for accessing and updating data; put database file into bin/Debug directory:
string connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=| DataDirectory|/OlympicDatabase.mdb";

implement layered architecture with DataAccess, Business and Presentation(Forms) classes; provide methods to fetch and update data in the database in DataAccess class; there are two polymorphic structures in this project: interface ISportActivities;
class class and class class class FormRunners : Form, ISportActivities FormFencers : Form, ISportActivities Athlete AthleteRunners : Athlete AthleteFensers : Athlete

implement menu system to manage the project; implement MDI interface to present gui as it is described in Problem Statement provide methods of validating the format and the range of the input data: Time: hh.mm.sec Range: hh<4; mm,sec <= 60 Score: numeric, integer or double depending on the sport display data in the DataGridView control; use automated XML code comments follow the standards of the C# code implement AboutBox with the information about yourself or your company. Display XML comments file (use WebBrowser/Microsoft WebBrowser control) Archive your project as zip or rar. Make the title of the submission as Pr1_name1_name2_name3 For example, Pr1_JohnSmith_SaraJohns_AnnFarmer.zip.

Delivery:

IDE: VS2008, VS2010 Evaluation: 100% - if all regular tasks are completed. Challenge Tasks: Challenge tasks are considered only if all regular tasks are fulfilled properly. +5% - for implementing the column Problems in DataGridView

______________________________________________________________________________________ Violet Batkin Winter 2012

Algonquin College +5%

DAT2335 C# - Programming Interfaces

Page 3 of 7

- double clicking on the selected athlete name in the DataGridView displays the mdi-child form with the information about selected athlete.

Project Detailes
1. DataAccess Layer is responsible for reading/writing data in database tables:

Database: Access database, located in bin\Debug\data\Olympics.mdb Database structure (tables and schema of tables) is set by the student. Note: keep the source and result data of the athlete in the same table.

2. Business Layer Interface ISportActivities


void UpdateData(); void void void void View Selected Athlete(); PrepareAthletes(); InitializeDataGridView(); FillDataGridViewWithData();

class Athlete Properties: string AthleteId,string CountryCode, string Name, string Gender, string Time (or Score), string Problem. class AthleteRunners : Athlete, IComparable (use the name of the class as the sport you implement) Properties: string Distance,string Rank,string Time,string Eventid, string Problem Add properties appropriate for your projects sport disciplines more athlete sport classes . class FlagCountry implements flags icons Properties: string countryCode, string country, Icon icon

2. Presentation Layer content:

FormMain contains menu: see picture above


Sports: AthleticsSprint ->Men 100 m Help Men - 400 m About Women 100 m Women 400 m AthleticsMiddle Distance AthleticsLong Distance Fencing Exit Actions Windows Update Records Help

View Selected Athlete

Note: Windows menu item displays the list of open windows MDI children and regular ones.

______________________________________________________________________________________ Violet Batkin Winter 2012

Algonquin College

DAT2335 C# - Programming Interfaces

Page 4 of 7

MDI children forms: FormRunnerAthlete : Form, ISportActivities FormFencing: Form, ISportActivities MDI sport child form: Reads data from the database and prepares athlete objects assigns to every athlete random eventid the race number (starts with 1) builds and initializes DataGridView control, fills it with athletes in alphabetical order; displays the MDI child form for the selected athletes using Actions->View Selected Athlete and by double-clicking on the selected athlete (if bonus double-click is implemented); updates database by Actions->Update Records; allows to input the race results (time or score) for every athlete; validates the race format and range of result values against rules: the Time format is hh.mm.sec, range: 0<=hh,ss<=59, Score - only digits, integer or double values. DataGridView columns should be of types: DataGridViewImageColumn to hold icon (flag) DataGridViewTextBoxColumn to hold text/numeric value DataGridViewComboBoxColumn to hold ComboBox with possible problem values (if implemented) The last column Problems (if implemented) is a ComboBox with items: Not Finished, Data Error, Disqualified, "" empty string

when the mouse cursor hover over the "time" cell, ToolTipText is displayed as "hh.mm.ss" if the input result value is valid, the cell is disabled ( ReadOnly = true), and the results are immediately ranked. Note: if instant ranking is complicated to implement, it is suggested to rank all athletes after results for all athletes have been entered

If Problems column is implemented, the following rules for ranking are applied: The athlete with the problems Not Finished, Data Error or Disqualified is not ranked. After the problem is set to Not Finished or Disqualified, it becomes read-only. It is possible that the athlete gets Disqualified state after the race is finished. Then the problems column gets Read-only, rank is removed (even if it has been already set, and the athlete is not ranked any further.

MDI child form FormRunnerAthlete displays the information about the selected athlete

______________________________________________________________________________________ Violet Batkin Winter 2012

Algonquin College

DAT2335 C# - Programming Interfaces

Page 5 of 7

4.
5.

Create the form AboutBox to display information about your company: Sport Judging Systems

Athletics - Sprint :

- result is evaluated by the time with the accuracy of seconds; format: hh.mm.ss, range hh/ss <=59 - various distances and gender - wins the best time in the event - if bonus Problems is implemented: The columns Problem has to be created as ComboBox with items Disqualified, Result Error, Not Finished, empty string. If one of those states is assigned to the athlete, the following actions has to be performed: o the cell Results(or Times) gets disabled so that the value of this cell cannot be assigned or modified; o the cell Results(or Times) gets the red background; o the cell Ranks get cleared; o this athlete should not participate in further ranking of the results.

Note: Check judging System for the sport you implement, Add the Judging Rules to the class that models the athlete as part of the class description

Help Project structure The following code contains only principal methods and class instances. It is not required to follow this design exactly; however all important features of the project (layers, polymorphism, database, DataGridView control) has to be implemented.
interface ISportActivities { void UpdateData(); void ViewSelectedAthlete(Athlete a); void PrepareAthletes(); void InitializeDataGridView(); void FillDataGridViewWithData(); } public class Athlete { //Auto-implemented props String AthleteId String CountryCode String Name //First Last String Gender String Image AthleteImage public Athlete() { } public Athlete() {} public override string ToString(){} } } public class AthleteRunner : Athlete, IComparable { //Auto-implemented propps String Eventid //id in event (competition/race) String Distance //distance for the particular event String Time //time resultfor the particular event String Rank //rank for the particular event String Problem public AthleteRunner() { } public AthleteRunner() : base(){} public override string ToString(){} public int CompareTo(object obj) {}

______________________________________________________________________________________ Violet Batkin Winter 2012

Algonquin College

DAT2335 C# - Programming Interfaces

Page 6 of 7

class DataAccess { private OleDbConnection connection; private string connStr ="Provider=Microsoft.Jet.OLEDB.4.0; Data Source=| DataDirectory|/OlympicDatabase.mdb"; private DataSet olympicsDataSet = new DataSet(); public DataAccess(){} public OleDbConnection MakeConnection(){} public ArrayList ReadAthletes_Athletics() {} public FlagCountry[] ReadFlagCountryData(){} public void UpdateData_Athletics(){} } public partial class FormMain : Form { public static String[] COUNTRIES = {}; ISportActivities[] forms = new ISportActivities[100]; int formsCounter = 0; public FormMain(){} private void FormMain_Load(object sender, EventArgs e){} private void updateRecordsToolStripMenuItem_Click (object sender, EventArgs e){} private void viewSelectedAthleteToolStripMenuItem_Click (object sender, EventArgs e){} private void geeseToolStripMenuItem1_Click (object sender, EventArgs e){} #region private void men100mToolStripMenuItem_Click (object sender, EventArgs e){} private void men400mToolStripMenuItem_Click (object sender, EventArgs e){} //similar event-handlers ToolStripMenuItems #endregion private void aboutToolStripMenuItem_Click (object sender, EventArgs e){} private void projectHelpToolStripMenuItem_Click (object sender, EventArgs e){} } public partial class FormRunnerAthlete : Form { public FormRunnerAthlete(Athlete a){} private void FormRunnerAthlete_Load

public class FlagCountry { //Auto-implemented props CountryCode; Country; Icon Icon; public FlagCountry() { } public FlagCountry(Icon icon, string countryCode, string country){} }

public partial class FormRunners : Form, ISportActivities { FlagCountry[] fc; ArrayList raceAthletes; DataAccess da = new DataAccess(); public FormRunners() {} private void FormRunners_Load (object sender, EventArgs e){} public void PrepareAthletes() {} public void FillDataGridViewWithData(){} public void InitializeDataGridView(){} public virtual void UpdateData(){} public void ViewSelectedAthlete(Athlete a){} private void dataGridView1_CellContentClick (object sender, DataGridViewCellEventArgs e){} private void dataGridView1_CellContentDoubleClick (object sender, DataGridViewCellEventArgs e){} #region private void dataGridView1_CellValueChanged (object sender, DataGridViewCellEventArgs e){} #endregion }

______________________________________________________________________________________ Violet Batkin Winter 2012

Algonquin College

DAT2335 C# - Programming Interfaces


(object sender,

Page 7 of 7

EventArgs e){} }

______________________________________________________________________________________ Violet Batkin Winter 2012

Você também pode gostar