private void linkLabel2_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { AppSmartLockAccueil Accueil = new AppSmartLockAccueil(); Accueil.Show(); this.Hide(); }
//changement à faire dans la bdd en fonction des nouveaux éléments : private void save_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { if (this.isControlled) { SqlConnection AppSmartCo = new SqlConnection(this.ConnectionString); string requete = "UPDATE TempsDefini SET [Duree_blocage] = " + dureeBlocage.Value + ", [Lundi] = " + dureeLundi.Value + ", [Lundi_actif] = '" + ActifLundi.Checked + "', [Mardi] = " + dureeMardi.Value + ", [Mardi_actif] = '" + ActifMardi.Checked + "', [Mercredi] = " + dureeMercredi.Value + ", [Mercredi_actif] = '" + ActifMercredi.Checked + "', [Jeudi] = " + dureeJeudi.Value + ", [Jeudi_actif] = '" + ActifJeudi.Checked + "', [Vendredi] = " + dureeVendredi.Value + ", [Vendredi_actif] = '" + ActifVendredi.Checked + "', [Samedi] = " + dureeSamedi.Value + ", [Samedi_actif]= '" + ActifSamedi.Checked + "',[Dimanche] = " + dureeDimanche.Value + ", [Dimanche_actif] = '" + ActifDimanche.Checked + "' where [Id_app] = (SELECT id_app FROM ApplicationControlable WHERE Nom_app = '" + selectedApp + "')"; SqlCommand command2 = new SqlCommand(requete, AppSmartCo); AppSmartCo.Open(); command2.ExecuteNonQuery(); AppSmartCo.Close(); //retour à l'accueil : AppSmartLockAccueil Accueil = new AppSmartLockAccueil(); Accueil.Show(); this.Hide(); } // il faut créer l'application dans toutes les tables : else { insertAppControlable(this.selectedApp); insertAppControlee(this.selectedApp); insertTempsDefini(this.selectedApp); //retour à l'accueil : AppSmartLockAccueil Accueil = new AppSmartLockAccueil(); Accueil.Show(); this.Hide(); } }
//si l'admin veut supprimer les parametres de controle, on supprime les données dessus présentes dans la BDD : private void delete_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { if (this.isControlled) { SqlConnection AppSmartCo = new SqlConnection(this.ConnectionString); //suppression dans la table temps : string requete = "DELETE FROM TempsDefini where [Id_app] = " + getIdApp(this.selectedApp); SqlCommand command2 = new SqlCommand(requete, AppSmartCo); AppSmartCo.Open(); command2.ExecuteNonQuery(); AppSmartCo.Close(); //suppression dans la table ApplicationControlee : requete = "DELETE FROM ApplicationControlee where [Id_app] = " + getIdApp(this.selectedApp); command2 = new SqlCommand(requete, AppSmartCo); AppSmartCo.Open(); command2.ExecuteNonQuery(); AppSmartCo.Close(); //suppression dans la table ApplicationControlable : requete = "DELETE FROM ApplicationControlable where [Nom_app] = '" + this.selectedApp + "'"; command2 = new SqlCommand(requete, AppSmartCo); AppSmartCo.Open(); command2.ExecuteNonQuery(); AppSmartCo.Close(); //retour à l'accueil : AppSmartLockAccueil Accueil = new AppSmartLockAccueil(); Accueil.Show(); this.Hide(); } }