Ejemplo n.º 1
0
        public void TryAccessPrivatePropertyOnAnObject()
        {
            PublicType myObj = new PublicType();

            TestPropertyValue <PublicType, int> propertyValue = new TestPropertyValue <PublicType, int>(myObj, "PrivateProperty");

            TestRuntime.ValidateInstantiationException(propertyValue, string.Format(ErrorStrings.MemberNotFound, "PrivateProperty", typeof(PublicType).Name));
        }
Ejemplo n.º 2
0
        public void TryAccessingFieldNotProperty()
        {
            PublicType myObj = new PublicType {
                publicField = "10"
            };

            TestPropertyValue <PublicType, int> propertyValue = new TestPropertyValue <PublicType, int>(myObj, "publicField");

            TestRuntime.ValidateInstantiationException(propertyValue, "");
        }
Ejemplo n.º 3
0
        public void TryAccessingPropertyWithoutGetter()
        {
            PublicType myObj = new PublicType {
                WriteOnlyProperty = 1
            };

            TestPropertyValue <PublicType, int> propertyValue = new TestPropertyValue <PublicType, int>(myObj, "WriteOnlyProperty");

            TestRuntime.ValidateInstantiationException(propertyValue, "");
        }
Ejemplo n.º 4
0
        public void InvokeWithWorkflowInvoker()
        {
            PublicType myType = new PublicType();

            Dictionary <string, object> results = WorkflowInvoker.Invoke((Activity) new PropertyReference <PublicType, int>()
            {
                PropertyName = "PublicProperty"
            },
                                                                         new Dictionary <string, object> {
                { "Operand", myType }
            }) as Dictionary <string, object>;

            if (results["Result"] == null)
            {
                throw new Exception("Result was expected to be in output");
            }
        }
Ejemplo n.º 5
0
        public static List <PublicType> GetTypesPublic()
        {
            PublicType leType = null;

            // Connexion à la BD
            SqlConnection maConnexion = ConnexionBD.GetConnexionBD().GetSqlConnexion();

            // Création d'une liste vide d'objet TheaterPiece

            List <PublicType> lesTypes = new List <PublicType>();

            // Commande sql qui récupère les informations de la table Theater_piece
            SqlCommand cmdTypePublic = new SqlCommand();

            cmdTypePublic.Connection  = maConnexion;
            cmdTypePublic.CommandText = "SELECT * FROM Public_Type";



            // Execution des requetes sql
            SqlDataReader readerTypePublic = cmdTypePublic.ExecuteReader();



            // Public type
            while (readerTypePublic.Read())
            {
                int idType = Int32.Parse(readerTypePublic["publicType_id"].ToString());

                string nomType = readerTypePublic["publicType_name"].ToString();

                leType = new PublicType(idType, nomType);
                lesTypes.Add(leType);
            }
            // Fermeture reader
            readerTypePublic.Close();
            readerTypePublic = cmdTypePublic.ExecuteReader();

            // Fermeture de la connexion
            maConnexion.Close();

            return(lesTypes);
        }
Ejemplo n.º 6
0
    public override int GetHashCode()
    {
        int hashcode = 157;

        unchecked {
            if (__isset.channelId)
            {
                hashcode = (hashcode * 397) + ChannelId.GetHashCode();
            }
            if (__isset.name)
            {
                hashcode = (hashcode * 397) + Name.GetHashCode();
            }
            if (__isset.entryPageUrl)
            {
                hashcode = (hashcode * 397) + EntryPageUrl.GetHashCode();
            }
            if (__isset.descriptionText)
            {
                hashcode = (hashcode * 397) + DescriptionText.GetHashCode();
            }
            if (__isset.provider)
            {
                hashcode = (hashcode * 397) + Provider.GetHashCode();
            }
            if (__isset.publicType)
            {
                hashcode = (hashcode * 397) + PublicType.GetHashCode();
            }
            if (__isset.iconImage)
            {
                hashcode = (hashcode * 397) + IconImage.GetHashCode();
            }
            if (__isset.permissions)
            {
                hashcode = (hashcode * 397) + TCollections.GetHashCode(Permissions);
            }
            if (__isset.iconThumbnailImage)
            {
                hashcode = (hashcode * 397) + IconThumbnailImage.GetHashCode();
            }
            if (__isset.channelConfigurations)
            {
                hashcode = (hashcode * 397) + TCollections.GetHashCode(ChannelConfigurations);
            }
            if (__isset.lcsAllApiUsable)
            {
                hashcode = (hashcode * 397) + LcsAllApiUsable.GetHashCode();
            }
            if (__isset.allowedPermissions)
            {
                hashcode = (hashcode * 397) + TCollections.GetHashCode(AllowedPermissions);
            }
            if (__isset.channelDomains)
            {
                hashcode = (hashcode * 397) + TCollections.GetHashCode(ChannelDomains);
            }
            if (__isset.updatedTimestamp)
            {
                hashcode = (hashcode * 397) + UpdatedTimestamp.GetHashCode();
            }
        }
        return(hashcode);
    }
Ejemplo n.º 7
0
        private void btnModifier_Click(object sender, EventArgs e)
        {
            // Récupération du numéro de la ligne (index)
            int indexRow = dgvListePiecesTheatre.CurrentRow.Index;

            // Si la ligne contient bien une valeur, on valorise les labels avec les valeurs correspondantes
            if (dgvListePiecesTheatre.Rows[indexRow].Cells[0].Value != DBNull.Value)
            {
                TheaterPiece maPieceEditee = (TheaterPiece)dgvListePiecesTheatre.Rows[indexRow].Cells[0].Value;


                grbDetails.Text = "Modifier cette pièce de théatre";


                textBoxNomPiece.Text    = maPieceEditee.TheaterPiece_name.ToString();
                textBoxPrixFixe.Text    = maPieceEditee.TheaterPiece_seatsPrice.ToString();
                textBoxDuree.Text       = lblLaDuree.Text;
                textBoxCommentaire.Text = maPieceEditee.TheaterPiece_description.ToString();



                lblLaPiece.Visible       = false;
                lblLeTheme.Visible       = false;
                lblLaDuree.Visible       = false;
                lblLeAuteur.Visible      = false;
                lblLeType.Visible        = false;
                lblLaDescription.Visible = false;
                lblLaCompagnie.Visible   = false;
                lblLePrixFixe.Visible    = false;
                lblLaNationalite.Text    = string.Empty;
                //lblLaNationalite.Visible = false;

                dgvListePiecesTheatre.Enabled = false;

                btnModifier.Visible  = false;
                btnSupprimer.Visible = false;
                btnValider.Visible   = true;
                btnAnnuler.Visible   = true;

                btnAjouter.Enabled = false;

                textBoxNomPiece.Visible    = true;
                textBoxPrixFixe.Visible    = true;
                textBoxDuree.Visible       = true;
                textBoxCommentaire.Visible = true;
                comboBoxAuteur.Visible     = true;
                comboBoxCompagnie.Visible  = true;
                comboBoxTheme.Visible      = true;
                comboBoxPublic.Visible     = true;


                List <Author> lesAuteurs = PiecesTheatreDAO.GetAuthors();
                comboBoxAuteur.DataSource    = lesAuteurs;
                comboBoxAuteur.DisplayMember = "author_lastname";

                int  indAuteur    = 0;
                bool trouveAuteur = false;
                while (trouveAuteur == false && indAuteur < comboBoxAuteur.Items.Count)
                {
                    Author monAuteur = comboBoxAuteur.Items[indAuteur] as Author;
                    if (monAuteur.Author_id == maPieceEditee.TheaterPiece_author.Author_id)
                    {
                        comboBoxAuteur.SelectedIndex = indAuteur;
                        trouveAuteur = true;
                    }
                    else
                    {
                        indAuteur++;
                    }
                }


                List <Theme> lesThemes = PiecesTheatreDAO.GetThemes();
                comboBoxTheme.DataSource    = lesThemes;
                comboBoxTheme.DisplayMember = "theme_name";

                int  indTheme    = 0;
                bool trouveTheme = false;
                while (trouveTheme == false && indTheme < comboBoxTheme.Items.Count)
                {
                    Theme monTheme = comboBoxTheme.Items[indTheme] as Theme;
                    if (monTheme.Theme_id == maPieceEditee.TheaterPiece_theme.Theme_id)
                    {
                        comboBoxTheme.SelectedIndex = indTheme;
                        trouveTheme = true;
                    }
                    else
                    {
                        indTheme++;
                    }
                }

                List <PublicType> lesTypes = PiecesTheatreDAO.GetTypesPublic();
                comboBoxPublic.DataSource    = lesTypes;
                comboBoxPublic.DisplayMember = "publicType_name";

                int  indType    = 0;
                bool trouveType = false;
                while (trouveType == false && indType < comboBoxPublic.Items.Count)
                {
                    PublicType monType = comboBoxPublic.Items[indType] as PublicType;
                    if (monType.PublicType_id == maPieceEditee.TheaterPiece_publicType.PublicType_id)
                    {
                        comboBoxPublic.SelectedIndex = indType;
                        trouveType = true;
                    }
                    else
                    {
                        indType++;
                    }
                }

                List <Company> lesCompagnies = PiecesTheatreDAO.GetCompagnies();
                comboBoxCompagnie.DataSource    = lesCompagnies;
                comboBoxCompagnie.DisplayMember = "company_name";

                int  indCompagnie    = 0;
                bool trouveCompagnie = false;
                while (trouveCompagnie == false && indCompagnie < comboBoxCompagnie.Items.Count)
                {
                    Company maCompagnie = comboBoxCompagnie.Items[indCompagnie] as Company;
                    if (maCompagnie.Company_id == maPieceEditee.TheaterPiece_company.Company_id)
                    {
                        comboBoxCompagnie.SelectedIndex = indCompagnie;
                        trouveCompagnie = true;
                    }
                    else
                    {
                        indCompagnie++;
                    }
                }
            }
        }
Ejemplo n.º 8
0
        private void btnValider_Click(object sender, EventArgs e)
        {
            if (textBoxNomPiece.Text == String.Empty || textBoxDuree.Text == String.Empty || textBoxPrixFixe.Text == String.Empty)
            {
                errorProviderDuree.SetError(textBoxDuree, "Ce champ est requis !");
                errorProviderNomPiece.SetError(textBoxNomPiece, "Ce champ est requis !");
                errorProviderPrixFixe.SetError(textBoxPrixFixe, "Ce champ est requis !");
            }
            else
            {
                var rep = MessageBox.Show("Êtes vous sûr de vouloir valider ?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation);
                if (rep == DialogResult.Yes)
                {
                    leAuteur     = comboBoxAuteur.SelectedItem as Author;
                    laCompagnie  = comboBoxCompagnie.SelectedItem as Company;
                    leTypePublic = comboBoxPublic.SelectedItem as PublicType;
                    leTheme      = comboBoxTheme.SelectedItem as Theme;


                    if (grbDetails.Text == "Modifier cette pièce de théatre")
                    {
                        TimeSpan     dureeTS  = TimeSpan.FromMinutes(double.Parse(textBoxDuree.Text));
                        float        dureeFl  = (float)dureeTS.TotalHours;
                        TheaterPiece unePiece = new TheaterPiece(int.Parse(lblIdPiece.Text), textBoxNomPiece.Text, textBoxCommentaire.Text, dureeFl, float.Parse(textBoxPrixFixe.Text), laCompagnie, leAuteur, leTypePublic, leTheme);
                        ModulePiecesTheatre.EditTheaterPiece(unePiece);
                    }
                    else if (grbDetails.Text == "Ajout d'une pièce de théatre")
                    {
                        TimeSpan     dureeTS  = TimeSpan.FromMinutes(double.Parse(textBoxDuree.Text));
                        float        dureeFl  = (float)dureeTS.TotalHours;
                        TheaterPiece unePiece = new TheaterPiece(textBoxNomPiece.Text, textBoxCommentaire.Text, dureeFl, float.Parse(textBoxPrixFixe.Text), laCompagnie, leAuteur, leTypePublic, leTheme);
                        ModulePiecesTheatre.AddTheaterPiece(unePiece);
                    }


                    grbDetails.Text          = "Détails de la pièce de théatre";
                    lblLaPiece.Visible       = true;
                    lblLeTheme.Visible       = true;
                    lblLaDuree.Visible       = true;
                    lblLeAuteur.Visible      = true;
                    lblLeType.Visible        = true;
                    lblLaDescription.Visible = true;
                    lblLaCompagnie.Visible   = true;
                    lblLePrixFixe.Visible    = true;
                    lblLaNationalite.Text    = string.Empty;
                    lblLaNationalite.Visible = true;

                    dgvListePiecesTheatre.Enabled = true;

                    textBoxNomPiece.Visible    = false;
                    textBoxPrixFixe.Visible    = false;
                    textBoxDuree.Visible       = false;
                    textBoxCommentaire.Visible = false;
                    comboBoxAuteur.Visible     = false;
                    comboBoxCompagnie.Visible  = false;
                    comboBoxTheme.Visible      = false;
                    comboBoxPublic.Visible     = false;

                    btnModifier.Visible  = true;
                    btnSupprimer.Visible = true;
                    btnValider.Visible   = false;
                    btnAnnuler.Visible   = false;

                    dgvListePiecesTheatre.CurrentRow.Selected = true;

                    // On valorise chaque label avec une valeur vide
                    lblLaPiece.Text = "";

                    lblLeTheme.Text = "";

                    lblLaDuree.Text = "";

                    lblLeAuteur.Text = "";

                    lblLeType.Text = "";

                    lblLaDescription.Text = "";

                    lblLaCompagnie.Text = "";

                    lblLePrixFixe.Text = "€";

                    lblLaNationalite.Text = "";

                    ListePiece();

                    btnAjouter.Enabled = true;
                }
            }
        }
Ejemplo n.º 9
0
        public void TestInvokePrivateMethodAcrossAssemblyBoundries()
        {
            var tTest = new PublicType();

            Assert.AreEqual(true, Impromptu.InvokeMember(tTest, "PrivateMethod", 3));
        }
Ejemplo n.º 10
0
    public override string ToString()
    {
        var  sb      = new StringBuilder("ChannelInfo(");
        bool __first = true;

        if (ChannelId != null && __isset.channelId)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("ChannelId: ");
            ChannelId.ToString(sb);
        }
        if (Name != null && __isset.name)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("Name: ");
            Name.ToString(sb);
        }
        if (EntryPageUrl != null && __isset.entryPageUrl)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("EntryPageUrl: ");
            EntryPageUrl.ToString(sb);
        }
        if (DescriptionText != null && __isset.descriptionText)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("DescriptionText: ");
            DescriptionText.ToString(sb);
        }
        if (Provider != null && __isset.provider)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("Provider: ");
            Provider.ToString(sb);
        }
        if (__isset.publicType)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("PublicType: ");
            PublicType.ToString(sb);
        }
        if (IconImage != null && __isset.iconImage)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("IconImage: ");
            IconImage.ToString(sb);
        }
        if (Permissions != null && __isset.permissions)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("Permissions: ");
            Permissions.ToString(sb);
        }
        if (IconThumbnailImage != null && __isset.iconThumbnailImage)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("IconThumbnailImage: ");
            IconThumbnailImage.ToString(sb);
        }
        if (ChannelConfigurations != null && __isset.channelConfigurations)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("ChannelConfigurations: ");
            ChannelConfigurations.ToString(sb);
        }
        if (__isset.lcsAllApiUsable)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("LcsAllApiUsable: ");
            LcsAllApiUsable.ToString(sb);
        }
        if (AllowedPermissions != null && __isset.allowedPermissions)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("AllowedPermissions: ");
            AllowedPermissions.ToString(sb);
        }
        if (ChannelDomains != null && __isset.channelDomains)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("ChannelDomains: ");
            ChannelDomains.ToString(sb);
        }
        if (__isset.updatedTimestamp)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("UpdatedTimestamp: ");
            UpdatedTimestamp.ToString(sb);
        }
        sb.Append(")");
        return(sb.ToString());
    }
Ejemplo n.º 11
0
        public void TestInvokePrivateMethodAcrossAssemblyBoundries()
        {
            var tTest = new PublicType();

            Assert.That((object)Dynamic.InvokeMember(tTest, "PrivateMethod", 3), Is.True);
        }
Ejemplo n.º 12
0
 public void TestInvokePrivateMethodAcrossAssemblyBoundries()
 {
     var tTest = new PublicType();
     Assert.That(Dynamic.InvokeMember(tTest, "PrivateMethod", 3), Is.True);
 }
Ejemplo n.º 13
0
        public static TheaterPiece GetOneTheaterPiece(string nomPiece)
        {
            int        id          = 0;
            string     nom         = "";
            string     description = "";
            float      duree       = 0;
            float      prix        = 0;
            Company    laCompagnie = null;
            Author     leAuteur    = null;
            PublicType leType      = null;
            Theme      leTheme     = null;

            TheaterPiece unePieceTheatre = null;

            // Connexion à la BD
            SqlConnection maConnexion = ConnexionBD.GetConnexionBD().GetSqlConnexion();


            // Commande sql qui récupère les informations de la table Theatre_piece
            SqlCommand cmdPiecesTheatre = new SqlCommand();

            cmdPiecesTheatre.Connection  = maConnexion;
            cmdPiecesTheatre.CommandText = "SELECT * FROM Theater_piece";

            // Commande sql qui récupère les informations de la table Author
            SqlCommand cmdAuteur = new SqlCommand();

            cmdAuteur.Connection  = maConnexion;
            cmdAuteur.CommandText = "SELECT * FROM Author";

            // Commande sql qui récupère les informations de la table Nationality
            SqlCommand cmdNationalites = new SqlCommand();

            cmdNationalites.Connection  = maConnexion;
            cmdNationalites.CommandText = "SELECT * FROM Nationality";

            // Commande sql qui récupère les informations de la table To_be_of
            SqlCommand cmdAuteurNationalite = new SqlCommand();

            cmdAuteurNationalite.Connection  = maConnexion;
            cmdAuteurNationalite.CommandText = "SELECT * FROM To_be_of";

            // Commande sql qui récupère les informations de la table Theme
            SqlCommand cmdTheme = new SqlCommand();

            cmdTheme.Connection  = maConnexion;
            cmdTheme.CommandText = "SELECT * FROM Theme";

            // Commande sql qui récupère les informations de la table Public_Type
            SqlCommand cmdTypePublic = new SqlCommand();

            cmdTypePublic.Connection  = maConnexion;
            cmdTypePublic.CommandText = "SELECT * FROM Public_Type";

            // Commande sql qui récupère les informations de la table Company
            SqlCommand cmdCompagnie = new SqlCommand();

            cmdCompagnie.Connection  = maConnexion;
            cmdCompagnie.CommandText = "SELECT * FROM Company";


            // Execution des requetes
            SqlDataReader readerPiecesTheatre     = cmdPiecesTheatre.ExecuteReader();
            SqlDataReader readerAuteur            = cmdAuteur.ExecuteReader();
            SqlDataReader readerNationalites      = cmdNationalites.ExecuteReader();
            SqlDataReader readerTheme             = cmdTheme.ExecuteReader();
            SqlDataReader readerTypePublic        = cmdTypePublic.ExecuteReader();
            SqlDataReader readerAuteurNationalite = cmdAuteurNationalite.ExecuteReader();
            SqlDataReader readerCompagnie         = cmdCompagnie.ExecuteReader();

            // Remplissage de la liste
            // Pieces de theatre
            while (readerPiecesTheatre.Read())
            {
                nom = readerPiecesTheatre["theaterPiece_name"].ToString();

                if (nom == nomPiece)
                {
                    id          = Int32.Parse(readerPiecesTheatre["theaterPiece_id"].ToString());
                    description = readerPiecesTheatre["theaterPiece_description"].ToString();
                    duree       = float.Parse(readerPiecesTheatre["theaterPiece_duration"].ToString());
                    prix        = float.Parse(readerPiecesTheatre["theaterPiece_seatsPrice"].ToString());
                    int idDeLAuteur     = Int32.Parse(readerPiecesTheatre["theaterPiece_author"].ToString());
                    int idDeLaCompagnie = Int32.Parse(readerPiecesTheatre["theaterPiece_company"].ToString());
                    int idDuTypePublic  = Int32.Parse(readerPiecesTheatre["theaterPiece_publicType"].ToString());
                    int idDuTheme       = Int32.Parse(readerPiecesTheatre["theaterPiece_theme"].ToString());

                    // Company
                    while (readerCompagnie.Read())
                    {
                        int idCompagnie = Int32.Parse(readerCompagnie["company_id"].ToString());

                        if (idDeLaCompagnie == idCompagnie)
                        {
                            string nomCompagnie        = readerCompagnie["company_name"].ToString();
                            string villeCompagnie      = readerCompagnie["company_city"].ToString();
                            string regionCompagnie     = readerCompagnie["company_region"].ToString();
                            string directeurArtistique = readerCompagnie["company_artisticDirector"].ToString();

                            laCompagnie = new Company(idCompagnie, nomCompagnie, villeCompagnie, regionCompagnie, directeurArtistique);
                        }
                    }
                    // Fermeture reader
                    readerCompagnie.Close();
                    readerCompagnie = cmdCompagnie.ExecuteReader();

                    // Author
                    while (readerAuteur.Read())
                    {
                        int idAuteur = Int32.Parse(readerAuteur["author_id"].ToString());

                        if (idDeLAuteur == idAuteur)
                        {
                            string nomAuteur    = readerAuteur["author_lastname"].ToString();
                            string prenomAuteur = readerAuteur["author_firstname"].ToString();

                            List <int> lesIdsNationalites = new List <int>();

                            while (readerAuteurNationalite.Read())
                            {
                                int idComparerAuteur = Int32.Parse(readerAuteurNationalite["toBeOf_author"].ToString());
                                if (idAuteur == idComparerAuteur)
                                {
                                    int idNatio = Int32.Parse(readerAuteurNationalite["toBeOf_nationality"].ToString());
                                    lesIdsNationalites.Add(idNatio);
                                }
                            }
                            // Fermeture reader
                            readerAuteurNationalite.Close();
                            readerAuteurNationalite = cmdAuteurNationalite.ExecuteReader();

                            List <Nationality> lesNationalites = new List <Nationality>();
                            foreach (int unIdNatio in lesIdsNationalites)
                            {
                                while (readerNationalites.Read())
                                {
                                    int idNationalite = Int32.Parse(readerNationalites["nationality_id"].ToString());
                                    if (unIdNatio == idNationalite)
                                    {
                                        Nationality laNationalite;
                                        string      nomNationalite = readerNationalites["nationality_name"].ToString();

                                        laNationalite = new Nationality(idNationalite, nomNationalite);
                                        lesNationalites.Add(laNationalite);
                                    }
                                }
                                // Fermeture reader
                                readerNationalites.Close();
                                readerNationalites = cmdNationalites.ExecuteReader();
                            }

                            leAuteur = new Author(idAuteur, nomAuteur, prenomAuteur, lesNationalites);
                        }
                    }
                    // Fermeture reader
                    readerAuteur.Close();
                    readerAuteur = cmdAuteur.ExecuteReader();

                    // Public type
                    while (readerTypePublic.Read())
                    {
                        int idType = Int32.Parse(readerTypePublic["publicType_id"].ToString());

                        if (idType == idDuTypePublic)
                        {
                            string nomType = readerTypePublic["publicType_name"].ToString();

                            leType = new PublicType(idType, nomType);
                        }
                    }
                    // Fermeture reader
                    readerTypePublic.Close();
                    readerTypePublic = cmdTypePublic.ExecuteReader();

                    // Theme
                    while (readerTheme.Read())
                    {
                        int idTheme = Int32.Parse(readerTheme["theme_id"].ToString());

                        if (idTheme == idDuTheme)
                        {
                            string nomTheme = readerTheme["theme_name"].ToString();

                            leTheme = new Theme(idTheme, nomTheme);
                        }
                    }
                    // Fermeture reader
                    readerTheme.Close();
                    readerTheme = cmdTheme.ExecuteReader();

                    unePieceTheatre = new TheaterPiece(id, nom, description, duree, prix, laCompagnie, leAuteur, leType, leTheme);
                }
            }
            // Fermeture reader
            readerCompagnie.Close();
            readerAuteurNationalite.Close();
            readerNationalites.Close();
            readerAuteur.Close();
            readerTypePublic.Close();
            readerTheme.Close();
            readerPiecesTheatre.Close();

            // Fermeture de la connexion
            maConnexion.Close();

            return(unePieceTheatre);
        }