public string InsertValidation(BDDValidation validation) { MySqlConnection conn = DBConf.GetDBConnection(); try { conn.Open(); MySqlCommand command = conn.CreateCommand(); command.CommandText = "INSERT INTO rfid(InfoCarte,idPreinscrit) VALUES(@infoCarte,@idPreinscrit)"; command.Parameters.AddWithValue("InfoCarte", validation.infoCarte); command.Parameters.AddWithValue("idPreinscrit", validation.idPreinscrit); command.ExecuteNonQuery(); return("Success !"); } catch (Exception e) { return(e.ToString()); throw; } finally { conn.Close(); conn.Dispose(); conn = null; } }
public string Insert(BDDPreinscrit preinscrit) { MySqlConnection conn = DBConf.GetDBConnection(); try { conn.Open(); MySqlCommand command = conn.CreateCommand(); command.CommandText = "INSERT INTO preinscrit(Nom,Prenom,Adresse,CodePostal,Ville,DateNaissance,Telephone,Email,Club,Ufolep,Parcours) VALUES(@Nom,@Prenom,@Adresse,@CodePostal,@Ville,@DateNaissance,@Telephone,@Email,@Club,@Ufolep,@Parcours)"; //{"Nom":"MARC","Prenom":"Jérémy","Adresse":"59 Cours Clemenceau","CodePostal":"76100","Ville":"Rouen","DateNaissance":"02-06-1998","Telephone":"0782062639","Email":"*****@*****.**","Club":"azerty","Parcours":"1"} command.Parameters.AddWithValue("Nom", preinscrit.Nom); command.Parameters.AddWithValue("Prenom", preinscrit.Prenom); command.Parameters.AddWithValue("Adresse", preinscrit.Adresse); command.Parameters.AddWithValue("CodePostal", preinscrit.CodePostal); command.Parameters.AddWithValue("Ville", preinscrit.Ville); command.Parameters.AddWithValue("DateNaissance", preinscrit.DateNaissance); command.Parameters.AddWithValue("Telephone", preinscrit.Telephone); command.Parameters.AddWithValue("Email", preinscrit.Email); command.Parameters.AddWithValue("Club", preinscrit.Club); command.Parameters.AddWithValue("Ufolep", preinscrit.Ufolep); command.Parameters.AddWithValue("Parcours", preinscrit.Parcours); command.ExecuteNonQuery(); return("Success !"); } catch (Exception e) { return(e.ToString()); } finally { conn.Close(); conn.Dispose(); conn = null; } }
public string InsertXbee(BDDXbee xbee) { MySqlConnection conn = DBConf.GetDBConnection(); try { conn.Open(); MySqlCommand command = conn.CreateCommand(); command.CommandText = "INSERT INTO portique(idPortique,infoCarte,Temps) VALUES(@portique,@carteId,@temps)"; //{"portique":"1","carteId":"316548461","date":"11:34:52"} command.Parameters.AddWithValue("portique", xbee.portique); command.Parameters.AddWithValue("carteId", xbee.carteId); command.Parameters.AddWithValue("temps", xbee.temps); command.ExecuteNonQuery(); return("Success !"); } catch (Exception e) { Debug.Print(e.ToString()); return(e.ToString()); throw; } finally { conn.Close(); conn.Dispose(); conn = null; } }
public string InsertAlerte(BDDAlerte alerte) { MySqlConnection conn = DBConf.GetDBConnection(); try { conn.Open(); MySqlCommand command = conn.CreateCommand(); command.CommandText = "INSERT INTO alerte (alerte) VALUES (@alerte)"; command.Parameters.AddWithValue("alerte", alerte.alerte); command.ExecuteNonQuery(); return("Success !"); } catch (Exception e) { return(e.ToString()); throw; } finally { conn.Close(); conn.Dispose(); conn = null; } }
public List <BDDPreinscrit> SelectPreinscrit() { List <BDDPreinscrit> preinscritL = new List <BDDPreinscrit>(); MySqlConnection conn = DBConf.GetDBConnection(); conn.Open(); try { MySqlCommand command = conn.CreateCommand(); command.CommandText = "SELECT * FROM preinscrit"; MySqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { BDDPreinscrit preinscrit = new BDDPreinscrit() { IdPreinscrit = Convert.ToInt32(reader[0]), Nom = reader[1].ToString(), Prenom = reader[2].ToString(), Adresse = reader[3].ToString(), CodePostal = Convert.ToInt32(reader[4]), Ville = reader[5].ToString(), DateNaissance = reader[6].ToString(), Telephone = reader[7].ToString(), Email = reader[8].ToString(), Club = reader[9].ToString(), Ufolep = reader[10].ToString() }; preinscritL.Add(preinscrit); } return(preinscritL); } catch (Exception) { throw; } finally { conn.Close(); conn.Dispose(); conn = null; } }
public List <BDDAffichage> SelectAffichage() { MySqlConnection conn = DBConf.GetDBConnection(); try { List <BDDAffichage> affichagesL = new List <BDDAffichage>(); conn.Open(); MySqlCommand command = conn.CreateCommand(); command.CommandText = "SELECT preinscrit.Nom, preinscrit.Prenom,portique.idPortique,portique.Temps,preinscrit.Club " + "FROM preinscrit, portique,rfid " + "WHERE rfid.InfoCarte=portique.infoCarte and preinscrit.IdPreinscrit = rfid.idPreinscrit " + "ORDER BY portique.idPortique DESC, portique.Temps ASC"; MySqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { BDDAffichage affichage = new BDDAffichage { nom = reader[0].ToString(), prenom = reader[1].ToString(), checkpoint = Convert.ToInt32(reader[2]), temps = reader[3].ToString(), club = reader[4].ToString() }; affichagesL.Add(affichage); } return(affichagesL); } catch (Exception) { throw; } finally { conn.Close(); conn.Dispose(); conn = null; } }