/// <summary>
        /// Suggests an image code for the specified
        /// document, the format COL-DOC-IMG
        /// 
        /// If no document exists with that id, null
        /// is returned.
        /// </summary>
        public static string SuggestImageCode(int documentId)
        {
            using (var db = new ArchiveDataContext())
            {
                var d = db.Documents.Find(documentId);

                if (d == null)
                {
                    return null;
                }

                var docCode = d.CatalogCode; // COL-DOC
                var imageCodes = d.Images.Select(i => i.ImageCode).ToArray();

                return SuggestCode(docCode, imageCodes);
            }
        }
        /// <summary>
        /// Suggests an image code for the specified
        /// document, the format COL-DOC-IMG
        ///
        /// If no document exists with that id, null
        /// is returned.
        /// </summary>
        public static string SuggestImageCode(int documentId)
        {
            using (var db = new ArchiveDataContext())
            {
                var d = db.Documents.Find(documentId);

                if (d == null)
                {
                    return(null);
                }

                var docCode    = d.CatalogCode; // COL-DOC
                var imageCodes = d.Images.Select(i => i.ImageCode).ToArray();

                return(SuggestCode(docCode, imageCodes));
            }
        }
        public static string SuggestSpecimenCode(int imageId)
        {
            using (var db = new ArchiveDataContext())
            {
                var i = db.Images.Find(imageId);

                if (i == null)
                {
                    return(null);
                }

                var imageCode     = i.ImageCode; // COL-DOC-IMG
                var specimenCodes = i.Specimens.Select(s => s.ReferenceCode).ToArray();

                return(SuggestCode(imageCode, specimenCodes));
            }
        }
        /// <summary>
        /// Suggests a document code for the specified
        /// collection, in the format COL-DOC
        ///
        /// If no collection exists with that id, null
        /// is returned.
        /// </summary>
        public static string SuggestDocumentCode(int collectionId)
        {
            using (var db = new ArchiveDataContext())
            {
                var c = db.Collections.Find(collectionId);

                if (c == null)
                {
                    return(null);
                }

                var collectionCode = c.CatalogCode; // COL

                var docCodes = c.Documents.Select(d => d.CatalogCode).ToArray();

                return(SuggestCode(collectionCode, docCodes));
            }
        }
        /// <summary>
        /// Suggests a document code for the specified
        /// collection, in the format COL-DOC
        /// 
        /// If no collection exists with that id, null
        /// is returned.
        /// </summary>
        public static string SuggestDocumentCode(int collectionId)
        {

            using (var db = new ArchiveDataContext())
            {
                var c = db.Collections.Find(collectionId);

                if (c == null)
                {
                    return null;
                }

                var collectionCode = c.CatalogCode; // COL

                var docCodes = c.Documents.Select(d => d.CatalogCode).ToArray();

                return SuggestCode(collectionCode, docCodes);
            }
        }
Beispiel #6
0
 public GenericDbRepository(ArchiveDataContext db)
 {
     this._db = db;
 }
        public static string SuggestSpecimenCode(int imageId)
        {
            using (var db = new ArchiveDataContext())
            {
                var i = db.Images.Find(imageId);

                if (i == null)
                {
                    return null;
                }

                var imageCode = i.ImageCode; // COL-DOC-IMG
                var specimenCodes = i.Specimens.Select(s => s.ReferenceCode).ToArray();

                return SuggestCode(imageCode, specimenCodes);
            }
        }