Jade Bird Cinema frame and function point (i)

Source: Internet
Author: User

Functions of the Cinema ticketing system:

1. The cinema updates the show list every day, and the system supports real-time viewing, including show time and film profile.

2. Cinema provides three types of cinema tickets: general, gift, student (free tickets, student tickets have different degrees of discount)

3. Allow users to view the sale of a certain seat

4. Support ticket purchase and allow user to select the seat

5. The user can choose the session, the type of shadow ticket and the vacant seat to purchase tickets and print the movie tickets.

6. The system can save the sales situation and allow it to be restored.

Skill Points covered:

1. Ability to analyze system functions and extract objects and classes

2. Class diagrams are used to understand class relationships

3. Classes are built using properties and methods

4. Generic collections are used

5. Enumeration is used

6. Object-oriented thinking, TreeView, XML read, file stream, generic collection

7. Read the XML file: Iterate through the XML file, save the show list to the collection, and iterate through the collection to populate the Show list into the TreeView Control

8. File saving and recovery information will be used: Save the ticket information to the file, read the ticket information from the file to continue the ticket.

System Development Steps:

1. Identify requirements

2. Design class

3. Create a project

4. Determine the encoding sequence:

On: main form

: View new show list

: View the movie introduction

: View ticket Fares

view: Viewing Hall seating

: Buy tickets and print movie tickets

: Continue to purchase tickets

5. Testing

Design principles of Interface interaction

1. Aesthetics

2. Ease of Use

3. Friendliness

System class:

Class Diagram:

1.Seat: Save the seat information of the cinema, the main properties are as follows

Seat number (Seatnum): String type

Seat sell status Color (color): System.Drawing.Color type

2.Movie: Movie Class

Movie Name (moviename): String type

Poster picture Path (Poster): String type

Director name (Director): String type

Starring (actor): String type

Movie Type (movietype): Movietype Custom Enumeration type

Pricing (Price): int type

3.Ticket: Movie Ticket parent class, save movie ticket information

Screenings (ScheduleItem): ScheduleItem Custom class

Seat Object (Seat): Seat Custom Type

Fare (price): int type

Virtual method for calculating fares CalcPrice ()

Print the virtual method of ticket information print ()

Virtual method showing the currently sold ticket information show ()

4.StudentTicket: Student Ticket class, inheriting parent class ticket

Discount on Student Tickets (Discount): int type

Override parent class calculate fare CalcPrice

Rewrite the parent class print the ticket information for printing ()

Override the show () method in which the parent class displays the current ticketing information

5.FreeTicket: Gift Ticket class, Inherit parent class ticket

The name attribute (CustomerName) of the person who obtained the ticket: string type

Override parent class calculate fare calcprice ()

Overriding the parent class print ticket information print ()

overriding parent class showing current ticketing information show ()

6.ScheduleItem: Every day the theater plans to show the schedule, save the information of each movie

Show Time Properties (times): String type

Movies in this site movie properties: Movie Custom Type

7.Schedule: Projection Program class

Show session properties (ITEMS): Custom Generic collection dictionary<string,scheduleitem>

Read the LoadItems () method of an XML file to get a show plan collection

8.Cinema: Cinema class, Save projection plan and seating class

Seat set Properties (Seat): Custom Generic collection dictionary<string,seat>

Screening Schedule Schedule:schedule Custom types

Collection of sold movie tickets (soldticket): Custom Generic collection list<ticket>

Save () and load () methods for saving and reading ticket conditions

9.MovieType (enum type)

10.TicketUtil: Tool Class

Now the frame is ready.

Now focus on the code:

1. Finding ways to put data on the TreeView requires parsing the XML file

We parse the XML file in the Show time class:

As follows:

   Public voidLoadItems () {if(Items = =NULL) {Items=Newdictionary<string, scheduleitem>(); }            //Clearitems.clear (); XmlDocument Doc=NewXmlDocument (); Doc. Load ("Showlist.xml"); XmlNode Root=Doc.            DocumentElement; //Intermediate Variables            stringMoviename =NULL; stringPlaybill =NULL; stringDirector =NULL; stringActor =NULL; stringMovietype =NULL; stringPrice =NULL; foreach(XmlNode IteminchRoot. ChildNodes) {if(item. Name = ="Movie")                {                    foreach(XmlNode Childinchitem. ChildNodes) {Switch(child. Name) { Case "Name": Moviename=Child .                                InnerText;  Break;  Case "Poster": Playbill=Child .                                InnerText;  Break;  Case "Director": Director=Child .                                InnerText;  Break;  Case "Actor": Actor=Child .                                InnerText;  Break;  Case "Type": Movietype=Child .                                InnerText;  Break;  Case " Price": Price=Child .                                InnerText;  Break;  Case "Schedule":                                foreach(XmlNode SchedulenodeinchChild . ChildNodes) {ScheduleItem ScheduleItem=NewScheduleItem (); Scheduleitem.time=Schedulenode.innertext; ScheduleItem.Movie.MovieName=Moviename; ScheduleItem.Movie.Poster=Playbill; ScheduleItem.Movie.Actor=actor; ScheduleItem.Movie.Director=Director; ScheduleItem.Movie.MovieType= (Movietype) enum.parse (typeof(Movietype), movietype); ScheduleItem.Movie.Price=int.                                    Parse (price);                                Items.Add (Scheduleitem.time, ScheduleItem); }                                 Break; }                    }                }

2. Bind the data to the TreeView control:

The code is as follows:

        Public voidInittreeview () {//Summary://disables any tree view redraw. tvlist.            BeginUpdate (); Tvlist.            Nodes.clear (); //loading an XML file//string moviename = null;TreeNode Movienode =NULL; foreach(ScheduleItem IteminchCinema. Schedule.Items.Values) {if(Movienode = =NULL|| Movienode.text! =item. Movie.moviename) {Movienode=NewTreeNode (item.                    Movie.moviename); Tvlist.                Nodes.Add (Movienode); } MOVIENODE.NODES.ADD (item.            Time); }            //            //Summary://enables redrawing of the tree view. tvlist.        EndUpdate (); }

3. In the AfterSelect event, bind the data to the control on the right to display the information

   //    //View Movie Introduction        Private voidTvlist_afterselect (Objectsender, TreeViewEventArgs e) {            //switch back to the regular ticket and empty the information that may remain when you click TimeTxtgive.text =""; Cbostudentdivprice.text=""; //the GetKey () method is to get the time of the selected sessionGetKey (); //show the movie detailsLblmoviename.text =Cinema. Schedule.items[key].            Movie.moviename; Lbldirector.text=Cinema. Schedule.items[key].            Movie.director; Lblactor.text=Cinema. Schedule.items[key].            Movie.actor; Lblbaseprice.text=Cinema. Schedule.items[key].            Movie.Price.ToString (); Lblplaytime.text=Cinema. Schedule.items[key].            time; Lblmovietype.text=Cinema. Schedule.items[key].            Movie.MovieType.ToString (); Picmovie.image=Image.FromFile (Cinema. Schedule.items[key].            Movie.poster); Lblgoodprice.text="";

This completes the first step.

Jade Bird Cinema frame and function point (i)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.