예제 #1
0
        //Appui sur le bouton ajouter livre
        private void btn_ajouter_Click(object sender, EventArgs e)
        {
            string    resu; AuteurProc auteurProc; AuteurProc auteurProc2;
            LivreProc livreProc;
            LivreProc unLivreProc2;

            resu = "Couleur";
            if (txtbox_titre.Text != "" && txtbox_codeISBn.Text != "" && txtbox_tome.Text != "" && datepick_annee.Value.ToString("MM/yyyy") != "" && txtbox_nbPg.Text != "" && txtbox_format.Text != "" && cbbx_serie.Text != "" && cbbx_editeur.Text != "") // si tout les champs sont remplis
            {
                if (rbtnNoir.Checked == true)                                                                                                                                                                                                                //radio bouton pour choisir la colorimétrie
                {
                    resu = "Noir et Blanc";
                }

                livreProc    = new LivreProc(); auteurProc = new AuteurProc(); auteurProc2 = new AuteurProc();
                unLivreProc2 = new LivreProc(); unLivreProc2 = new LivreProc(); unLivreProc2 = new LivreProc();
                unLivre      = new Livre(txtbox_titre.Text, txtbox_codeISBn.Text, txtbox_tome.Text, datepick_annee.Value.ToString("MM/yyyy"), int.Parse(txtbox_nbPg.Text), "", resu, txtbox_commentaire.Text, txtbox_format.Text, unLivreProc.GetNumSerier(cbbx_serie.Text), unLivreProc.GetNumEditeur(cbbx_editeur.Text)); //instancie un nouveeau livre
                unLivreProc.AjouterLivre(unLivre);                                                                                                                                                                                                                                                                          // ajoute le livre à la base
                auteurDessin   = new auteur(livreProc.GetId(txtbox_codeISBn.Text), auteurProc.GetNumAuteur(cbbxDessin.Text), 1);                                                                                                                                                                                            //instancie l'auteur du dessin
                auteurScenario = new auteur(unLivreProc2.GetId(txtbox_codeISBn.Text), auteurProc.GetNumAuteur(cbbxScenario.Text), 0);                                                                                                                                                                                       //instancie k'auteur du scénario
                //ajoute les auteurs
                auteurProc2.AjouterAuteurLivre(auteurDessin);

                auteurProc.AjouterAuteurLivre(auteurScenario);
                //vide les champs
                txtbox_codeISBn.Text = "";
                txtbox_titre.Text    = "";
                txtbox_nbPg.Text     = "";

                cbbx_editeur.Text       = "";
                cbbx_serie.Text         = "";
                txtbox_format.Text      = "";
                txtbox_commentaire.Text = "";
                txtbox_tome.Text        = "";
                newDataGrid(); //actualise le datagrid
            }
            else
            {
                pnl_MsgErreurGestionLivre.Visible = true;
            }                                                 // sinon affiche le message d'erreur
        }
예제 #2
0
        private void btnValider_Click(object sender, EventArgs e)//valide une supression
        {
            LivreSupprProc = new LivreSupprProccs();


            leLivre = new LivreSuppr(unLivreProc.GetId(txtbox_codeISBn.Text), txtBxMotif.Text); //instncie un livresuppr

            LivreSupprProc.SupprimerLivre(leLivre);                                             //supprime le livre
            txtBxMotif.Text  = "";
            pnlMotif.Visible = false;

            txtbox_codeISBn.Text = "";
            txtbox_titre.Text    = "";
            txtbox_nbPg.Text     = "";

            cbbx_editeur.Text       = "";
            cbbx_serie.Text         = "";
            txtbox_format.Text      = "";
            txtbox_commentaire.Text = "";
            txtbox_tome.Text        = "";
            newDataGrid();
        }