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(); }
/// <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)); }
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)); }
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)); }
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); }
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(); } }
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; } }
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()); } }
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); }