Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            // Makes a variable object fleet that holds database information
            MySqlDb fleet = new MySqlDb("cs1", "cs371student", "whitworth", "cs371ado");

            fleet.OpenConnection();
            // FullyRolly is a variabe representing a list of type Full Roster
            List <FullRoster> FullyRolly = fleet.FullRosters();

            fleet.OpenConnection();
            // Pilot Qualifier holds the list of crew who can pilot
            List <FullRoster> PilotQualifier = fleet.PilotRosters();

            // displays the roster
            Console.WriteLine("Full Roster:\n");
            foreach (FullRoster s in FullyRolly)
            {
                Console.WriteLine("First Name: {0} Last Name: {1} \nAge: {2} Role: {3} \nShip Name: {4} Ship Registration: {5}", s.Fname, s.Lname, s.Age, s.role, s.shipName, s.shipRegs);
                Console.WriteLine("\n");
            }

            // Displayes who can be a pilot
            Console.WriteLine("Pilot Qualified:\n");
            foreach (FullRoster s in PilotQualifier)
            {
                Console.WriteLine("First Name: {0} Last Name: {1} \nAge: {2} Role: {3} \nShip Name: {4} Ship Registration: {5}", s.Fname, s.Lname, s.Age, s.role, s.shipName, s.shipRegs);
                Console.WriteLine("\n");
            }
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            // Initialize the connection with Database
            MySqlDb chatdb = new MySqlDb("sql3.freesqldatabase.com", "sql3319340", "bFxgnIiN4x", "sql3319340");

            chatdb.OpenConnection();

            chatdb.displayAllMessages();

            chatdb.OpenConnection();
            chatdb.EnterMessage("Jerry", "Caird", "Hows it go?");

            chatdb.displayAllMessages();
        }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            MySqlDb fleet = new MySqlDb("db4free.net", "cs371student", "whitworth", "cs371ado");

            fleet.OpenConnection();
            List <Ship> ships = fleet.GetAllShips();

            foreach (Ship s in ships)
            {
                Console.WriteLine("{0} has registration number {1}", s.Name, s.Registration);
            }
        }