示例#1
0
        private void btnAjouter_Click(object sender, EventArgs e)
        {
            grbDetails.Text          = "Ajout d'une pièce de théatre";
            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;

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

            textBoxNomPiece.Text    = "";
            textBoxPrixFixe.Text    = "";
            textBoxDuree.Text       = "";
            textBoxCommentaire.Text = "";

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


            List <Author> lesAuteurs = PiecesTheatreDAO.GetAuthors();

            comboBoxAuteur.DataSource    = lesAuteurs;
            comboBoxAuteur.DisplayMember = "author_lastname";

            List <Theme> lesThemes = PiecesTheatreDAO.GetThemes();

            comboBoxTheme.DataSource    = lesThemes;
            comboBoxTheme.DisplayMember = "theme_name";

            List <PublicType> lesTypes = PiecesTheatreDAO.GetTypesPublic();

            comboBoxPublic.DataSource    = lesTypes;
            comboBoxPublic.DisplayMember = "publicType_name";

            List <Company> lesCompagnies = PiecesTheatreDAO.GetCompagnies();

            comboBoxCompagnie.DataSource    = lesCompagnies;
            comboBoxCompagnie.DisplayMember = "company_name";
        }
示例#2
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++;
                    }
                }
            }
        }
 // Suppression d'une pièce de théatre
 public static void RemoveTheaterPiece(TheaterPiece unePiece)
 {
     ReservationsDAO.RemoveSpectators(unePiece);
     RepresentationsDAO.RemoveShows(unePiece);
     PiecesTheatreDAO.RemoveTheaterPiece(unePiece);
 }
示例#4
0
        //- une méthode qui renvoie toutes les pièces(ça c'est simple)    *GetTheaterPieces()*
        //  Appel de la requête SQL GetTheaterPieces(), puis renvoie de la liste complète
        public static List <TheaterPiece> GetTheaterPieces()
        {
            List <TheaterPiece> theaterPieces = PiecesTheatreDAO.GetTheaterPieces();

            return(theaterPieces);
        }
 // Ajoute une piece de theatre dans la DB
 public static void AddTheaterPiece(TheaterPiece unePiece)
 {
     PiecesTheatreDAO.AddTheaterPiece(unePiece);
 }
 // Edition d'une pièce de théatre
 public static void EditTheaterPiece(TheaterPiece unePiece)
 {
     PiecesTheatreDAO.EditTheaterPiece(unePiece);
 }
 // Renvoie une pièce à partir de son nom
 public static TheaterPiece GetOneTheaterPiece(string nomPiece)
 {
     return(PiecesTheatreDAO.GetOneTheaterPiece(nomPiece));
 }
        public static List <Company> GetCompagnies()
        {
            List <Company> lesCompagnies = PiecesTheatreDAO.GetCompagnies();

            return(lesCompagnies);
        }
        public static List <Theme> GetThemes()
        {
            List <Theme> lesThemes = PiecesTheatreDAO.GetThemes();

            return(lesThemes);
        }
        public static List <Author> GetAuthors()
        {
            List <Author> lesAuteurs = PiecesTheatreDAO.GetAuthors();

            return(lesAuteurs);
        }
        // Récupère la liste des pièces de la DAO, renvoie la liste
        public static List <TheaterPiece> GetTheaterPieces()
        {
            List <TheaterPiece> lesPiecesTheatre = PiecesTheatreDAO.GetTheaterPieces();

            return(lesPiecesTheatre);
        }