コード例 #1
0
        public override void Fill(params object[] references)
        {
            if (references.Length < 1)
            {
                return;
            }
            int reference = (int)references[0];

            if (reference == 0)
            {
                return;
            }
            using (new WaitingCursor())
                using (IDbCommand cmd = BDPPCDatabase.GetCommand())
                {
                    cmd.CommandText = "SELECT REFALBUM, TITREALBUM, ANNEEPARUTION, REFSERIE, TOME, TOMEDEBUT, TOMEFIN, SUJETALBUM, REMARQUESALBUM, HORSSERIE, INTEGRALE "
                                      + "FROM ALBUMS "
                                      + "WHERE RefAlbum = ?";
                    cmd.Parameters.Clear();
                    cmd.Parameters.Add(BDPPCDatabase.GetParameter("@refalbum", reference));
                    using (IDataReader result = cmd.ExecuteReader())
                        using (BaseDataReader <AlbumCompletPPC> dataReader = new BaseDataReader <AlbumCompletPPC>(result))
                            if (result != null && result.Read())
                            {
                                dataReader.LoadData(this);
                                Série.Fill(dataReader.GetInt(3, -1));
                            }

                    ArrayList Auteurs = new ArrayList();
                    StoredProceduresPPC.ProcAuteurs(Auteurs, reference, -1);
                    this.Scénaristes.Clear();
                    this.Dessinateurs.Clear();
                    this.Coloristes.Clear();
                    foreach (Auteur auteur in Auteurs)
                    {
                        switch (auteur.Metier)
                        {
                        case 0:
                        {
                            this.Scénaristes.Add(auteur);
                            break;
                        }

                        case 1:
                        {
                            this.Dessinateurs.Add(auteur);
                            break;
                        }

                        case 2:
                        {
                            this.Coloristes.Add(auteur);
                            break;
                        }
                        }
                    }

                    this.Editions.Clear();
                    cmd.CommandText = "SELECT REFEDITION, RefAlbum, e.REFEDITEUR, e.REFCOLLECTION, NOMCOLLECTION, ANNEEEDITION, PRIX, VO, COULEUR, ISBN, DEDICACE, PRETE, STOCK, Offert, Gratuit, "
                                      + "NombreDePages, etat, le.libelle as setat, reliure, lr.libelle as sreliure, orientation, lo.libelle as sorientation, FormatEdition, lf.libelle as sFormatEdition, typeedition, lte.libelle as stypeedition, DateAchat, Notes "
                                      + "FROM EDITIONS e LEFT JOIN COLLECTIONS c ON e.REFCOLLECTION = c.REFCOLLECTION "
                                      + "LEFT JOIN LISTES le on (le.ref = e.etat and le.categorie = 1) "
                                      + "LEFT JOIN LISTES lr on (lr.ref = e.reliure and lr.categorie = 2) "
                                      + "LEFT JOIN LISTES lte on (lte.ref = e.typeedition and lte.categorie = 3) "
                                      + "LEFT JOIN LISTES lo on (lo.ref = e.orientation and lo.categorie = 4) "
                                      + "LEFT JOIN LISTES lf on (lf.ref = e.formatedition and lf.categorie = 5) "
                                      + "WHERE REFALBUM = ?";
                    cmd.Parameters.Clear();
                    cmd.Parameters.Add(BDPPCDatabase.GetParameter("@refalbum", RefAlbum));

                    using (IDataReader result = cmd.ExecuteReader())
                        using (BaseDataReader <Edition> dataReader = new BaseDataReader <Edition>(result))
                            if (result != null)
                            {
                                dataReader.FillList(this.Editions);
                            }
                    //Self.Editeur.Fill(Fields.ByNameAsInteger['REFEDITEUR']);
                    //Self.Collection.Fill(q);
                }
        }