Jump to content

c# booking system

vorticalbox
Go to solution Solved by Nuluvius,

I'd suggest you use LINQ to XML; take a look at System.Xml.Linq Namespace, specifically XDocument and XElement. It's easy, declarative and you can have explicit control over your own serialization.

So for college i have go to create a squash booking system that takes a time and a name then adds it as booked. problem is i need to also make it so you can book it on different days (mon to fri) and this is where I am stuck. I've thought about crating another directory to include the one i already have (holds time and name) but i've never done this sort of thing before in c#. any tips on where to go from here would be great.

 

 

main program

using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace booking{    class Program    {        static void Main(string[] args)        {            //create courts            courtCollection bookings = new courtCollection();                        //start menu            int ch=0;            do            {                //display menu                Console.Clear();                Console.WriteLine("***Booking System***");                Console.WriteLine("Menu:");                Console.WriteLine("1. Display slots");                Console.WriteLine("2. Add booking");                Console.WriteLine();                Console.WriteLine("Enter choice :");                //get user input                string line = Console.ReadLine();                int value;                //test if input is an int                if (int.TryParse(line, out value))                {                                       switch(value)                    {                        case 1:                            //display bookings                            bookings.display();                            break;                        case 2:                            //add new booking                            bookings.add();                            break;                    }                }                else                {                    //display error                    Console.WriteLine("Invalid Input");                }                            } while (ch != 7);            Console.ReadKey();        }    }}

court class

 

Sorry posted wrong code, pc is in bits atm :( will post when i can

later i need to expand to allow clients to register and book, I know i'll need to make a class for this is there a way to make the class an array so i can hold data in them? I tried before but it only stored the last value I put in for all the clients.

                     ¸„»°'´¸„»°'´ Vorticalbox `'°«„¸`'°«„¸
`'°«„¸¸„»°'´¸„»°'´`'°«„¸Scientia Potentia est  ¸„»°'´`'°«„¸`'°«„¸¸„»°'´

Link to comment
Share on other sites

Link to post
Share on other sites

Database that shit, yo. Good chance to learn relational databases!

--Neil Hanlon

Operations Engineer

Link to comment
Share on other sites

Link to post
Share on other sites

database it

 

 

Database that shit, yo. Good chance to learn relational databases!

 

Not needed for my assessment but how would i go about doing this?  

                     ¸„»°'´¸„»°'´ Vorticalbox `'°«„¸`'°«„¸
`'°«„¸¸„»°'´¸„»°'´`'°«„¸Scientia Potentia est  ¸„»°'´`'°«„¸`'°«„¸¸„»°'´

Link to comment
Share on other sites

Link to post
Share on other sites

Not needed for my assessment but how would i go about doing this?  

either use a sql server, mysql server, postgresql server, or my personal favorite a sqlite database. you would define some tables (these are essentially your program objects) and then store them there. makes syncing multiple instances of the client very easy as they just need access to the database.

Link to comment
Share on other sites

Link to post
Share on other sites

Not needed for my assessment but how would i go about doing this?  

 

You can always just use simple text files if you want.

Link to comment
Share on other sites

Link to post
Share on other sites

You can always just use simple text files if you want.

would be good any links to tuts? been googling but haven't found anything that great.

                     ¸„»°'´¸„»°'´ Vorticalbox `'°«„¸`'°«„¸
`'°«„¸¸„»°'´¸„»°'´`'°«„¸Scientia Potentia est  ¸„»°'´`'°«„¸`'°«„¸¸„»°'´

Link to comment
Share on other sites

Link to post
Share on other sites

I'd suggest you use LINQ to XML; take a look at System.Xml.Linq Namespace, specifically XDocument and XElement. It's easy, declarative and you can have explicit control over your own serialization.

The single biggest problem in communication is the illusion that it has taken place.

Link to comment
Share on other sites

Link to post
Share on other sites

you can use streamreader and streamwriter to read and write to a text file, no xml knowledge is needed

#killedmywife #howtomakebombs #vgamasterrace

Link to comment
Share on other sites

Link to post
Share on other sites

I'd suggest you use LINQ to XML; take a look at System.Xml.Linq Namespace, specifically XDocument and XElement. It's easy, declarative and you can have explicit control over your own serialization.

Thanks that looks like what i'm after thanks

                     ¸„»°'´¸„»°'´ Vorticalbox `'°«„¸`'°«„¸
`'°«„¸¸„»°'´¸„»°'´`'°«„¸Scientia Potentia est  ¸„»°'´`'°«„¸`'°«„¸¸„»°'´

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×