Project Overview

A local town council has asked you to write an application that allows its residents to view community events for the current month. This application will run on computers in council offices, libraries and other public places.

The first module will allow the user to enter and store events in a file; this will be known as the

Write Events Project.

The second module will allow the user view events that have been entered using the first module and will be known as the Ticket Information Module.

Both projects are to be created as .Net Windows Forms projects. These .Net Projects are to be coded in C#. The application is to be completed as 5 separate, but related assignments.

Assignment 1 Create the .Net Projects and Windows Forms

Assignment 1 Part 1 Create the Windows Forms Projects

  • Create a Windows form .Net Application named WriteEvents.
  • Name the Windows Form in this application WriteEventForm
  • Change the title text to Write Event
  • Create a Windows form .Net Application named TicketInformation.
  • Name the Windows Form in this application TicketInformationForm
  • Change the title text to Ticket Information

Assignment 1 Part 2 Create the Graphical User Interface for the Write Event Application.

The Write Event application should contain the single form GUI shown below. see image.

    • The day is selected with a numeric upDown control that should be named DayUpDown.
    • The time should be selected by DateTimePicker named DateTimePicker.
    • The Price is to be entered into a text box named priceTextBox
    • The event name is to be entered into a text box named eventTextBox.
    • The labels beside each of the above controls should be added and named appropriately.
    • The form should also contain 3 command buttons as shown below: The names of the three command buttons shown are listed below
      • openFileButton
      • enterButton
      • closeFileButton
    • These buttons should be captioned as shown in the above diagram.
    • This form will also need an openFilDialog control, this can be added now or at a later stage.

    Assignment 1 Part 3 Create the Graphical User Interface for the Ticket Information Project see image.

      • The two screens shot images for the Ticket Information Project above show the program executing.
      • The image on the left shows the program with No Events for the selected date. The image on the right shows an event for the selected date.
      • The main controls that you need to add to this form are
        • A MonthCalendar control named dateMonthCalendar.
        • A ComboBox named eventComboBox
        • A TextBox named descriptionTextBox
        • Also the labels are shown, these should be appropriately named.

      Assignment 2 Code the WriteEvent Form

      Assignment 2 Part 1 - Add the OpenFileDialog Control

      • If you have not already done so, add an OpenFileDialog component from the All Windows Forms category of the Toolbox.
      • Name it openFileDialog, and change its FileName property to calendar.txt.
      • Set property CheckFileExists to False so that if the user specifies a nonexistent file, that file is created.

      Assignment 2 Part 2 - Create the CheckValidity method

      • Create function CheckValidity which returns true if a file name is valid. This receives a file name as a String. Use String method EndsWith if the value of file name does not end with .txt. In this case, a MessageBox is displayed, informing the user that the application expects a text file.
      • If the file name is valid the enable the Enter and Close File Buttons and disable the Open Button.

      Assignment 2 Part 3 Code the Sub procedure openFileButton_Click

      • Code Method openFileButton_Click which handles the Open File... button's Click event. This method should:
        • display an Open dialog
        • open the selected file if user did not click Cancel Button
        • validate file name using method CheckValidity
      • If the filename is valid open the file and enable the user to append data to the file via Class StreamWriter from namespace System.IO which must be imported.

      Assignment 2 Part 4 Create Subprocedure ClearUserInput

      • Create Sub ClearUserInput to clear TextBoxes and reset the NumericUpDown control value to 1.

      Assignment 2 Part 5 Code subprocedure enterButton_Click

      • Code subprocedure enterButton_Click which handles the Enter Button's Click event. This will save the information into the file by using StreamWriter to write data to file. This can be done by using the Write and Writeline methods of the StreamWriter. This should save each event as a single line in comma separated or tab separated text file.
      • After saving the data this method should call method ClearUserInput to prepare the form for more user input.

      Assignment 2 Part 6 Code subprocedure closeFileButton_Click

      • Code subprocedure closeFileButton_Click which handles Close File Button's Click event. This should close the StreamWriter and enable the openFile button and disable both the Enter and Close Buttons.

      Assignment 2 Part 7 Test the program

      • Test the program and ensure that it works reliably and that the data is correctly saved.

      Assignment 3 Create Class CommunityEvent

      Assignment 3 Part 1 Declare Public Class CommunityEvent

      • Create class declaration communityEvent in the TicketInformation project.
      • Class communityEvent will be used to store data that is retrieved from file calendar.txt which is created and populated by the WriteEvents project. This class will contain the following private instance variables:
      Variable Name Variable Type Description
      dayValue Integer day of the event
      timeValue String time of the event
      priceValue Decimal price of the event
      eventNameValue String name of the event
      descriptionValue String description of event
      • As these variables are private they cannot be directly accessed from outside the class. To enable clients read or write to these variables provide Properties which will enable the variables to be read and modified. The names of these properties are to be:
        • Day
        • Time
        • Price
        • Name
        • Description
      • Each of these variables should be readable and writeable and the properties should validate the data to ensure that only valid data can be assigned to the variables.

      Assignment 4 Code TicketInformationForm Class

      Assignment 4 Part 1 Declare Public Class TicketInformationForm and Sub CreateEventList

      • Declare the Subprocedure CreateEventList which populates EventsComboBox with current day's events (if any). This method stores the events in generic List communityEvents which is collection of communityEvent objects. This List should be created and assigned to the instance variable communityEvents.
      • This method should call helper method ExtractData which will use LINQ to extract the data from the file calendar.txt.
      • The method should inform the user that events are scheduled by displaying " - Events - " in the comboBox
      • "Pick an event." In the description text box.
      • If there are no event the comboBox should display: " - No Events - "
      • and the description text box should display: "No events today."

      Assignment 4 Part 2 Create Method ExtractData

      • Create method ExtractData which extracts event data for a specified day from the file calendar.txt using a LINQ query. The specified day is the date selected on the calendar control. This method will be called from method CreateEventList.
      • This method should clear all data from List communityEvents.
      • A LINQ query that creates CommunityEvent objects should select the events scheduled for selected day from the file. The selected events should be added to List communityEvents.

      PART 3 Create Sub dateMonthCalendar_DateChanged which

      • Code Sub dateMonthCalendar_DateChanged which handles MonthCalendar's DateChanged event.
      • When this method is called the program should display any events for the specified date in ComboBox by calling method CreateEventList created in Part 1.

      Part 4 Create sub eventComboBox_SelectedIndexChanged

      • Code eventComboBox_SelectedIndexChanged which handles ComboBox's SelectedIndexChanged event. This method will get the event selected in the ComboBox and display time, price and description of event in the Description TextBox.

      Part 5 Code the Form Load Event

      • Sub TicketInformationForm_Load handles Form's Load event you should code it so that the dateMonthCalendar shows todays date and also call method CreateEventList so as to display events scheduled for today.

      Assignment 5 Comments and Exception Handling

      Assignment 5 Part 1 Add Comments

      • Add sufficient comment to your code to ensure that the purpose of all methods is clear and to state any preconditions that should exist before the method is run and post conditions that will exist after the method is run.
      • Remove any obsolete or unused code; do not just disable it using comments.

      Assignment Part 2 Exception Handling

      • In both projects handle the following errors:
        • More than one program attempts to access the file Calendar.txt
        • Calendar.txt does not exist
        • Incorrect types of data are in the file when read.
      Academic Honesty!
      It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
      Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.