示例#1
0
    public void SQLInsert(int signalID)
    {
        //save triggers to file (if any)
        if (l == null || l.Count == 0)
        {
            return;
        }

        //update triggers with encoderSignalUniqueID
        foreach (Trigger trigger in l)
        {
            trigger.ModeID = signalID;
        }

        LogB.Debug("runEncoderCaptureCsharp SQL inserting triggers");
        SqliteTrigger.InsertList(false, l);
    }
示例#2
0
    public static void DeleteAllStuff(string uniqueID)
    {
        Sqlite.Open();

        //delete the session
        dbcmd.CommandText = "Delete FROM " + Constants.SessionTable + " WHERE uniqueID == " + uniqueID;
        dbcmd.ExecuteNonQuery();

        //delete relations (existance) within persons and sessions in this session
        dbcmd.CommandText = "Delete FROM " + Constants.PersonSessionTable + " WHERE sessionID == " + uniqueID;
        dbcmd.ExecuteNonQuery();

        Sqlite.deleteOrphanedPersons();

        //delete normal jumps
        dbcmd.CommandText = "Delete FROM " + Constants.JumpTable + " WHERE sessionID == " + uniqueID;
        dbcmd.ExecuteNonQuery();

        //delete repetitive jumps
        dbcmd.CommandText = "Delete FROM " + Constants.JumpRjTable + " WHERE sessionID == " + uniqueID;
        dbcmd.ExecuteNonQuery();

        //delete normal runs
        dbcmd.CommandText = "Delete FROM " + Constants.RunTable + " WHERE sessionID == " + uniqueID;
        dbcmd.ExecuteNonQuery();

        //delete intervallic runs
        dbcmd.CommandText = "Delete FROM " + Constants.RunIntervalTable + " WHERE sessionID == " + uniqueID;
        dbcmd.ExecuteNonQuery();

        //delete reaction times
        dbcmd.CommandText = "Delete FROM " + Constants.ReactionTimeTable + " WHERE sessionID == " + uniqueID;
        dbcmd.ExecuteNonQuery();

        //delete pulses
        dbcmd.CommandText = "Delete FROM " + Constants.PulseTable + " WHERE sessionID == " + uniqueID;
        dbcmd.ExecuteNonQuery();

        //delete multiChronopic
        dbcmd.CommandText = "Delete FROM " + Constants.MultiChronopicTable + " WHERE sessionID == " + uniqueID;
        dbcmd.ExecuteNonQuery();

        //delete from encoder start ------>

        //signals
        ArrayList encoderArray = SqliteEncoder.Select(
            true, -1, -1, Convert.ToInt32(uniqueID), Constants.EncoderGI.ALL,
            -1, "signal", EncoderSQL.Eccons.ALL,
            false, true);

        foreach (EncoderSQL eSQL in encoderArray)
        {
            Util.FileDelete(eSQL.GetFullURL(false));                    //signal, don't convertPathToR
            if (eSQL.videoURL != "")
            {
                Util.FileDelete(eSQL.videoURL);                         //video
            }
            Sqlite.Delete(true, Constants.EncoderTable, Convert.ToInt32(eSQL.uniqueID));
        }

        //curves
        encoderArray = SqliteEncoder.Select(
            true, -1, -1, Convert.ToInt32(uniqueID), Constants.EncoderGI.ALL,
            -1, "curve", EncoderSQL.Eccons.ALL,
            false, true);

        foreach (EncoderSQL eSQL in encoderArray)
        {
            Util.FileDelete(eSQL.GetFullURL(false));                    //don't convertPathToR

            /* commented: curve has no video
             * if(eSQL.videoURL != "")
             *      Util.FileDelete(eSQL.videoURL);
             */
            Sqlite.Delete(true, Constants.EncoderTable, Convert.ToInt32(eSQL.uniqueID));
            SqliteEncoder.DeleteSignalCurveWithCurveID(true, Convert.ToInt32(eSQL.uniqueID));

            //delete related triggers
            SqliteTrigger.DeleteByModeID(true, Convert.ToInt32(eSQL.uniqueID));
        }

        //<------- delete from encoder end


        Sqlite.Close();
    }
示例#3
0
    public static void DeletePersonFromSessionAndTests(string sessionID, string personID)
    {
        Sqlite.Open();

        //1.- first delete in personSession77 at this session

        //delete relations (existance) within persons and sessions in this session
        dbcmd.CommandText = "Delete FROM " + Constants.PersonSessionTable +
                            " WHERE sessionID == " + sessionID +
                            " AND personID == " + personID;
        dbcmd.ExecuteNonQuery();

        //2.- Now, it's not in this personSession77 in other sessions, delete if from DB

        //if person is not in other sessions, delete it from DB
        if (!PersonExistsInPS(true, Convert.ToInt32(personID)))
        {
            //this will open and close DB connection
            Delete(true, Constants.PersonTable, Convert.ToInt32(personID));

            //delete photos if any
            if (File.Exists(Util.UserPhotoURL(false, Convert.ToInt32(personID))))
            {
                File.Delete(Util.UserPhotoURL(false, Convert.ToInt32(personID)));
            }
            if (File.Exists(Util.UserPhotoURL(true, Convert.ToInt32(personID))))
            {
                File.Delete(Util.UserPhotoURL(true, Convert.ToInt32(personID)));
            }
        }

        //3.- Delete tests

        //delete normal jumps
        dbcmd.CommandText = "Delete FROM jump WHERE sessionID == " + sessionID +
                            " AND personID == " + personID;

        dbcmd.ExecuteNonQuery();

        //delete repetitive jumps
        dbcmd.CommandText = "Delete FROM jumpRj WHERE sessionID == " + sessionID +
                            " AND personID == " + personID;
        dbcmd.ExecuteNonQuery();

        //delete normal runs
        dbcmd.CommandText = "Delete FROM run WHERE sessionID == " + sessionID +
                            " AND personID == " + personID;

        dbcmd.ExecuteNonQuery();

        //delete intervallic runs
        dbcmd.CommandText = "Delete FROM runInterval WHERE sessionID == " + sessionID +
                            " AND personID == " + personID;

        dbcmd.ExecuteNonQuery();

        //delete reaction times
        dbcmd.CommandText = "Delete FROM reactionTime WHERE sessionID == " + sessionID +
                            " AND personID == " + personID;

        dbcmd.ExecuteNonQuery();

        //delete pulses
        dbcmd.CommandText = "Delete FROM pulse WHERE sessionID == " + sessionID +
                            " AND personID == " + personID;

        dbcmd.ExecuteNonQuery();

        //delete multiChronopic
        dbcmd.CommandText = "Delete FROM multiChronopic WHERE sessionID == " + sessionID +
                            " AND personID == " + personID;

        dbcmd.ExecuteNonQuery();

        //delete from encoder
        dbcmd.CommandText = "Delete FROM " + Constants.EncoderTable + " WHERE sessionID == " + sessionID +
                            " AND personID == " + personID;

        dbcmd.ExecuteNonQuery();


        //delete encoder signal and curves (and it's videos)
        ArrayList encoderArray = SqliteEncoder.Select(
            true, -1, Convert.ToInt32(personID), Convert.ToInt32(sessionID), Constants.EncoderGI.ALL,
            -1, "signal", EncoderSQL.Eccons.ALL,
            false, true);

        foreach (EncoderSQL eSQL in encoderArray)
        {
            Util.FileDelete(eSQL.GetFullURL(false));                    //signal, don't convertPathToR
            if (eSQL.future2 != "")
            {
                Util.FileDelete(eSQL.future2);                          //video
            }
            Sqlite.Delete(true, Constants.EncoderTable, Convert.ToInt32(eSQL.uniqueID));
        }

        encoderArray = SqliteEncoder.Select(
            true, -1, Convert.ToInt32(personID), Convert.ToInt32(sessionID), Constants.EncoderGI.ALL,
            -1, "curve", EncoderSQL.Eccons.ALL,
            false, true);

        foreach (EncoderSQL eSQL in encoderArray)
        {
            Util.FileDelete(eSQL.GetFullURL(false));                    //don't convertPathToR

            /* commented: curve has no video
             * if(eSQL.future2 != "")
             *      Util.FileDelete(eSQL.future2);
             */
            Sqlite.Delete(true, Constants.EncoderTable, Convert.ToInt32(eSQL.uniqueID));
            SqliteEncoder.DeleteSignalCurveWithCurveID(true, Convert.ToInt32(eSQL.uniqueID));

            //delete related triggers
            SqliteTrigger.DeleteByModeID(true, Convert.ToInt32(eSQL.uniqueID));
        }



        //4.- TODO: delete videos


        Sqlite.Close();
    }