public IList <RollerCoaster> GetCoasters() { IList <RollerCoaster> rollerCoasters = new List <RollerCoaster>(); try { using (SqlConnection conn = new SqlConnection(connectionString)) { conn.Open(); string sqlStatement = "SELECT * FROM cedar_point_coasters"; SqlCommand cmd = new SqlCommand(sqlStatement, conn); SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { RollerCoaster rollerCoaster = ConvertReaderToRollerCoaster(reader); rollerCoasters.Add(rollerCoaster); } } } catch (SqlException ex) { throw; } return(rollerCoasters); }
static void AfficherAttraction(List <Attraction> maListe) { Console.WriteLine("Voici la liste des attractions :\n"); foreach (Attraction i in maListe) { if (i is Spectacle) { Spectacle S = i as Spectacle; Console.WriteLine(S); } if (i is Boutique) { Boutique B = i as Boutique; Console.WriteLine(B); } if (i is DarkRide) { DarkRide D = i as DarkRide; Console.WriteLine(D); } if (i is RollerCoaster) { RollerCoaster R = i as RollerCoaster; Console.WriteLine(R); } } }
public void placeTrain(int pos, Vector3 point) { mainObjectSetup(pos, point); GameObject _train = Data.objects[Data.objects.Count - 1]; _train.tag = "train"; RollerCoaster trainObj = _train.AddComponent <RollerCoaster>(); Data.rollerCoasters.Add(trainObj); }
private RollerCoaster ConvertReaderToRollerCoaster(SqlDataReader reader) { RollerCoaster rollerCoaster = new RollerCoaster(); rollerCoaster.Id = Convert.ToInt32(reader["id"]); rollerCoaster.Name = Convert.ToString(reader["name"]); rollerCoaster.BuildYear = Convert.ToInt32(reader["build_year"]); rollerCoaster.Speed = Convert.ToInt32(reader["speed"]); rollerCoaster.Duration = Convert.ToInt32(reader["duration"]); rollerCoaster.MinHeight = Convert.ToInt32(reader["min_height"]); rollerCoaster.RideVideo = Convert.ToString(reader["ride_video"]); rollerCoaster.RideImage = Convert.ToString(reader["ride_image"]); rollerCoaster.Description = Convert.ToString(reader["description"]); rollerCoaster.Height = Convert.ToInt32(reader["height"]); return(rollerCoaster); }
void loadTrain(int index) { GameObject obj = Data.objects[index]; TrackBuilder tb; MainObject mo = obj.GetComponent <MainObject>(); RollerCoaster rc = obj.GetComponent <RollerCoaster>(); if (rc.tb != null) { rc.tb.reset(); tb = rc.tb; } tb = new TrackBuilder(obj); tb.setModel(mo.model); tb.setType(0); tb.generate(mo.script); rc.tb = tb; //obj.AddComponent<AnimationTrigger>(); }
static List <Attraction> LectureAttraction(StreamReader monStreamReader) { List <Attraction> liste_attraction = new List <Attraction>(); string ligne = null; for (int i = 0; i < 18; i++) { ligne = monStreamReader.ReadLine(); } while (ligne != null) { string[] temp = ligne.Split(';'); int identifiant = int.Parse(temp[1]); int nbMinimMonstre = int.Parse(temp[3]); bool besoinSpecifique = bool.Parse(temp[4]); switch (temp[0]) { case "Boutique": typeBoutique monType = typeBoutique.none; try { monType = (typeBoutique)Enum.Parse(typeof(typeBoutique), temp[6]); } catch (InvalidCastException e) { Console.WriteLine(e.Message); } Boutique maBoutique = new Boutique(identifiant, temp[2], nbMinimMonstre, besoinSpecifique, temp[5], monType); liste_attraction.Add(maBoutique); break; case "DarkRide": TimeSpan T = new TimeSpan(0, 0, 0); try { int heure = int.Parse(temp[6]); T = new TimeSpan(heure, 0, 0); } catch (Exception e) { Console.Write(e.Message); } bool vehicule = false; try { vehicule = bool.Parse(temp[7]); } catch (InvalidCastException e) { Console.WriteLine(e.Message); } DarkRide monDarkRide = new DarkRide(identifiant, temp[2], nbMinimMonstre, besoinSpecifique, temp[5], T, vehicule); liste_attraction.Add(monDarkRide); break; case "RollerCoaster": int ageMinim = int.Parse(temp[7]); float tailleMinim = float.Parse(temp[8]); TypeCategorie MyType; MyType = (TypeCategorie)Enum.Parse(typeof(TypeCategorie), temp[6]); RollerCoaster monRollerCoaster = new RollerCoaster(identifiant, temp[2], nbMinimMonstre, besoinSpecifique, temp[5], MyType, ageMinim, tailleMinim); liste_attraction.Add(monRollerCoaster); break; case "Spectacles": List <DateTime> liste_horaire = new List <DateTime>(); int nbPlace = int.Parse(temp[7]); string[] temp2 = temp[8].Split(' '); for (int i = 0; i < temp2.Length; i++) { DateTime m = Convert.ToDateTime(temp2[i]); liste_horaire.Add(m); } Spectacle monSpectacle = new Spectacle(identifiant, temp[2], nbMinimMonstre, besoinSpecifique, temp[5], temp[6], nbPlace, liste_horaire); liste_attraction.Add(monSpectacle); break; } ligne = monStreamReader.ReadLine(); } monStreamReader.Close(); return(liste_attraction); }
private void EnvoiClick(object sender, RoutedEventArgs e) { bool flagID = true; for (int i = 0; i < Administration.listeAttractions.Count; i++) { if (id.Text == Convert.ToString(Administration.listeAttractions[i].Identifiant)) { flagID = false; } } if (flagID) { if (id.Text != null && nom.Text != null) { if (ouvertOUI.IsChecked == true ^ ouvertNON.IsChecked == true) { if (exactitude.IsChecked == true) { if (maintenanceOUI.IsChecked == true ^ maintenanceNON.IsChecked == true) { if (maintenanceOUI.IsChecked == true) { if (dureeMaintenance.Text != null && natureMaintenance.Text != null) { try { string stringBesoinSpecifique; if (besoinSpeOUI.IsChecked == true) { stringBesoinSpecifique = "1"; } else { stringBesoinSpecifique = "0"; } string stringDureeMaintenance = dureeMaintenance.Text; string stringID = id.Text; //string stringMaintenance; string stringNatureMaintenance = natureMaintenance.Text; string stringNbMinMonstre = Convert.ToString(nbSlider.Value); string stringNom = nom.Text; string stringOuvert; if (ouvertOUI.IsChecked == true) { stringOuvert = "1"; } else { stringOuvert = "0"; } string stringTypeDeBesoin = typeBesoin.Text; string connectionString = "SERVER=35.195.241.250; PORT=3306; DATABASE=zombillenium; UID=root; PASSWORD=abcd1234;"; MySqlConnection connection = new MySqlConnection(connectionString); connection.Open(); MySqlCommand command = connection.CreateCommand(); command.CommandText = "INSERT INTO zombillenium.attraction (besoinSpecifique, dureeMaintenance, ID, maintenance, natureMaintenance, nbMinMonstre, nom, ouvert, typeDeBesoin) VALUES ('" + stringBesoinSpecifique + "','" + stringDureeMaintenance + "','" + stringID + "','" + "0" + "','" + stringNatureMaintenance + "','" + stringNbMinMonstre + "','" + stringNom + "','" + stringOuvert + "','" + stringTypeDeBesoin + "');"; MySqlDataReader reader; reader = command.ExecuteReader(); bool boolBesoinSpecifique; if (besoinSpeOUI.IsChecked == true) { boolBesoinSpecifique = true; } else { boolBesoinSpecifique = false; } bool boolOuvert; if (ouvertOUI.IsChecked == true) { boolOuvert = true; } else { boolOuvert = false; } TimeSpan dureeMaint = TimeSpan.FromHours(Convert.ToInt32(dureeMaintenance.Text)); List <Monstre> temp = new List <Monstre>(); int idClass = Convert.ToInt32(id.Text); int minMonstreClass = Convert.ToInt32(stringNbMinMonstre); List <Attraction> list1 = new List <Attraction>(); TimeSpan dureeClass = TimeSpan.FromMinutes(Convert.ToInt32(duree.Text)); bool vehicule; if (vehiculeOUI.IsChecked == true) { vehicule = true; } else { vehicule = false; } TypeBoutique typebouti = (TypeBoutique)typeBout.SelectedItem; int ageMini = Convert.ToInt32(ageMin.Text); TypeCategorie typeCat = (TypeCategorie)catRoll.SelectedItem; float tailleMini = float.Parse(tailleMin.Text); List <DateTime> horaires = new List <DateTime>(); int places = Convert.ToInt32(nbPlaces.Text); if (typeAttraction.Text == "DarkRide") { DarkRide attract1 = new DarkRide(dureeClass, vehicule, boolBesoinSpecifique, dureeMaint, temp, idClass, true, stringNatureMaintenance, minMonstreClass, stringNom, boolOuvert, stringTypeDeBesoin); list1.Add(attract1); Console.WriteLine(attract1); } else if (typeAttraction.Text == "Boutique") { Boutique attract1 = new Boutique(typebouti, boolBesoinSpecifique, dureeMaint, temp, idClass, true, stringNatureMaintenance, minMonstreClass, stringNom, boolOuvert, stringTypeDeBesoin); list1.Add(attract1); } else if (typeAttraction.Text == "RollerCoaster") { RollerCoaster attract1 = new RollerCoaster(ageMini, typeCat, tailleMini, boolBesoinSpecifique, temp, idClass, minMonstreClass, stringNom, boolOuvert, stringTypeDeBesoin); list1.Add(attract1); } else { Spectacle attract1 = new Spectacle(horaires, places, nomSalle.Text, boolBesoinSpecifique, dureeMaint, temp, idClass, true, stringNatureMaintenance, minMonstreClass, stringNom, boolOuvert, stringTypeDeBesoin); list1.Add(attract1); } //Attraction attract1 = new Attraction(boolBesoinSpecifique, dureeMaint, temp, idClass, true, // stringNatureMaintenance, minMonstreClass, stringNom, boolOuvert, stringTypeDeBesoin); Administration.listeAttractions.Add(list1[0]); //Administration.listeAttractions.ForEach(Console.WriteLine); if (reader.Read()) { affichage.Text = reader.GetString(0); } else { affichage.Text = "Attraction ajoutée"; } connection.Close(); } catch { MessageBoxResult result = MessageBox.Show("Type de valeur d'entrée incorrect: vérifier le matricule (entier) et le sexe (M, F ou A)", "Erreur", MessageBoxButton.OK, MessageBoxImage.Error); //label1.Content = "Type de valeur d'entrée incorrect: vérifier le matricule (entier) et le sexe (M, F ou A)"; } } else { affichage.Text = "Informations manquantes. Merci de remplir la durée de maintenance et sa nature."; } } else { try { string stringBesoinSpecifique; if (besoinSpeOUI.IsChecked == true) { stringBesoinSpecifique = "1"; } else { stringBesoinSpecifique = "0"; } //string stringDureeMaintenance = dureeMaintenance.Text; string stringID = id.Text; //string stringMaintenance; //string stringNatureMaintenance = natureMaintenance.Text; string stringNbMinMonstre = Convert.ToString(nbSlider.Value); string stringNom = nom.Text; string stringOuvert; if (ouvertOUI.IsChecked == true) { stringOuvert = "1"; } else { stringOuvert = "0"; } string stringTypeDeBesoin = typeBesoin.Text; try { string connectionString = "SERVER=35.195.241.250; PORT=3306; DATABASE=zombillenium; UID=root; PASSWORD=abcd1234;"; MySqlConnection connection = new MySqlConnection(connectionString); connection.Open(); MySqlCommand command = connection.CreateCommand(); command.CommandText = "INSERT INTO zombillenium.attraction (besoinSpecifique, ID, maintenance, nbMinMonstre, nom, ouvert, typeDeBesoin) VALUES ('" + stringBesoinSpecifique + "','" + stringID + "','" + "0" + "','" + stringNbMinMonstre + "','" + stringNom + "','" + stringOuvert + "','" + stringTypeDeBesoin + "');"; MySqlDataReader reader; reader = command.ExecuteReader(); if (reader.Read()) { affichage.Text = reader.GetString(0); } else { affichage.Text = "Attraction ajoutée"; } connection.Close(); } catch { affichage.Text = "Attraction non ajoutée à la base de données."; } bool boolBesoinSpecifique; if (besoinSpeOUI.IsChecked == true) { boolBesoinSpecifique = true; } else { boolBesoinSpecifique = false; } bool boolOuvert; if (ouvertOUI.IsChecked == true) { boolOuvert = true; } else { boolOuvert = false; } //TimeSpan dureeMaint = TimeSpan.FromHours(Convert.ToInt32(dureeMaintenance.Text)); List <Monstre> temp = new List <Monstre>(); int idClass = Convert.ToInt32(id.Text); int minMonstreClass = Convert.ToInt32(stringNbMinMonstre); List <Attraction> list1 = new List <Attraction>(); TimeSpan dureeClass = TimeSpan.FromMinutes(Convert.ToInt32(duree.Text)); bool vehicule; if (vehiculeOUI.IsChecked == true) { vehicule = true; } else { vehicule = false; } TypeBoutique typebouti = (TypeBoutique)typeBout.SelectedItem; int ageMini = Convert.ToInt32(ageMin.Text); TypeCategorie typeCat = (TypeCategorie)catRoll.SelectedItem; float tailleMini = float.Parse(tailleMin.Text); List <DateTime> horaires = new List <DateTime>(); int places = Convert.ToInt32(nbPlaces.Text); if (typeAttraction.Text == "DarkRide") { DarkRide attract1 = new DarkRide(dureeClass, vehicule, boolBesoinSpecifique, temp, idClass, minMonstreClass, stringNom, boolOuvert, stringTypeDeBesoin); list1.Add(attract1); Console.WriteLine(attract1); } else if (typeAttraction.Text == "Boutique") { Boutique attract1 = new Boutique(typebouti, boolBesoinSpecifique, temp, idClass, minMonstreClass, stringNom, boolOuvert, stringTypeDeBesoin); list1.Add(attract1); } else if (typeAttraction.Text == "RollerCoaster") { RollerCoaster attract1 = new RollerCoaster(ageMini, typeCat, tailleMini, boolBesoinSpecifique, temp, idClass, minMonstreClass, stringNom, boolOuvert, stringTypeDeBesoin); list1.Add(attract1); } else { Spectacle attract1 = new Spectacle(horaires, places, nomSalle.Text, boolBesoinSpecifique, temp, idClass, minMonstreClass, stringNom, boolOuvert, stringTypeDeBesoin); list1.Add(attract1); } //Attraction attract1 = new Attraction(boolBesoinSpecifique, dureeMaint, temp, idClass, true, // stringNatureMaintenance, minMonstreClass, stringNom, boolOuvert, stringTypeDeBesoin); Administration.listeAttractions.Add(list1[0]); if (affichage.Text != "Attraction non ajoutée à la base de données.") { affichage.Text = "Attraction ajoutée."; } else { affichage.Text = "Attraction ajoutée au programme, mais pas à la base de données MySQL."; } } catch { MessageBoxResult result = MessageBox.Show("Type de valeur d'entrée incorrect: vérifier le matricule (entier) et le sexe (M, F ou A)", "Erreur", MessageBoxButton.OK, MessageBoxImage.Error); //label1.Content = "Type de valeur d'entrée incorrect: vérifier le matricule (entier) et le sexe (M, F ou A)"; } } } else { affichage.Text = "Merci d'indiquer si l'attraction est en maintenance."; } } else { affichage.Text = "Merci de confirmer l'exactitude des informations en cochant la case."; } } } else { } } else { affichage.Text = "Matricule déjà existant. Merci de le changer."; } }
void compile() { Compiler.setCode(currentCode); Data.output = ""; if (Compiler.compile()) { Debug.Log("compilation succesfull"); GameObject obj = Data.objects[Data.activeObj]; if (obj.tag == "animal") { } else if (obj.tag == "train") { TrackBuilder tb; RollerCoaster rc = obj.GetComponent <RollerCoaster>(); MainObject mo = obj.GetComponent <MainObject>(); if (rc.tb != null) { rc.tb.reset(); //tb = rc.tb; } tb = new TrackBuilder(obj);; tb.setModel(mo.model); tb.setType(0); tb.generate(mo.script); rc.tb = tb; } else if (obj.tag == "wall") { WallBuilder wb; Wall wall = obj.GetComponent <Wall>(); MainObject mo = obj.GetComponent <MainObject>(); if (wall.wb != null) { wall.wb.reset(); //tb = rc.tb; } wb = new WallBuilder(obj); wb.setModel(mo.model); wb.generate(mo.script); wall.wb = wb; } else if (obj.tag == "graph") { GraphPlotter gp; Graph graph = obj.GetComponent <Graph>(); MainObject mo = obj.GetComponent <MainObject>(); if (graph.gp != null) { graph.gp.reset(); //tb = rc.tb; } gp = new GraphPlotter(obj); gp.generate(mo.script); graph.gp = gp; } } else { Debug.Log("compilation error:" + Compiler.getError()); Data.output += Compiler.getError() + "\n"; } }
public Task <RollerCoaster> Add(RollerCoaster role) { return(_repo.Add(role)); }
public Task <RollerCoaster> Update(RollerCoaster role) { return(_repo.Update(role)); }
public IActionResult Detail(int id) { RollerCoaster rollerCoaster = rollerCoasterDAO.GetCoaster(id); return(View(rollerCoaster)); }
public void TestMinimumHeight() { RollerCoaster coaster = new RollerCoaster(); Assert.Equal(1.30, coaster.ShowMinimumHeight(), 2); }
public Passenger(string threadName, RollerCoaster riding) : base(threadName) { _riding = riding; }
public Task <RollerCoaster> Add(RollerCoaster role) { return(null); }
public Task <RollerCoaster> Update(RollerCoaster role) { return(null); }