// ajouter un groupe internal static int AddGroupe(Groupe groupe, string courriel, string passWord) { if (!checkPassWord(courriel, passWord)) { return(-2); } if (checkGroupe(groupe.nomGroupe)) { return(-3); } int value = 0; try { MySqlConnection cnx = new MySqlConnection(); cnx.ConnectionString = "Server=127.0.0.1;Uid=root;Pwd=root;Database=groupesbd;"; cnx.Open(); MySqlCommand cmd = new MySqlCommand(); cmd.CommandText = "insert into groupe values (@nomGroupe,@admin) "; cmd.CommandType = CommandType.Text; cmd.Parameters.AddWithValue("nomGroupe", groupe.nomGroupe); cmd.Parameters.AddWithValue("admin", getAdmin(courriel, passWord)); cmd.Connection = cnx; cmd.ExecuteNonQuery(); value = 1; cnx.Close(); } catch (Exception ex) { value = -1; } return(value); }
public int AddGroupe(Groupe groupe, string courriel, string passWord) { return(GroupesDataProvider.AddGroupe(groupe, courriel, passWord)); }