Ejemplo n.º 1
0
        private void ExemplaireIhm_Load(object sender, EventArgs e)
        {
            txtAuteur.Text = exemplaire.Livre.NomAuteurs;
            txtTitre.Text  = exemplaire.Livre.Titre;
            txtIsbn.Text   = exemplaire.Livre.Isbn;
            txtTheme.Text  = exemplaire.Livre.Theme.Libelle;
            txtNumero.Text = exemplaire.Numero.ToString();
            txtCode.Text   = exemplaire.Code;


            try
            {
                bibliotheques.AddRange(Bibliotheque.ListerToutes());
            }
            catch (SqlException)
            {
                MessageBox.Show("Erreur de connexion!");
            }

            foreach (Bibliotheque bibliotheque in bibliotheques)
            {
                comboBoxBibliotheque.Items.Add(bibliotheque);
            }

            comboBoxBibliotheque.SelectedItem = exemplaire.Bibliotheque;

            MettreAJourListeEmplacements();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Renvoie la liste des emprunts pour la bibliothèque spécifiée dans l'année spécifiée.
        /// </summary>
        /// <param name="bibliotheque"></param>
        /// <param name="annee"></param>
        /// <returns></returns>
        public static List <Emprunt> Rechercher(Bibliotheque bibliotheque, int annee)
        {
            List <SqlParameter> parametres = new List <SqlParameter>();

            Utilitaires.RajouterParametre(parametres, "@CodBibliotheque", bibliotheque.Code);
            Utilitaires.RajouterParametre(parametres, "@Annee", annee);

            string sql = @"SELECT Adherent.numAdherent, nomAdherent, prenomAdherent, adrAdherent, teleAdherent, perimeLe,
                               datEmprunt, datRestitutionPrev, datRestitutionEff,                             
                               Exemplaire.numExemplaire, Exemplaire.codExemplaire,  commentExemplaire, disponible,
                               Emplacement.codEmplacement, libelEmplacement,                            
                               Bibliotheque.codBibliotheque, libelBibliotheque, adrBibliotheque,
                               Livre.IsbnLivre, titreLivre,
                               Theme.codTheme, libelTheme, descripTheme
                           FROM Adherent
                               JOIN Emprunt ON Adherent.numAdherent = Emprunt.numAdherent
                               JOIN Exemplaire ON Emprunt.numExemplaire = Exemplaire.numExemplaire
                               JOIN Emplacement ON Exemplaire.codBibliotheque = Emplacement.codBibliotheque AND Exemplaire.codEmplacement = Emplacement.codEmplacement
                               JOIN Bibliotheque ON Emplacement.codBibliotheque = Bibliotheque.codBibliotheque
                               JOIN Livre ON Exemplaire.IsbnLivre = Livre.IsbnLivre
                               JOIN Theme ON Livre.codTheme = Theme.codTheme
                           WHERE Bibliotheque.codBibliotheque = @CodBibliotheque AND YEAR(Emprunt.datEmprunt) = @Annee;";

            return(ousine.ObtenirListe(parametres, sql));
        }
Ejemplo n.º 3
0
        public static Exemplaire Obtenir(Bibliotheque bibliotheque, string codeExemplaire)

        {
            List <SqlParameter> parametres = new List <SqlParameter>();

            Utilitaires.RajouterParametre(parametres, "@codBibliotheque", bibliotheque.Code);
            Utilitaires.RajouterParametre(parametres, "@CodExemplaire", codeExemplaire);
            string sql = sqlGeneral + "WHERE Bibliotheque.codBibliotheque = @CodBibliotheque AND Exemplaire.codExemplaire = @CodExemplaire;";

            return(ousine.Obtenir(parametres, sql));
        }
Ejemplo n.º 4
0
        public static List <Emplacement> ObtenirListe(Bibliotheque bibliotheque, Theme theme)
        {
            List <SqlParameter> parametres = new List <SqlParameter>();

            parametres.Add(new SqlParameter("@codBibliotheque", bibliotheque.Code));
            parametres.Add(new SqlParameter("@CodTheme", theme.Code));

            string sql = sqlGeneral + "WHERE Bibliotheque.codBibliotheque = @codBibliotheque AND Theme.codTheme = @CodTheme;";

            return(ousine.ObtenirListe(parametres, sql));
        }
Ejemplo n.º 5
0
            public override Exemplaire Creer(DataRow row)
            {
                int    numeroExemplaire = (int)row["numExemplaire"];
                string codeExemplaire   = row["codExemplaire"] as string;
                string commentaire      = row["commentExemplaire"] as string;

                Exemplaire   exemplaire   = new Exemplaire(numeroExemplaire, codeExemplaire);
                Bibliotheque bibliotheque = Bibliotheque.Rechercher(row["codBibliotheque"] as string);

                exemplaire.Bibliotheque = Bibliotheque.ousine.Creer(row);
                exemplaire.Emplacement  = Emplacement.ousine.Creer(row);
                exemplaire.Disponible   = (bool)row["disponible"];
                exemplaire.Livre        = Livre.ousine.Creer(row);

                return(exemplaire);
            }
Ejemplo n.º 6
0
 private void MettreAJourSelection()
 {
     if (cbBibliotheque.SelectedItem != null && cbAnnee.SelectedItem != null)
     {
         int annee = (int)cbAnnee.SelectedItem;
         if (cbBibliotheque.SelectedItem.Equals("Toutes"))
         {
             emprunts = Emprunt.ObtenirListe(annee);
         }
         else
         {
             Bibliotheque bibliotheque = (Bibliotheque)cbBibliotheque.SelectedItem;
             emprunts = Emprunt.Rechercher(bibliotheque, annee);
         }
         chaineAImprimer = CalculerChaineAImprimer();
     }
 }
Ejemplo n.º 7
0
        private void RetourIhm_Load(object sender, EventArgs e)
        {
            try
            {
                bibliotheque = Bibliotheque.Rechercher(Properties.Settings.Default.codBibliotheque);
            }
            catch (SqlException)
            {
                MessageBox.Show("Erreur de connexion !");
            }

            if (bibliotheque == null)
            {
                lblBibliotheque.Text = string.Empty;
            }
            else
            {
                lblBibliotheque.Text = bibliotheque.Libelle;
            }
        }
Ejemplo n.º 8
0
 private void StatistiquesIhm_Load(object sender, EventArgs e)
 {
     chaineAImprimer = CalculerChaineAImprimer();
     try
     {
         foreach (Bibliotheque bibliotheque in Bibliotheque.ListerToutes())
         {
             cbBibliotheque.Items.Add(bibliotheque);
         }
         foreach (int annee in Emprunt.ListerAnnees())
         {
             cbAnnee.Items.Add(annee);
         }
         foreach (Theme theme in Theme.Tous())
         {
             themes.Add(theme);
         }
     }
     catch (SqlException ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
Ejemplo n.º 9
0
        private string EnteteDocument()
        {
            string entete = "Bibliothèque : ";


            if (cbBibliotheque.SelectedItem != null)
            {
                if (cbBibliotheque.SelectedItem.Equals("Toutes"))
                {
                    entete += "Toutes\n\r\n\r";
                }
                else
                {
                    Bibliotheque bibliotheque = cbBibliotheque.SelectedItem as Bibliotheque;
                    entete += $"{bibliotheque.Libelle} ({bibliotheque.Code})\n\r\n\r";
                }
            }

            //entete += $"\r\n\r\n{"Titre"}\t\t{"Emprunts"}\r\n";
            //entete+= FormatterLigne("Titre", "Emprunts");

            return(entete);
        }