public PotteryBucket readPotteryBucket(Guid id)
        {
            var retList = new List <PotteryBucket>();
            var retVal  = new PotteryBucket();

            try {
                using (var context = new ArchaeologyContext()) {
                    retList = context.PotteryBucket
                              .Include(potteryBucket => potteryBucket.GeospatialData)
                              .Include(potteryBucket => potteryBucket.Locus)
                              .ThenInclude(locus => locus.Square)
                              .ThenInclude(square => square.Supervisor)
                              .Where(potteryBucket => potteryBucket.Id == id)
                              .ToList();
                }
            }
            catch (Exception ex) {
                throw new Exception(ex.Message, ex.InnerException);
            }
            if (retList.Count > 0)
            {
                retVal = retList[0];
            }
            return(retVal);
        }
예제 #2
0
        public Models.Object readObject(Guid id)
        {
            var retList = new List <Models.Object>();
            var retVal  = new Models.Object();

            try {
                using (var context = new ArchaeologyContext()) {
                    retList = context.Object
                              .Include(obj => obj.GeospatialData)
                              .Include(obj => obj.Locus)
                              .ThenInclude(locus => locus.Square)
                              .ThenInclude(square => square.Supervisor)
                              .Where(obj => obj.Id == id)
                              .ToList();
                }
            }
            catch (Exception ex) {
                throw new Exception(ex.Message, ex.InnerException);
            }
            if (retList.Count > 0)
            {
                retVal = retList[0];
            }
            return(retVal);
        }
예제 #3
0
 public bool createSite(Site site)
 {
     try {
         using (var context = new ArchaeologyContext()) {
             context.Site.Add(site);
             context.SaveChanges();
         }
     }
     catch (Exception ex) {
         throw new Exception(ex.Message, ex.InnerException);
     }
     return(true);
 }
 public bool deletePotteryBucket(PotteryBucket potteryBucket)
 {
     try {
         using (var context = new ArchaeologyContext()) {
             context.Remove(potteryBucket);
             context.SaveChanges();
         }
     }
     catch (Exception ex) {
         throw new Exception(ex.Message, ex.InnerException);
     }
     return(true);
 }
 public bool updateGeospatialData(GeospatialData geospatialData)
 {
     try {
         using (var context = new ArchaeologyContext()) {
             context.GeospatialData.Update(geospatialData);
             context.SaveChanges();
         }
     }
     catch (Exception ex) {
         throw new Exception(ex.Message, ex.InnerException);
     }
     return(true);
 }
예제 #6
0
 public bool updateLocus(Locus locus)
 {
     try {
         using (var context = new ArchaeologyContext()) {
             context.Locus.Update(locus);
             context.SaveChanges();
         }
     }
     catch (Exception ex) {
         throw new Exception(ex.Message, ex.InnerException);
     }
     return(true);
 }
예제 #7
0
 public bool updateSquare(Square square)
 {
     try {
         using (var context = new ArchaeologyContext()) {
             context.Square.Update(square);
             context.SaveChanges();
         }
     }
     catch (Exception ex) {
         throw new Exception(ex.Message, ex.InnerException);
     }
     return(true);
 }
예제 #8
0
 public bool deleteArea(Area area)
 {
     try {
         using (var context = new ArchaeologyContext()) {
             context.Remove(area);
             context.SaveChanges();
         }
     }
     catch (Exception ex) {
         throw new Exception(ex.Message, ex.InnerException);
     }
     return(true);
 }
예제 #9
0
 public bool updateSupervisor(Supervisor supervisor)
 {
     try {
         using (var context = new ArchaeologyContext()) {
             context.Supervisor.Update(supervisor);
             context.SaveChanges();
         }
     }
     catch (Exception ex) {
         throw new Exception(ex.Message, ex.InnerException);
     }
     return(true);
 }
예제 #10
0
 public bool deleteObject(Models.Object obj)
 {
     try {
         using (var context = new ArchaeologyContext()) {
             context.Remove(obj);
             context.SaveChanges();
         }
     }
     catch (Exception ex) {
         throw new Exception(ex.Message, ex.InnerException);
     }
     return(true);
 }
예제 #11
0
 public bool updateTeam(Team team)
 {
     try {
         using (var context = new ArchaeologyContext()) {
             context.Team.Update(team);
             context.SaveChanges();
         }
     }
     catch (Exception ex) {
         throw new Exception(ex.Message, ex.InnerException);
     }
     return(true);
 }
        public List <GeospatialData> readGeospatialData()
        {
            var retVal = new List <GeospatialData>();

            try {
                using (var context = new ArchaeologyContext()) {
                    retVal = context.GeospatialData
                             .ToList();
                }
            }
            catch (Exception ex) {
                throw new Exception(ex.Message, ex.InnerException);
            }
            return(retVal);
        }
예제 #13
0
        public List <Team> readTeams()
        {
            var retVal = new List <Team>();

            try {
                using (var context = new ArchaeologyContext()) {
                    retVal = context.Team
                             .ToList();
                }
            }
            catch (Exception ex) {
                throw new Exception(ex.Message, ex.InnerException);
            }
            return(retVal);
        }
예제 #14
0
        public List <Area> readAreas()
        {
            var retVal = new List <Area>();

            try {
                using (var context = new ArchaeologyContext()) {
                    retVal = context.Area
                             .Include(area => area.Site)
                             .ToList();
                }
            }
            catch (Exception ex) {
                throw new Exception(ex.Message, ex.InnerException);
            }
            return(retVal);
        }
예제 #15
0
        public List <Supervisor> readSupervisors()
        {
            var retVal = new List <Supervisor>();

            try {
                using (var context = new ArchaeologyContext()) {
                    retVal = context.Supervisor
                             .Include(supervisor => supervisor.Team)
                             .ToList();
                }
            }
            catch (Exception ex) {
                throw new Exception(ex.Message, ex.InnerException);
            }
            return(retVal);
        }
        public List <LstArchitecturalMaterial> readArchitecturalMaterials()
        {
            var retVal = new List <LstArchitecturalMaterial>();

            try {
                using (var context = new ArchaeologyContext()) {
                    retVal = context.LstArchitecturalMaterial
                             .OrderBy(l => l.Description)
                             .ToList();
                }
            }
            catch (Exception ex) {
                throw new Exception(ex.Message, ex.InnerException);
            }
            return(retVal);
        }
예제 #17
0
        public List <Square> readSquares()
        {
            var retVal = new List <Square>();

            try {
                using (var context = new ArchaeologyContext()) {
                    retVal = context.Square
                             .Include(square => square.Area)
                             .Include(square => square.Supervisor)
                             .ToList();
                }
            }
            catch (Exception ex) {
                throw new Exception(ex.Message, ex.InnerException);
            }
            return(retVal);
        }
예제 #18
0
        public List <Locus> readLocuss()
        {
            var retVal = new List <Locus>();

            try {
                using (var context = new ArchaeologyContext()) {
                    retVal = context.Locus
                             .Include(locus => locus.Square)
                             .Include(locus => locus.SeparationClarity)
                             .ToList();
                }
            }
            catch (Exception ex) {
                throw new Exception(ex.Message, ex.InnerException);
            }
            return(retVal);
        }
        public List <PotteryBucket> readPotteryBuckets()
        {
            var retVal = new List <PotteryBucket>();

            try {
                using (var context = new ArchaeologyContext()) {
                    retVal = context.PotteryBucket
                             .Include(potteryBucket => potteryBucket.GeospatialData)
                             .Include(potteryBucket => potteryBucket.Locus)
                             .ThenInclude(locus => locus.Square)
                             .ThenInclude(square => square.Supervisor)
                             .ToList();
                }
            }
            catch (Exception ex) {
                throw new Exception(ex.Message, ex.InnerException);
            }
            return(retVal);
        }
예제 #20
0
        public List <Models.Object> readObjects()
        {
            var retVal = new List <Models.Object>();

            try {
                using (var context = new ArchaeologyContext()) {
                    retVal = context.Object
                             .Include(obj => obj.GeospatialData)
                             .Include(obj => obj.Locus)
                             .ThenInclude(locus => locus.Square)
                             .ThenInclude(square => square.Supervisor)
                             .ToList();
                }
            }
            catch (Exception ex) {
                throw new Exception(ex.Message, ex.InnerException);
            }
            return(retVal);
        }
예제 #21
0
        public Site readSite(Guid id)
        {
            var retList = new List <Site>();
            var retVal  = new Site();

            try {
                using (var context = new ArchaeologyContext()) {
                    retList = context.Site
                              .Where(s => s.Id == id)
                              .ToList();
                }
            }
            catch (Exception ex) {
                throw new Exception(ex.Message, ex.InnerException);
            }
            if (retList.Count > 0)
            {
                retVal = retList[0];
            }
            return(retVal);
        }
예제 #22
0
        public Team readTeam(Guid id)
        {
            var retList = new List <Team>();
            var retVal  = new Team();

            try {
                using (var context = new ArchaeologyContext()) {
                    retList = context.Team
                              .Where(team => team.Id == id)
                              .ToList();
                }
            }
            catch (Exception ex) {
                throw new Exception(ex.Message, ex.InnerException);
            }
            if (retList.Count > 0)
            {
                retVal = retList[0];
            }
            return(retVal);
        }
        public LstArchitecturalMaterial readArchitecturalMaterial(int id)
        {
            var retList = new List <LstArchitecturalMaterial>();
            var retVal  = new LstArchitecturalMaterial();

            try {
                using (var context = new ArchaeologyContext()) {
                    retList = context.LstArchitecturalMaterial
                              .Where(s => s.Id == id)
                              .ToList();
                }
            }
            catch (Exception ex) {
                throw new Exception(ex.Message, ex.InnerException);
            }
            if (retList.Count > 0)
            {
                retVal = retList[0];
            }
            return(retVal);
        }
        public GeospatialData readGeospatialData(Guid id)
        {
            var retList = new List <GeospatialData>();
            var retVal  = new GeospatialData();

            try {
                using (var context = new ArchaeologyContext()) {
                    retList = context.GeospatialData
                              .Where(geospatialData => geospatialData.Id == id)
                              .ToList();
                }
            }
            catch (Exception ex) {
                throw new Exception(ex.Message, ex.InnerException);
            }
            if (retList.Count > 0)
            {
                retVal = retList[0];
            }
            return(retVal);
        }
예제 #25
0
        public Supervisor readSupervisor(Guid id)
        {
            var retList = new List <Supervisor>();
            var retVal  = new Supervisor();

            try {
                using (var context = new ArchaeologyContext()) {
                    retList = context.Supervisor
                              .Include(supervisor => supervisor.Team)
                              .Where(supervisor => supervisor.Id == id)
                              .ToList();
                }
            }
            catch (Exception ex) {
                throw new Exception(ex.Message, ex.InnerException);
            }
            if (retList.Count > 0)
            {
                retVal = retList[0];
            }
            return(retVal);
        }
예제 #26
0
        public Area readArea(Guid id)
        {
            // TODO: Figure out Linq query to bring in Team information.
            var retList = new List <Area>();
            var retVal  = new Area();

            try {
                using (var context = new ArchaeologyContext()) {
                    retList = context.Area
                              .Include(area => area.Site)
                              .Where(area => area.Id == id)
                              .ToList();
                }
            }
            catch (Exception ex) {
                throw new Exception(ex.Message, ex.InnerException);
            }
            if (retList.Count > 0)
            {
                retVal = retList[0];
            }
            return(retVal);
        }
예제 #27
0
        public Locus readLocus(Guid id)
        {
            var retList = new List <Locus>();
            var retVal  = new Locus();

            try {
                using (var context = new ArchaeologyContext()) {
                    retList = context.Locus
                              .Include(locus => locus.Square)
                              .Include(locus => locus.SeparationClarity)
                              .Where(locus => locus.Id == id)
                              .ToList();
                }
            }
            catch (Exception ex) {
                throw new Exception(ex.Message, ex.InnerException);
            }
            if (retList.Count > 0)
            {
                retVal = retList[0];
            }
            return(retVal);
        }
예제 #28
0
        public Square readSquare(Guid id)
        {
            var retList = new List <Square>();
            var retVal  = new Square();

            try {
                using (var context = new ArchaeologyContext()) {
                    retList = context.Square
                              .Include(square => square.Area)
                              .Include(square => square.Supervisor)
                              .Where(square => square.Id == id)
                              .ToList();
                }
            }
            catch (Exception ex) {
                throw new Exception(ex.Message, ex.InnerException);
            }
            if (retList.Count > 0)
            {
                retVal = retList[0];
            }
            return(retVal);
        }