public bool AjouterInscription(Inscriptions UnInscription) { bool opeOK = false; try { string bddServeur = ConfigurationManager.AppSettings["serveur"]; string sBddPort = ConfigurationManager.AppSettings["port"]; int bddPort = Convert.ToInt16(sBddPort); string bddBase = ConfigurationManager.AppSettings["base"]; string bddIdent = ConfigurationManager.AppSettings["identificateur"]; string bddMdp = ConfigurationManager.AppSettings["mdp"]; Connex = new Dbconnect(bddServeur, bddPort, bddBase, bddIdent, bddMdp); if (Connex.OuvrirConnexion()) { string requete = "INSERT INTO `Inscription` (`NumDossard`, `coureur_IdCoureur`, `transpondeur_IdTranspondeur`, `course_IdCourse`) " + "VALUES ('" + UnInscription.NumDossard + "', '" + UnInscription.IdCoureur + "', '" + UnInscription.IdTranspondeur + "', '" + UnInscription.IdCourse + "')"; Connex.RequeteNoData(requete); opeOK = true; } } catch { opeOK = false; } Connex.FermerConnexion(); return(opeOK); }
public bool AjouterCategories(Categories UneCategories) { bool opeOK = false; try { string bddServeur = ConfigurationManager.AppSettings["serveur"]; string sBddPort = ConfigurationManager.AppSettings["port"]; int bddPort = Convert.ToInt16(sBddPort); string bddBase = ConfigurationManager.AppSettings["base"]; string bddIdent = ConfigurationManager.AppSettings["identificateur"]; string bddMdp = ConfigurationManager.AppSettings["mdp"]; Connex = new Dbconnect(bddServeur, bddPort, bddBase, bddIdent, bddMdp); if (Connex.OuvrirConnexion()) { string requete = "INSERT INTO `categorie` (`Nom`, `AgeMini`, `AgeMaxi`, `DistanceMax`) " + "VALUES ('" + UneCategories.Nom + "', '" + UneCategories.ageMini + "', '" + UneCategories.ageMaxi + "', '" + UneCategories.dista + "')"; Connex.RequeteNoData(requete); opeOK = true; } } catch { opeOK = false; } Connex.FermerConnexion(); return(opeOK); }
public bool AjouterTranspondeur(Transpondeurs unTranspondeur) { bool opeOK = false; try { string bddServeur = ConfigurationManager.AppSettings["serveur"]; string sBddPort = ConfigurationManager.AppSettings["port"]; int bddPort = Convert.ToInt16(sBddPort); string bddBase = ConfigurationManager.AppSettings["base"]; string bddIdent = ConfigurationManager.AppSettings["identificateur"]; string bddMdp = ConfigurationManager.AppSettings["mdp"]; Connex = new Dbconnect(bddServeur, bddPort, bddBase, bddIdent, bddMdp); if (Connex.OuvrirConnexion()) { string requete = "INSERT INTO `transpondeur` (`IdTranspondeur`, `Perdu`) " + "VALUES ('" + unTranspondeur.Id + "', '" + unTranspondeur.Perdu + "')"; Connex.RequeteNoData(requete); opeOK = true; } } catch { opeOK = false; } Connex.FermerConnexion(); return(opeOK); }
public bool AjouterClub(Clubs UnClub) { bool opeOK = false; try { string bddServeur = ConfigurationManager.AppSettings["serveur"]; string sBddPort = ConfigurationManager.AppSettings["port"]; int bddPort = Convert.ToInt16(sBddPort); string bddBase = ConfigurationManager.AppSettings["base"]; string bddIdent = ConfigurationManager.AppSettings["identificateur"]; string bddMdp = ConfigurationManager.AppSettings["mdp"]; Connex = new Dbconnect(bddServeur, bddPort, bddBase, bddIdent, bddMdp); if (Connex.OuvrirConnexion()) { string requete = "INSERT INTO `club` (`Nom`, `Adresse`, `CodePostal`, `Ville`) " + "VALUES ('" + UnClub.Nom + "', '" + UnClub.Adresse + "', '" + UnClub.Cp + "', '" + UnClub.Ville + "')"; Connex.RequeteNoData(requete); opeOK = true; } } catch { opeOK = false; } Connex.FermerConnexion(); return(opeOK); }
public (bool, string) ModifierCoureurs(Coureurs UnCoureurs, int IdCoureurs) { bool opeOK = false; int ligneMod = 0; string messErreur = ""; try { string bddServeur = ConfigurationManager.AppSettings["serveur"]; string sBddPort = ConfigurationManager.AppSettings["port"]; int bddPort = Convert.ToInt16(sBddPort); string bddBase = ConfigurationManager.AppSettings["base"]; string bddIdent = ConfigurationManager.AppSettings["identificateur"]; string bddMdp = ConfigurationManager.AppSettings["mdp"]; Connex = new Dbconnect(bddServeur, bddPort, bddBase, bddIdent, bddMdp); if (Connex.OuvrirConnexion()) { // mettre la date dans le format Mysql string datnais = Convert.ToDateTime(UnCoureurs.Date).ToString("s", DateTimeFormatInfo.InvariantInfo); datnais = datnais.Replace("T", " "); string requete = "UPDATE Coureur SET `Club_IdClub`= '" + UnCoureurs.IdClub + "', `Nom`= '" + UnCoureurs.Nom + "', `Prenom`= '" + UnCoureurs.Prenom + "', `Adresse`= '" + UnCoureurs.Adresse + "', `CodePostal`= '" + UnCoureurs.Cp + "', `Ville`= '" + UnCoureurs.Ville + "', `DateNaissance`= '" + datnais + "', `Sexe`= '" + UnCoureurs.Sexe + "', `Categorie_IdCategorie`= '" + UnCoureurs.IdCat + "' WHERE IdCoureur = " + IdCoureurs + ""; ligneMod = Connex.RequeteNoData(requete); if (ligneMod == 0) { messErreur = Connex.Erreur; opeOK = false; } else { opeOK = true; } } } catch { opeOK = false; messErreur = "Erreur de connexion !"; } Connex.FermerConnexion(); return(opeOK, messErreur); }
public (bool, string) ModifierCourse(Courses UnCourse, int IdCourse) { bool opeOK = false; int ligneMod = 0; string messErreur = ""; try { string bddServeur = ConfigurationManager.AppSettings["serveur"]; string sBddPort = ConfigurationManager.AppSettings["port"]; int bddPort = Convert.ToInt16(sBddPort); string bddBase = ConfigurationManager.AppSettings["base"]; string bddIdent = ConfigurationManager.AppSettings["identificateur"]; string bddMdp = ConfigurationManager.AppSettings["mdp"]; Connex = new Dbconnect(bddServeur, bddPort, bddBase, bddIdent, bddMdp); if (Connex.OuvrirConnexion()) { string datprevue = Convert.ToDateTime(UnCourse.DatePrevue).ToString("s", DateTimeFormatInfo.InvariantInfo); datprevue = datprevue.Replace("T", " "); string datheure = Convert.ToDateTime(UnCourse.HeureDepart).ToString("s", DateTimeFormatInfo.InvariantInfo); datheure = datheure.Replace("T", " "); string requete = "UPDATE course SET `Nom`= '" + UnCourse.Nom + "', `Date`= '" + datprevue + "', `Distance`= '" + UnCourse.Distance + "', `HeureDepart`= '" + datheure + "', `HeureDepart`= '" + UnCourse.EnCours + "' WHERE IdCourse = " + IdCourse + ""; ligneMod = Connex.RequeteNoData(requete); if (ligneMod == 0) { messErreur = Connex.Erreur; opeOK = false; } else { opeOK = true; } } } catch { opeOK = false; messErreur = "Erreur de connexion !"; } Connex.FermerConnexion(); return(opeOK, messErreur); }
public (bool, string) ModifierTranspondeur(Transpondeurs UnTranspondeur, int IdTranspondeur) { bool opeOK = false; int ligneMod = 0; string messErreur = ""; try { string bddServeur = ConfigurationManager.AppSettings["serveur"]; string sBddPort = ConfigurationManager.AppSettings["port"]; int bddPort = Convert.ToInt16(sBddPort); string bddBase = ConfigurationManager.AppSettings["base"]; string bddIdent = ConfigurationManager.AppSettings["identificateur"]; string bddMdp = ConfigurationManager.AppSettings["mdp"]; Connex = new Dbconnect(bddServeur, bddPort, bddBase, bddIdent, bddMdp); if (Connex.OuvrirConnexion()) { string requete = "UPDATE transpondeur SET `Perdu`= '" + UnTranspondeur.Perdu + "' WHERE IdTranspondeur = " + IdTranspondeur + ""; ligneMod = Connex.RequeteNoData(requete); if (ligneMod == 0) { messErreur = Connex.Erreur; opeOK = false; } else { opeOK = true; } } } catch { opeOK = false; messErreur = "Erreur de connexion !"; } Connex.FermerConnexion(); return(opeOK, messErreur); }
public (bool, string) SupprimerCoureurs(Coureurs UnCoureurs, int IdCoureurs) { bool opeOK = false; int ligneMod = 0; string messErreur = ""; try { string bddServeur = ConfigurationManager.AppSettings["serveur"]; string sBddPort = ConfigurationManager.AppSettings["port"]; int bddPort = Convert.ToInt16(sBddPort); string bddBase = ConfigurationManager.AppSettings["base"]; string bddIdent = ConfigurationManager.AppSettings["identificateur"]; string bddMdp = ConfigurationManager.AppSettings["mdp"]; Connex = new Dbconnect(bddServeur, bddPort, bddBase, bddIdent, bddMdp); if (Connex.OuvrirConnexion()) { string requete = "DELETE FROM Coureur WHERE IdCoureur = " + IdCoureurs; ligneMod = Connex.RequeteNoData(requete); if (ligneMod == 0) { messErreur = Connex.Erreur; opeOK = false; } else { opeOK = true; } } } catch { opeOK = false; messErreur = "Erreur de connexion !"; } Connex.FermerConnexion(); return(opeOK, messErreur); }
public (bool, string) ModifierCategories(Categories UneCategories, int IdCategories) { bool opeOK = false; int ligneMod = 0; string messErreur = ""; try { string bddServeur = ConfigurationManager.AppSettings["serveur"]; string sBddPort = ConfigurationManager.AppSettings["port"]; int bddPort = Convert.ToInt16(sBddPort); string bddBase = ConfigurationManager.AppSettings["base"]; string bddIdent = ConfigurationManager.AppSettings["identificateur"]; string bddMdp = ConfigurationManager.AppSettings["mdp"]; Connex = new Dbconnect(bddServeur, bddPort, bddBase, bddIdent, bddMdp); if (Connex.OuvrirConnexion()) { string requete = "UPDATE categorie SET `Nom`= '" + UneCategories.Nom + "', `AgeMini`= '" + UneCategories.ageMini + "', `AgeMaxi`= '" + UneCategories.ageMaxi + "', `DistanceMax`= '" + UneCategories.dista + "' WHERE IdCategorie = " + IdCategories + ""; ligneMod = Connex.RequeteNoData(requete); if (ligneMod == 0) { messErreur = Connex.Erreur; opeOK = false; } else { opeOK = true; } } } catch { opeOK = false; messErreur = "Erreur de connexion !"; } Connex.FermerConnexion(); return(opeOK, messErreur); }
public (bool, string) ModifierInscription(Inscriptions UnInscription, int IdInscription) { bool opeOK = false; int ligneMod = 0; string messErreur = ""; try { string bddServeur = ConfigurationManager.AppSettings["serveur"]; string sBddPort = ConfigurationManager.AppSettings["port"]; int bddPort = Convert.ToInt16(sBddPort); string bddBase = ConfigurationManager.AppSettings["base"]; string bddIdent = ConfigurationManager.AppSettings["identificateur"]; string bddMdp = ConfigurationManager.AppSettings["mdp"]; Connex = new Dbconnect(bddServeur, bddPort, bddBase, bddIdent, bddMdp); if (Connex.OuvrirConnexion()) { string requete = "UPDATE inscription SET `NumDossard`= '" + UnInscription.NumDossard + "', `coureur_IdCoureur`= '" + UnInscription.IdCoureur + "', `transpondeur_IdTranspondeur`= '" + UnInscription.IdTranspondeur + "', `course_IdCourse`= '" + UnInscription.IdCourse + "' WHERE IdInscription = " + IdInscription + ""; ligneMod = Connex.RequeteNoData(requete); if (ligneMod == 0) { messErreur = Connex.Erreur; opeOK = false; } else { opeOK = true; } } } catch { opeOK = false; messErreur = "Erreur de connexion !"; } Connex.FermerConnexion(); return(opeOK, messErreur); }
public (bool, string) ModifierClub(Clubs UnClub, int IdClub) { bool opeOK = false; int ligneMod = 0; string messErreur = ""; try { string bddServeur = ConfigurationManager.AppSettings["serveur"]; string sBddPort = ConfigurationManager.AppSettings["port"]; int bddPort = Convert.ToInt16(sBddPort); string bddBase = ConfigurationManager.AppSettings["base"]; string bddIdent = ConfigurationManager.AppSettings["identificateur"]; string bddMdp = ConfigurationManager.AppSettings["mdp"]; Connex = new Dbconnect(bddServeur, bddPort, bddBase, bddIdent, bddMdp); if (Connex.OuvrirConnexion()) { string requete = "UPDATE club SET `Nom`= '" + UnClub.Nom + "', `Adresse`= '" + UnClub.Adresse + "', `CodePostal`= '" + UnClub.Cp + "', `Ville`= '" + UnClub.Ville + "' WHERE IdClub = " + IdClub + ""; ligneMod = Connex.RequeteNoData(requete); if (ligneMod == 0) { messErreur = Connex.Erreur; opeOK = false; } else { opeOK = true; } } } catch { opeOK = false; messErreur = "Erreur de connexion !"; } Connex.FermerConnexion(); return(opeOK, messErreur); }
public bool AjouterCoureur(Coureurs UnCoureurs) { bool opeOK = false; try { string bddServeur = ConfigurationManager.AppSettings["serveur"]; string sBddPort = ConfigurationManager.AppSettings["port"]; int bddPort = Convert.ToInt16(sBddPort); string bddBase = ConfigurationManager.AppSettings["base"]; string bddIdent = ConfigurationManager.AppSettings["identificateur"]; string bddMdp = ConfigurationManager.AppSettings["mdp"]; Connex = new Dbconnect(bddServeur, bddPort, bddBase, bddIdent, bddMdp); if (Connex.OuvrirConnexion()) { // mettre la date dansq le format Mysql string datnais = Convert.ToDateTime(UnCoureurs.Date).ToString("s", DateTimeFormatInfo.InvariantInfo); datnais = datnais.Replace("T", " "); string requete = "INSERT INTO `coureur` (`Club_IdClub`, `Nom`, `Prenom`, `Adresse`, `CodePostal`, `Ville`, `DateNaissance`, `Sexe`, `Categorie_IdCategorie`) " + "VALUES ('" + UnCoureurs.IdClub + "', '" + UnCoureurs.Nom + "', '" + UnCoureurs.Prenom + "', '" + UnCoureurs.Adresse + "', '" + UnCoureurs.Cp + "', '" + UnCoureurs.Ville + "', '" + datnais + "', '" + UnCoureurs.Sexe + "', '" + UnCoureurs.IdCat + "')"; Connex.RequeteNoData(requete); opeOK = true; } } catch { opeOK = false; } Connex.FermerConnexion(); return(opeOK); }
public bool AjouterCourse(Courses UnCourse) { bool opeOK = false; try { string bddServeur = ConfigurationManager.AppSettings["serveur"]; string sBddPort = ConfigurationManager.AppSettings["port"]; int bddPort = Convert.ToInt16(sBddPort); string bddBase = ConfigurationManager.AppSettings["base"]; string bddIdent = ConfigurationManager.AppSettings["identificateur"]; string bddMdp = ConfigurationManager.AppSettings["mdp"]; Connex = new Dbconnect(bddServeur, bddPort, bddBase, bddIdent, bddMdp); if (Connex.OuvrirConnexion()) { string datprevue = Convert.ToDateTime(UnCourse.DatePrevue).ToString("s", DateTimeFormatInfo.InvariantInfo); datprevue = datprevue.Replace("T", " "); string datheure = Convert.ToDateTime(UnCourse.HeureDepart).ToString("s", DateTimeFormatInfo.InvariantInfo); datheure = datheure.Replace("T", " "); string requete = "INSERT INTO `course` (`IdCourse`, `Nom`, `Date`, `Distance`, `HeureDepart`, `EnCours`) " + "VALUES ('" + UnCourse.Nom + "', '" + datprevue + "', '" + UnCourse.Distance + "', '" + datprevue + "', '" + UnCourse.EnCours + "')"; Connex.RequeteNoData(requete); opeOK = true; } } catch { opeOK = false; } Connex.FermerConnexion(); return(opeOK); }