Esempio n. 1
0
 public void insertFromParserResult(string path, PathParserResult result)
 {
     Author     author     = insertAuthor(result.authorName);
     Instrument instrument = insertInstrument(result.instrumentName, result.instrumentVersion);
     Set        set        = insertSetsFromFrames(result.sets);
     Land       land       = insertLand(path, result, set, instrument, author);
 }
Esempio n. 2
0
        public Scan insertScan(string path, PathParserResult result, Set set, Instrument instrument, Author author)
        {
            var query = from scan in context.Scans
                        where scan.set.id == set.id && scan.scanNo == result.scanNo
                        select scan;

            if (query.Count() > 0)
            {
                return(query.First());
            }

            Scan newScan = new Scan();

            newScan.authorId      = author.id;
            newScan.scanNo        = result.scanNo;
            newScan.instrumentId  = instrument != null ? instrument.id : 0;
            newScan.setId         = set != null ? set.id : 0;
            newScan.creationDate  = DateTime.Now;
            newScan.magnification = result.magnification;
            newScan.threshold     = result.threshold;
            newScan.resolution    = result.resolution;

            context.Scans.Add(newScan);
            context.SaveChanges();
            return(newScan);
        }
Esempio n. 3
0
        public Land insertLand(string path, PathParserResult result, Set set, Instrument instrument, Author author)
        {
            Land land = getLand(path);

            if (land != null)
            {
                return(land);
            }

            Scan scan = insertScan(path, result, set, instrument, author);

            Land newLand = new Land();

            newLand.path   = path;
            newLand.scanId = scan.id;

            context.Lands.Add(newLand);
            context.SaveChanges();
            return(newLand);
        }