Select() public static method

public static Select ( bool dbconOpened, int uniqueID, int personID, int sessionID, Constants, encoderGI, int exerciseID, string signalOrCurve, EncoderSQL, ecconSelect, bool onlyActive, bool orderIDascendent ) : ArrayList
dbconOpened bool
uniqueID int
personID int
sessionID int
encoderGI Constants,
exerciseID int
signalOrCurve string
ecconSelect EncoderSQL,
onlyActive bool
orderIDascendent bool
return ArrayList
    protected override void getData()
    {
        ArrayList dataPre = SqlitePersonSession.SelectCurrentSessionPersons(currentSession.UniqueID,
                                                                            false); //means: do not returnPersonAndPSlist

        data = new ArrayList();

        nonSensitiveRows = new ArrayList();
        int j = 0;              //list of added persons

        foreach (Person p in dataPre)
        {
            ArrayList eSQLarray = SqliteEncoder.Select(
                false, -1, p.UniqueID, currentSession.UniqueID, encoderGI,
                exerciseID, "curve", EncoderSQL.Eccons.ALL,
                false, true);

            int allCurves = eSQLarray.Count;

            string [] s = { p.UniqueID.ToString(), "", p.Name,
                            //activeCurves.ToString(),
                            allCurves.ToString() };
            data.Add(s);

            if (allCurves == 0)
            {
                nonSensitiveRows.Add(j);
            }

            j++;
        }
    }
    protected void on_show_repetitions_row_edit_apply(object o, EventArgs args)
    {
        int        curveID = genericWinESR.TreeviewSelectedUniqueID;
        EncoderSQL eSQL    = (EncoderSQL)SqliteEncoder.Select(
            false, curveID, 0, 0, encoderGI,
            -1, "", EncoderSQL.Eccons.ALL,
            false, true)[0];

        //if changed comment, update SQL, and update treeview
        //first remove conflictive characters
        string comment = Util.RemoveTildeAndColonAndDot(genericWinESR.EntryEditRow);

        if (comment != eSQL.description)
        {
            eSQL.description = comment;
            SqliteEncoder.Update(false, eSQL);

            //update treeview
            genericWinESR.on_edit_selected_done_update_treeview();
        }

        //if changed person, proceed
        LogB.Information("new person: " + genericWinESR.GetComboSelected);
        int newPersonID = Util.FetchID(genericWinESR.GetComboSelected);

        if (newPersonID != currentPerson.UniqueID)
        {
            EncoderSQL eSQLChangedPerson = eSQL.ChangePerson(genericWinESR.GetComboSelected);
            SqliteEncoder.Update(false, eSQLChangedPerson);

            genericWinESR.RemoveSelectedRow();
        }

        genericWinESR.ShowEditRow(false);
    }
 protected override void getData()
 {
     data = SqliteEncoder.Select(
         false, -1, currentPerson.UniqueID, currentSession.UniqueID, encoderGI,
         exerciseID, "curve", EncoderSQL.Eccons.ALL,
         false, true);
 }
    protected override void on_show_repetitions_done(object o, EventArgs args)
    {
        //genericWinESR.Button_accept.Clicked -= new EventHandler(on_show_repetitions_done);
        removeCallbacks();

        //get selected/deselected rows
        checkboxes = genericWinESR.GetColumn(1, false);

        ArrayList data = SqliteEncoder.Select(
            false, -1, currentPerson.UniqueID, currentSession.UniqueID, encoderGI,
            exerciseID, "curve", EncoderSQL.Eccons.ALL,
            false, true);

        //update on database the curves that have been selected/deselected
        //doing it as a transaction: FAST
        RepsActive = SqliteEncoder.UpdateTransaction(data, checkboxes);
        RepsAll    = data.Count;

        FakeButtonDone.Click();
    }
Example #5
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 from encoder end


        Sqlite.Close();
    }
Example #6
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.GetPhotoFileName(false, Convert.ToInt32(personID))))
            {
                File.Delete(Util.GetPhotoFileName(false, Convert.ToInt32(personID)));
            }
            if (File.Exists(Util.GetPhotoFileName(true, Convert.ToInt32(personID))))
            {
                File.Delete(Util.GetPhotoFileName(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));
        }


        //4.- TODO: delete videos


        Sqlite.Close();
    }