Ejemplo n.º 1
0
 //Insert 1 analysis object
 public CreateAnalysisResult Post(CreateAnalysis request)
 {
     Db.ExecuteSql("INSERT INTO analysis (abuseper, totalframe, smileframe, angryframe, sadframe, neutralframe, leftfistframe, rightfistframe, leftpalmframe, rightpalmframe, soundresult, soundpath, feverresult) Values ('" + request.abuseper + "', '" + request.totalframe + "','" + request.smileframe + "','" + request.angryframe + "', '" + request.sadframe + "', '" + request.neutralframe + "', '" + request.leftfistframe + "', '" + request.rightfistframe + "', '" + request.leftpalmframe + "', '" + request.rightpalmframe + "', '" + request.soundresult + "', '" + request.soundpath + "', '" + request.feverresult + "')");
     long id = Db.GetLastInsertId();
     var analysis = Db.GetByIdOrDefault<Analysis>(id);
     if (analysis == null)
     {
         throw new HttpError(HttpStatusCode.NotFound, new ArgumentException("Analysis does not exist: " + id.ToString()));
     }
     return new CreateAnalysisResult { Analysis = analysis };
 }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
 }