//Insert 1 location object
        public CreateLocationResult Post(CreateLocation request)
        {
            Db.ExecuteSql("INSERT INTO location (address, x, y, geom) Values ('" + request.address + "','" + request.x + "','" + request.y + "', ST_GeomFromText('POINT(" + request.x + " " + request.y + ")', 3414))");
            long id = Db.GetLastInsertId();
            var location = Db.GetByIdOrDefault<Location>(id);
            if (location == null)
            {
                throw new HttpError(HttpStatusCode.NotFound, new ArgumentException("Location does not exist: " + id.ToString()));
            }

            return new CreateLocationResult { Location = location };
        }
Beispiel #2
0
        private void insertRecord(CreateAnalysis cAna, CreateLocation cLoc, CreateFile cFile)
        {
            AnalysisService analysis = new AnalysisService();
            CreateAnalysisResult anaResult = analysis.Post(cAna);
            int analysisID = anaResult.Analysis.ID;
            cFile.analysisid = analysisID;

            LocationsService location = new LocationsService();
            CreateLocationResult locResult = location.Post(cLoc);
            int locationID = locResult.Location.ID;
            cFile.locationid = locationID;

            FileService file = new FileService();
            file.Post(cFile);
        }
Beispiel #3
0
 private void insertIntoDatabase()
 {
     abuseper = 0;
     //Face
     if (angry > smile && angry > sad && angry > neutral && angry > noDetect)
     {
         abuseper = abuseper + 25;
     }
     //Motion
     if ((((leftfist + rightfist + leftpalm + rightpalm) / totalFrame) * 100) > 20)
     {
         abuseper = abuseper + 25;
     }
     //Sound
     if (soundresult == true)
     {
         abuseper = abuseper + 25;
     }
     //Heat
     if (feverresult >= 50)
     {
         abuseper = abuseper + 25;
     }
     CreateAnalysis cAna = new CreateAnalysis(abuseper, totalFrame, smile, angry, sad, neutral, leftfist, rightfist, leftpalm, rightpalm, soundresult, soundpath, feverresult);
     CreateLocation cLoc = new CreateLocation(address, x, y);
     CreateFile cFile = new CreateFile(title, date, path, desc, type);
     insertRecord(cAna, cLoc, cFile);
 }