コード例 #1
0
        /// <summary>
        /// Retourne un volume par son ISBN.
        /// </summary>
        /// <param name="VolumeIsbn"></param>
        /// <param name="VolToFill"></param>
        public static void GetVolumeByIsbn(string VolumeIsbn, ref Volume VolToFill)
        {
            StringBuilder sLog = new StringBuilder();

            using (ExamSGBD2017Entities dbEntity = new ExamSGBD2017Entities())
            {
                try
                {
                    Volume convertedVol = new Volume();
                    var    vvolume      = dbEntity.GetVolumeByIsbn(VolumeIsbn).FirstOrDefault();

                    convertedVol.Id      = vvolume.Id;
                    convertedVol.Isbn    = vvolume.Isbn;
                    convertedVol.Title   = vvolume.Title;
                    convertedVol.Cover   = vvolume.Cover;
                    convertedVol.Authors = DalAuthor.GetAllAuthorsNames(vvolume.Isbn);

                    VolToFill = convertedVol;
                }
                catch (Exception ex)
                {
                    int DefaultError = 7; //"Problème à la récupération des données !"
                    throw new EL.CstmError(DefaultError, ex);
                }
            }
        }
コード例 #2
0
        public static void GetAllVolumes(ref List <Volume> listToReturn)
        {
            StringBuilder sLog = new StringBuilder();

            listToReturn.Clear();
            using (ExamSGBD2017Entities dbEntity = new ExamSGBD2017Entities())
            {
                try
                {
                    foreach (var vvolume in dbEntity.vVolumes)
                    {
                        Volume convertedVol = new Volume();

                        convertedVol.Id      = vvolume.Id;
                        convertedVol.Isbn    = vvolume.Isbn;
                        convertedVol.Title   = vvolume.Title;
                        convertedVol.Cover   = vvolume.Cover;
                        convertedVol.Authors = DalAuthor.GetAllAuthorsNames(vvolume.Isbn);

                        listToReturn.Add((convertedVol));
                    }
                }
                catch (Exception ex)
                {
                    int DefaultError = 7; //"Problème à la récupération des données !"
                    throw new EL.CstmError(DefaultError, ex);
                }
            }
        }