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);
 }
Пример #4
0
    public EncoderOverviewWindow(Gtk.Window parent, Constants.EncoderGI encoderGI, int sessionID)
    {
        Glade.XML gladeXML;
        gladeXML = Glade.XML.FromAssembly(Util.GetGladePath() + "encoder_overview.glade", "encoder_overview_win", null);

        gladeXML.Autoconnect(this);
        encoder_overview_win.Parent = parent;

        if (encoderGI == Constants.EncoderGI.GRAVITATORY)
        {
            encoder_overview_win.Title = Catalog.GetString("Encoder Overview") + " - " + Catalog.GetString("Gravitatory");
        }
        else if (encoderGI == Constants.EncoderGI.INERTIAL)
        {
            encoder_overview_win.Title = Catalog.GetString("Encoder Overview") + " - " + Catalog.GetString("Inertial");
        }

        //put an icon to window
        UtilGtk.IconWindow(encoder_overview_win);

        createAndFillTreeView(treeview_sets, treeviewType.SETS, encoderGI,
                              SqliteEncoder.SelectSessionOverviewSets(false, encoderGI, sessionID));
        createAndFillTreeView(treeview_reps, treeviewType.REPS, encoderGI,
                              SqliteEncoder.SelectSessionOverviewReps(false, encoderGI, sessionID));

        /*
         * createTreeView(treeview_sets, treeviewType.SETS, encoderGI);
         * TreeStore storeSets = getStore(treeviewType.SETS, encoderGI);
         * treeview_sets.Model = storeSets;
         * ArrayList dataSets = SqliteEncoder.SelectSessionOverviewSets(false, encoderGI, sessionID);
         *
         * foreach (string [] line in dataSets)
         *      storeSets.AppendValues (line);
         *
         * createTreeView(treeview_reps, treeviewType.REPS, encoderGI);
         * TreeStore storeReps = getStore(treeviewType.REPS, encoderGI);
         * treeview_reps.Model = storeReps;
         * ArrayList dataReps = SqliteEncoder.SelectSessionOverviewReps(false, encoderGI, sessionID);
         *
         * foreach (string [] line in dataReps)
         *      storeReps.AppendValues (line);
         */
    }
    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();
    }
Пример #6
0
    public static int UpdateTransaction(ArrayList data, string [] checkboxes)
    {
        int count       = 0;
        int countActive = 0;

        LogB.SQL("Starting transaction");
        Sqlite.Open();

        using (SqliteTransaction tr = dbcon.BeginTransaction())
        {
            using (SqliteCommand dbcmdTr = dbcon.CreateCommand())
            {
                dbcmdTr.Transaction = tr;

                foreach (EncoderSQL eSQL in data)
                {
                    if (count < checkboxes.Length && eSQL.status != checkboxes[count])
                    {
                        eSQL.status = checkboxes[count];

                        SqliteEncoder.Update(true, eSQL, dbcmdTr);
                    }

                    count++;

                    if (eSQL.status == "active")
                    {
                        countActive++;
                    }
                }
            }
            tr.Commit();
        }

        Sqlite.Close();
        LogB.SQL("Ended transaction");
        return(countActive);
    }
Пример #7
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();
    }
 protected override void getData()
 {
     data = SqliteEncoder.SelectCompareIntersession(false, encoderGI, exerciseID, currentPerson.UniqueID);
 }
Пример #9
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();
    }
Пример #10
0
    protected internal static void initializeTable(string databaseVersion, bool creatingBlankDatabase)
    {
        using (SqliteTransaction tr = dbcon.BeginTransaction())
        {
            using (SqliteCommand dbcmdTr = dbcon.CreateCommand())
            {
                dbcmdTr.Transaction = tr;

                Insert("databaseVersion", databaseVersion, dbcmdTr);

                if (UtilAll.IsWindows() || creatingBlankDatabase)
                {
                    Insert("chronopicPort", Constants.ChronopicDefaultPortWindows, dbcmdTr);
                }
                else
                {
                    Insert("chronopicPort", Constants.ChronopicDefaultPortLinux, dbcmdTr);
                }

                //appearance
                Insert("maximized", Preferences.MaximizedTypes.NO.ToString(), dbcmdTr);
                Insert("personWinHide", "False", dbcmdTr);
                Insert("personPhoto", "True", dbcmdTr);
                Insert("encoderCaptureShowOnlyBars", "False", dbcmdTr);
                Insert("encoderCaptureShowNRepetitions", "-1", dbcmdTr);
                Insert("digitsNumber", "3", dbcmdTr);
                Insert("showPower", "True", dbcmdTr);
                Insert("showStiffness", "True", dbcmdTr);
                Insert("showInitialSpeed", "True", dbcmdTr);
                Insert("showAngle", "False", dbcmdTr);                  //for treeviewjumps
                Insert("showQIndex", "False", dbcmdTr);                 //for treeviewJumps
                Insert("showDjIndex", "False", dbcmdTr);                //for treeviewJumps
                Insert("simulated", "True", dbcmdTr);
                Insert("weightStatsPercent", "False", dbcmdTr);
                Insert("askDeletion", "True", dbcmdTr);
                Insert("heightPreferred", "False", dbcmdTr);
                Insert("metersSecondsPreferred", "True", dbcmdTr);
                Insert("language", "", dbcmdTr);
                Insert("crashLogLanguage", "", dbcmdTr);
                Insert("allowFinishRjAfterTime", "True", dbcmdTr);
                Insert("volumeOn", "True", dbcmdTr);
                Insert(Preferences.GstreamerStr, Preferences.GstreamerTypes.GST_0_1.ToString(), dbcmdTr);
                Insert("videoOn", "True", dbcmdTr);
                Insert("evaluatorServerID", "-1", dbcmdTr);
                Insert("versionAvailable", "", dbcmdTr);
                Insert("runSpeedStartArrival", "True", dbcmdTr);

                Insert("runDoubleContactsMode",
                       Constants.DoubleContact.LAST.ToString(), dbcmdTr);
                Insert("runDoubleContactsMS", "300", dbcmdTr);
                Insert("runIDoubleContactsMode",
                       Constants.DoubleContact.AVERAGE.ToString(), dbcmdTr);
                Insert("runIDoubleContactsMS", "300", dbcmdTr);

                Insert("thresholdJumps", "50", dbcmdTr);
                Insert("thresholdRuns", "10", dbcmdTr);
                Insert("thresholdOther", "50", dbcmdTr);

                Random rnd       = new Random();
                string machineID = rnd.Next().ToString();
                Insert("machineID", machineID, dbcmdTr);

                Insert("multimediaStorage", Constants.MultimediaStorage.BYSESSION.ToString(), dbcmdTr);

                //encoder
                Insert("encoderCaptureTime", "60", dbcmdTr);
                Insert("encoderCaptureInactivityEndTime", "3", dbcmdTr);
                Insert("encoderCaptureMainVariable", Constants.EncoderVariablesCapture.MeanPower.ToString(), dbcmdTr);
                Insert("encoderCaptureMinHeightGravitatory", "20", dbcmdTr);
                Insert("encoderCaptureMinHeightInertial", "5", dbcmdTr);
                Insert("encoderCaptureInertialDiscardFirstN", "3", dbcmdTr);
                Insert("encoderCaptureCheckFullyExtended", "True", dbcmdTr);
                Insert("encoderCaptureCheckFullyExtendedValue", "4", dbcmdTr);
                Insert("encoderCaptureBarplotFontSize", "14", dbcmdTr);
                Insert("encoderShowStartAndDuration", "False", dbcmdTr);
                Insert("encoderCaptureCutByTriggers", Preferences.TriggerTypes.NO_TRIGGERS.ToString(), dbcmdTr);
                Insert("encoderPropulsive", "True", dbcmdTr);
                Insert("encoderSmoothEccCon", "0.6", dbcmdTr);
                Insert("encoderSmoothCon", "0.7", dbcmdTr);
                Insert("encoder1RMMethod", Constants.Encoder1RMMethod.WEIGHTED2.ToString(), dbcmdTr);

                ArrayList encoderExercises =
                    SqliteEncoder.SelectEncoderExercises(true, -1, true);

                if (encoderExercises.Count > 0)
                {
                    EncoderExercise ex = (EncoderExercise)encoderExercises[0];
                    Insert(EncoderExerciseIDGravitatory, ex.uniqueID.ToString(), dbcmdTr);
                    Insert(EncoderExerciseIDInertial, ex.uniqueID.ToString(), dbcmdTr);
                }
                else
                {
                    Insert(EncoderExerciseIDGravitatory, "1", dbcmdTr);
                    Insert(EncoderExerciseIDInertial, "1", dbcmdTr);
                }

                Insert(EncoderContractionGravitatory, Constants.Concentric, dbcmdTr);
                Insert(EncoderContractionInertial, Constants.EccentricConcentric, dbcmdTr);
                Insert(EncoderLateralityGravitatory, "RL", dbcmdTr);
                Insert(EncoderLateralityInertial, "RL", dbcmdTr);
                Insert(EncoderMassGravitatory, "10", dbcmdTr);
                Insert(EncoderWeightsInertial, "0", dbcmdTr);

                //encoderRhythm
                EncoderRhythm er = new EncoderRhythm();
                Insert(EncoderRhythmActiveStr, er.Active.ToString(), dbcmdTr);
                Insert(EncoderRhythmRepsOrPhasesStr, er.RepsOrPhases.ToString(), dbcmdTr);
                Insert(EncoderRhythmRepSecondsStr, Util.ConvertToPoint(er.RepSeconds), dbcmdTr);
                Insert(EncoderRhythmEccSecondsStr, Util.ConvertToPoint(er.EccSeconds), dbcmdTr);
                Insert(EncoderRhythmConSecondsStr, Util.ConvertToPoint(er.ConSeconds), dbcmdTr);
                Insert(EncoderRhythmRestRepsSecondsStr, Util.ConvertToPoint(er.RestRepsSeconds), dbcmdTr);
                Insert(EncoderRhythmRestAfterEccStr, er.RestAfterEcc.ToString(), dbcmdTr);
                Insert(EncoderRhythmRepsClusterStr, Util.ConvertToPoint(er.RepsCluster), dbcmdTr);
                Insert(EncoderRhythmRestClustersSecondsStr, Util.ConvertToPoint(er.RestClustersSeconds), dbcmdTr);


                Insert("videoDevice", "", dbcmdTr);                  //first
                Insert("videoDeviceResolution", "", dbcmdTr);
                Insert("videoDeviceFramerate", "", dbcmdTr);
                Insert("videoStopAfter", "2", dbcmdTr);
                Insert("inertialmomentum", "0.01", dbcmdTr);
                Insert("CSVExportDecimalSeparator", Util.GetDecimalSeparatorFromLocale(), dbcmdTr);
                Insert("RGraphsTranslate", "True", dbcmdTr);
                Insert("useHeightsOnJumpIndexes", "True", dbcmdTr);
                Insert("encoderAutoSaveCurve", Constants.EncoderAutoSaveCurve.BEST.ToString(), dbcmdTr);
                Insert("email", "", dbcmdTr);
                Insert("muteLogs", "False", dbcmdTr);
                Insert(ForceSensorTareDateTimeStr, "", dbcmdTr);
                Insert(ForceSensorTareStr, "-1", dbcmdTr);                  //result value from sensor. Decimal is point!!
                Insert(ForceSensorCalibrationDateTimeStr, "", dbcmdTr);
                Insert(ForceSensorCalibrationWeightStr, "-1", dbcmdTr);
                Insert(ForceSensorCalibrationFactorStr, "-1", dbcmdTr);                  //result value from sensor. Decimal is point!!

                //removed on 1.37
                //Insert ("encoderConfiguration", new EncoderConfiguration().ToStringOutput(EncoderConfiguration.Outputs.SQL), dbcmdTr);
            }
            tr.Commit();
        }
    }