private static List<ClientCarteBancaire> ExecuteReader(SqlCommand cmd)
        {
            SqlDataReader reader;

            List<ClientCarteBancaire> result = new List<ClientCarteBancaire>();
            try
            {
                reader = cmd.ExecuteReader();

                while (reader.Read())
                {
                    ClientCarteBancaire currentClientCarteBancaire = new ClientCarteBancaire(
                        ClientDAO.Read(Convert.ToInt32(reader["ID_CLIENT"])), CarteBancaireDAO.Read(Convert.ToInt32(reader["ID_CARTE_BANCAIRE"])));
                    result.Add(currentClientCarteBancaire);
                }
            }
            catch (Exception e)
            {
                throw (e);
            }

            reader.Close();
            reader.Dispose();
            reader = null;
            return result;
        }
        public static bool LinkClientAndCarteBancaire(Client currentClient, CarteBancaire currentCard)
        {
            List<ClientCarteBancaire> clientCarteBancaireDB = ClientCarteBancaireDAO.Search("ID_CLIENT='" + currentClient.ClientId + "' AND ID_CARTE_BANCAIRE = '" + currentCard.BankCardId + "'");
            if (clientCarteBancaireDB.Any())
                return false;

            ClientCarteBancaire newCarte = new ClientCarteBancaire(currentClient, currentCard);
            ClientCarteBancaireDAO.Insert(newCarte);
            return true;
        }
 public static void Insert(ClientCarteBancaire clientCarteBancaire)
 {
     SqlCommand cmd = new SqlCommand();
     const string query = "INSERT INTO CLIENT_CARTE_BANCAIRE VALUES ('{0}','{1}')";
     cmd.CommandText = string.Format(query, clientCarteBancaire.Client.ClientId.ToString()
         , clientCarteBancaire.BankCard.BankCardId.ToString());
     cmd.CommandType = CommandType.Text;
     cmd.Connection = BDDConnexion.Conn;
     try
     {
         cmd.ExecuteNonQuery();
     }
     catch (Exception e)
     {
         throw (e);
     }
     finally
     {
         cmd.Dispose();
         cmd = null;
     }
 }