private TreeStore getStore(treeviewType type, Constants.EncoderGI encoderGI) { TreeStore s; if (type == treeviewType.SETS) { if (encoderGI == Constants.EncoderGI.GRAVITATORY) { s = new TreeStore(typeof(string), typeof(string), typeof(string), typeof(string), typeof(string)); //person, sex, exercise, displaced mass, sets } else { s = new TreeStore(typeof(string), typeof(string), typeof(string), typeof(string)); //person, sex, exercise, sets } } else { if (encoderGI == Constants.EncoderGI.GRAVITATORY) { s = new TreeStore(typeof(string), typeof(string), typeof(string), typeof(string), typeof(string)); //person, sex, exercise, extra mass, power } else { s = new TreeStore(typeof(string), typeof(string), typeof(string), typeof(string)); //person, sex, exercise, power } } return(s); }
private void createTreeView( Gtk.TreeView tv, treeviewType type, Constants.EncoderGI encoderGI) { tv.HeadersVisible = true; int count = 0; if (type == treeviewType.SETS) { tv.AppendColumn(Catalog.GetString("Person"), new CellRendererText(), "text", count++); tv.AppendColumn(Catalog.GetString("Sex"), new CellRendererText(), "text", count++); tv.AppendColumn(Catalog.GetString("Exercise"), new CellRendererText(), "text", count++); if (encoderGI == Constants.EncoderGI.GRAVITATORY) { tv.AppendColumn(Catalog.GetString("Displaced mass"), new CellRendererText(), "text", count++); } tv.AppendColumn(Catalog.GetString("Sets"), new CellRendererText(), "text", count++); } else { tv.AppendColumn(Catalog.GetString("Person"), new CellRendererText(), "text", count++); tv.AppendColumn(Catalog.GetString("Sex"), new CellRendererText(), "text", count++); tv.AppendColumn(Catalog.GetString("Exercise"), new CellRendererText(), "text", count++); if (encoderGI == Constants.EncoderGI.GRAVITATORY) { tv.AppendColumn(Catalog.GetString("Extra mass"), new CellRendererText(), "text", count++); } tv.AppendColumn(Catalog.GetString("Power"), new CellRendererText(), "text", count++); } }
//called on load signal //if does not found any encoderConfiguration then return one with -1 as uniqueID public static EncoderConfigurationSQLObject SelectByEconf(bool dbconOpened, Constants.EncoderGI encoderGI, EncoderConfiguration econf) { openIfNeeded(dbconOpened); dbcmd.CommandText = "SELECT * FROM " + Constants.EncoderConfigurationTable + " WHERE encoderGI = \"" + encoderGI.ToString() + "\"" + " AND encoderConfiguration LIKE \"" + econf.ToStringOutput(EncoderConfiguration.Outputs.SQLECWINCOMPARE) + "\""; LogB.SQL(dbcmd.CommandText.ToString()); dbcmd.ExecuteNonQuery(); SqliteDataReader reader; reader = dbcmd.ExecuteReader(); EncoderConfigurationSQLObject econfSO = new EncoderConfigurationSQLObject(); if (reader.Read()) { econfSO = new EncoderConfigurationSQLObject( Convert.ToInt32(reader[0].ToString()), //uniqueID encoderGI, //encoderGI true, //active reader[3].ToString(), //name econf, //encoderConfiguration reader[5].ToString() //description ); } reader.Close(); Sqlite.Close(); return(econfSO); }
static public EncoderConfigurationWindow View( Constants.EncoderGI encoderGI, EncoderConfigurationSQLObject econfSO, string anchorage_str, int extraWeightN) { if (EncoderConfigurationWindowBox == null) { EncoderConfigurationWindowBox = new EncoderConfigurationWindow(); } EncoderConfigurationWindowBox.encoderGI = encoderGI; EncoderConfigurationWindowBox.updateGUIFromEncoderConfiguration(econfSO.encoderConfiguration); EncoderConfigurationWindowBox.main_gui_anchorage_str = anchorage_str; EncoderConfigurationWindowBox.main_gui_extraWeightN = extraWeightN; EncoderConfigurationWindowBox.createTreeView(); EncoderConfigurationWindowBox.fillTreeView( SqliteEncoderConfiguration.Select(false, encoderGI, ""), //all econfSO); //A) side is hidden at start to ensure scr_treeview_select is scrolled and displays correctly the last row EncoderConfigurationWindowBox.notebook_side.Visible = false; EncoderConfigurationWindowBox.encoder_configuration.Show(); //B) side is shown now, after showing the window in order to be displayed correctly (see A) EncoderConfigurationWindowBox.notebook_side.Visible = (EncoderConfigurationWindowBox.sideMode != sideModes.HIDDEN); return(EncoderConfigurationWindowBox); }
static public EncoderOverviewWindow Show(Gtk.Window parent, Constants.EncoderGI encoderGI, int sessionID) { if (EncoderOverviewWindowBox == null) { EncoderOverviewWindowBox = new EncoderOverviewWindow(parent, encoderGI, sessionID); } EncoderOverviewWindowBox.encoder_overview_win.Show(); return(EncoderOverviewWindowBox); }
private void createAndFillTreeView(Gtk.TreeView tv, treeviewType tvType, Constants.EncoderGI encoderGI, ArrayList array) { createTreeView(tv, tvType, encoderGI); TreeStore store = getStore(tvType, encoderGI); tv.Model = store; foreach (string [] line in array) { store.AppendValues(line); } }
public static void MarkAllAsUnactive(bool dbconOpened, Constants.EncoderGI encoderGI) { openIfNeeded(dbconOpened); dbcmd.CommandText = "UPDATE " + Constants.EncoderConfigurationTable + " SET active = \"False\"" + " WHERE encoderGI = \"" + encoderGI.ToString() + "\""; LogB.SQL(dbcmd.CommandText.ToString()); dbcmd.ExecuteNonQuery(); closeIfNeeded(dbconOpened); }
/* * <-------------------------- IfNameExistsAddSuffix ends */ //called on capture, recalculate, load public static void UpdateActive(bool dbconOpened, Constants.EncoderGI encoderGI, EncoderConfiguration econf) { openIfNeeded(dbconOpened); dbcmd.CommandText = "UPDATE " + Constants.EncoderConfigurationTable + " SET encoderConfiguration = \"" + econf.ToStringOutput(EncoderConfiguration.Outputs.SQL) + "\"" + " WHERE encoderGI = \"" + encoderGI.ToString() + "\"" + " AND active = \"True\""; LogB.SQL(dbcmd.CommandText.ToString()); dbcmd.ExecuteNonQuery(); closeIfNeeded(dbconOpened); }
//called on gui/encoderConfiguration.cs when click on save //also on load set public static void Update(bool dbconOpened, Constants.EncoderGI encoderGI, string oldName, EncoderConfigurationSQLObject econfSO) { openIfNeeded(dbconOpened); dbcmd.CommandText = "UPDATE " + Constants.EncoderConfigurationTable + " SET active = \"" + econfSO.active + "\", name = \"" + econfSO.name + "\", " + " encoderConfiguration = \"" + econfSO.encoderConfiguration.ToStringOutput(EncoderConfiguration.Outputs.SQL) + "\", " + " description = \"" + econfSO.description + "\"" + " WHERE name = \"" + oldName + "\" AND encoderGI = \"" + encoderGI.ToString() + "\""; LogB.SQL(dbcmd.CommandText.ToString()); dbcmd.ExecuteNonQuery(); closeIfNeeded(dbconOpened); }
//if by any bug there's no active, then create default public static EncoderConfigurationSQLObject SelectActive(Constants.EncoderGI encoderGI) { Sqlite.Open(); dbcmd.CommandText = "SELECT * FROM " + Constants.EncoderConfigurationTable + " WHERE encoderGI = \"" + encoderGI.ToString() + "\" AND active = \"True\""; LogB.SQL(dbcmd.CommandText.ToString()); dbcmd.ExecuteNonQuery(); SqliteDataReader reader; reader = dbcmd.ExecuteReader(); EncoderConfigurationSQLObject econfSO = new EncoderConfigurationSQLObject(); bool success = false; if (reader.Read()) { string [] strFull = reader[4].ToString().Split(new char[] { ':' }); EncoderConfiguration econf = new EncoderConfiguration( (Constants.EncoderConfigurationNames) Enum.Parse(typeof(Constants.EncoderConfigurationNames), strFull[0])); econf.ReadParamsFromSQL(strFull); econfSO = new EncoderConfigurationSQLObject( Convert.ToInt32(reader[0].ToString()), //uniqueID encoderGI, //encoderGI true, //active reader[3].ToString(), //name econf, //encoderConfiguration reader[5].ToString() //description ); success = true; } reader.Close(); //if by any bug there's no active, then create default and call himself again to select if (!success) { insertDefault(encoderGI); Sqlite.Close(); return(SelectActive(encoderGI)); } Sqlite.Close(); return(econfSO); }
public void PassVariables(Person currentP, Session currentS, Constants.EncoderGI eGI, Gtk.Button button_e_a, int exID, bool askDel) { RepsActive = 0; RepsAll = 0; FakeButtonDone = new Gtk.Button(); currentPerson = currentP; currentSession = currentS; encoderGI = eGI; button_encoder_analyze = button_e_a; exerciseID = exID; //can be -1 (all) askDeletion = askDel; }
//pass customName = "" to select all public static List <EncoderConfigurationSQLObject> Select(bool dbconOpened, Constants.EncoderGI encoderGI, string name) { openIfNeeded(dbconOpened); string nameStr = ""; if (name != "") { nameStr = " AND name = \"" + name + "\""; } dbcmd.CommandText = "SELECT * FROM " + Constants.EncoderConfigurationTable + " WHERE encoderGI = \"" + encoderGI.ToString() + "\"" + nameStr; LogB.SQL(dbcmd.CommandText.ToString()); dbcmd.ExecuteNonQuery(); List <EncoderConfigurationSQLObject> list = new List <EncoderConfigurationSQLObject>(); SqliteDataReader reader; reader = dbcmd.ExecuteReader(); while (reader.Read()) { string [] strFull = reader[4].ToString().Split(new char[] { ':' }); EncoderConfiguration econf = new EncoderConfiguration( (Constants.EncoderConfigurationNames) Enum.Parse(typeof(Constants.EncoderConfigurationNames), strFull[0])); econf.ReadParamsFromSQL(strFull); EncoderConfigurationSQLObject econfSO = new EncoderConfigurationSQLObject( Convert.ToInt32(reader[0].ToString()), //uniqueID encoderGI, //encoderGI reader[2].ToString() == "True", //active reader[3].ToString(), //name econf, //encoderConfiguration reader[5].ToString() //description ); list.Add(econfSO); } reader.Close(); closeIfNeeded(dbconOpened); return(list); }
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 internal static void insertDefault(Constants.EncoderGI encoderGI) { //note DefaultString will not be translated because gettext is changed after this inserts if (encoderGI == Constants.EncoderGI.GRAVITATORY) { Insert(true, new EncoderConfigurationSQLObject( -1, encoderGI, true, Constants.DefaultString, new EncoderConfiguration(), "") //LINEAR, not inertial ); } else if (encoderGI == Constants.EncoderGI.INERTIAL) { EncoderConfiguration ec = new EncoderConfiguration(Constants.EncoderConfigurationNames.ROTARYAXISINERTIAL); ec.SetInertialDefaultOptions(); Insert(true, new EncoderConfigurationSQLObject( -1, encoderGI, true, Constants.DefaultString, ec, "") ); } else { LogB.Error("SqliteEncoderConfiguration.insertDefault with an ALL erroneous value"); } }
public static ArrayList SelectSessionOverviewSets(bool dbconOpened, Constants.EncoderGI encoderGI, int sessionID) { if (!dbconOpened) { Sqlite.Open(); } dbcmd.CommandText = "SELECT person77.name, person77.sex, encoder.encoderConfiguration, encoderExercise.name, (personSession77.weight * encoderExercise.percentBodyWeight/100) + encoder.extraWeight, COUNT(*)" + " FROM person77, personSession77, encoderExercise, encoder" + " WHERE person77.uniqueID == encoder.personID AND personSession77.personID == encoder.personID AND personSession77.sessionID == encoder.sessionID AND encoderExercise.uniqueID==encoder.exerciseID AND signalOrCurve == \"signal\" AND encoder.sessionID == " + sessionID + " GROUP BY encoder.personID, exerciseID, extraWeight" + " ORDER BY person77.name"; LogB.SQL(dbcmd.CommandText.ToString()); SqliteDataReader reader; reader = dbcmd.ExecuteReader(); ArrayList array = new ArrayList(); while (reader.Read()) { //discard if != encoderGI string [] strFull = reader[2].ToString().Split(new char[] { ':' }); EncoderConfiguration econf = new EncoderConfiguration( (Constants.EncoderConfigurationNames) Enum.Parse(typeof(Constants.EncoderConfigurationNames), strFull[0])); //if encoderGI != ALL discard non wanted repetitions if (encoderGI == Constants.EncoderGI.GRAVITATORY && econf.has_inertia) { continue; } else if (encoderGI == Constants.EncoderGI.INERTIAL && !econf.has_inertia) { continue; } if (encoderGI == Constants.EncoderGI.GRAVITATORY) { string [] s = { reader[0].ToString(), //person name reader[1].ToString(), //person sex reader[3].ToString(), //encoder exercise name reader[4].ToString(), //displaced mass (includes percentBodyeight) reader[5].ToString() //sets count }; array.Add(s); } else { string [] s = { reader[0].ToString(), //person name reader[1].ToString(), //person sex reader[3].ToString(), //encoder exercise name reader[4].ToString() //sets count }; array.Add(s); } } reader.Close(); if (!dbconOpened) { Sqlite.Close(); } return(array); }
//exerciseID can be -1 to get all exercises public static ArrayList SelectCompareIntersession(bool dbconOpened, Constants.EncoderGI encoderGI, int exerciseID, int personID) { if (!dbconOpened) { Sqlite.Open(); } string exerciseIDStr = ""; if (exerciseID != -1) { exerciseIDStr = "encoder.exerciseID = " + exerciseID + " AND "; } //returns a row for each session where there are active or inactive dbcmd.CommandText = "SELECT encoder.sessionID, session.name, session.date, encoder.extraWeight, " + " SUM(CASE WHEN encoder.status = \"active\" THEN 1 END) as active, " + " SUM(CASE WHEN encoder.status = \"inactive\" THEN 1 END) as inactive," + " encoder.encoderConfiguration " + " FROM encoder, session, person77 " + " WHERE " + exerciseIDStr + " encoder.personID = " + personID + " AND signalOrCurve = \"curve\" AND " + " encoder.personID = person77.uniqueID AND encoder.sessionID = session.uniqueID " + " GROUP BY encoder.sessionID, encoder.extraWeight ORDER BY encoder.sessionID, encoder.extraWeight, encoder.status"; LogB.SQL(dbcmd.CommandText.ToString()); SqliteDataReader reader; reader = dbcmd.ExecuteReader(); ArrayList array = new ArrayList(); EncoderPersonCurvesInDB encPS = new EncoderPersonCurvesInDB(); /* * eg. * sessID|sess name|date|extraWe|a|i (a: active, i: inactive) * 20|Encoder tests|2012-12-10|7|3| * 20|Encoder tests|2012-12-10|0||9 * 20|Encoder tests|2012-12-10|10||34 * 20|Encoder tests|2012-12-10|58||1 * 20|Encoder tests|2012-12-10|61||1 * 26|sessio-proves|2013-07-08|10|5|36 * 30|proves encoder|2013-11-08|0|2| * 30|proves encoder|2013-11-08|100|5| * * convert to: * * sessID|sess name|date|a|i|reps*weights (a: active, i: inactive) * 20|Encoder tests|2012-12-10|3|45|3*7 9*0 34*10 1*58 1*61 (but sorted) * */ int sessIDDoing = -1; //of this sessionID int sessIDThisRow = -1; //of this SQL row List <EncoderPersonCurvesInDBDeep> lDeep = new List <EncoderPersonCurvesInDBDeep>(); bool firstSession = true; int activeThisRow; int inactiveThisRow; int activeThisSession = 0; int inactiveThisSession = 0; while (reader.Read()) { //discard if != encoderGI string [] strFull = reader[6].ToString().Split(new char[] { ':' }); EncoderConfiguration econf = new EncoderConfiguration( (Constants.EncoderConfigurationNames) Enum.Parse(typeof(Constants.EncoderConfigurationNames), strFull[0])); //if encoderGI != ALL discard non wanted repetitions if (encoderGI == Constants.EncoderGI.GRAVITATORY && econf.has_inertia) { continue; } else if (encoderGI == Constants.EncoderGI.INERTIAL && !econf.has_inertia) { continue; } //1 get sessionID of this row sessIDThisRow = Convert.ToInt32(reader[0].ToString()); //2 get active an inactive curves of this row activeThisRow = 0; string activeStr = reader[4].ToString(); if (Util.IsNumber(activeStr, false)) { activeThisRow = Convert.ToInt32(activeStr); } inactiveThisRow = 0; string inactiveStr = reader[5].ToString(); if (Util.IsNumber(inactiveStr, false)) { inactiveThisRow = Convert.ToInt32(inactiveStr); } //3 if session of this row is different than previous row if (sessIDThisRow != sessIDDoing) { sessIDDoing = sessIDThisRow; if (!firstSession) { //if is not first session (means we have processed a session before) //update encPS with the lDeep and then add to array encPS.lDeep = lDeep; encPS.countActive = activeThisSession; encPS.countAll = activeThisSession + inactiveThisSession; array.Add(encPS); } firstSession = false; //create new EncoderPersonCurvesInDB encPS = new EncoderPersonCurvesInDB( personID, Convert.ToInt32(reader[0].ToString()), //sessionID reader[1].ToString(), //sessionName reader[2].ToString()); //sessionDate activeThisSession = 0; inactiveThisSession = 0; //empty lDeep lDeep = new List <EncoderPersonCurvesInDBDeep>(); } //4 add deep info: (weight, all reps) EncoderPersonCurvesInDBDeep deep = new EncoderPersonCurvesInDBDeep( Convert.ToDouble(Util.ChangeDecimalSeparator(reader[3].ToString())), activeThisRow + inactiveThisRow); //add to lDeep lDeep.Add(deep); activeThisSession += activeThisRow; inactiveThisSession += inactiveThisRow; } //store last row in array (once we are out the while) if (!firstSession) { //if is not first session (means we have processed a session before) //update encPS with the lDeep and then add to array encPS.lDeep = lDeep; encPS.countActive = activeThisSession; encPS.countAll = activeThisSession + inactiveThisSession; array.Add(encPS); } reader.Close(); if (!dbconOpened) { Sqlite.Close(); } return(array); }
//pass uniqueID value and then will return one record. do like this: //EncoderSQL eSQL = (EncoderSQL) SqliteEncoder.Select(false, myUniqueID, 0, 0, 0, "", EncoderSQL.Eccons.ALL, false, true)[0]; //WARNING because SqliteEncoder.Select may not return nothing, and then cannot be assigned to eSQL //see: delete_encoder_curve(bool dbconOpened, int uniqueID) //don't care for the 0, 0, 0 because selection will be based on the myUniqueID and only one row will be returned //or //pass uniqueID==-1 and personID, sessionID, signalOrCurve values, and will return some records //personID can be -1 to get all on that session //sessionID can be -1 to get all sessions //exerciseID can be -1 to get all exercises //signalOrCurve can be "all" //orderIDascendent is good for all the situations except when we want to convert from 1.05 to 1.06 //in that conversion, we want first the last ones, and later the previous // (to delete them if they are old copies) public static ArrayList Select( bool dbconOpened, int uniqueID, int personID, int sessionID, Constants.EncoderGI encoderGI, int exerciseID, string signalOrCurve, EncoderSQL.Eccons ecconSelect, bool onlyActive, bool orderIDascendent) { if (!dbconOpened) { Sqlite.Open(); } string personIDStr = ""; if (personID != -1) { personIDStr = " personID = " + personID + " AND "; } string sessionIDStr = ""; if (sessionID != -1) { sessionIDStr = " sessionID = " + sessionID + " AND "; } string exerciseIDStr = ""; if (exerciseID != -1) { exerciseIDStr = " exerciseID = " + exerciseID + " AND "; } string selectStr = ""; if (uniqueID != -1) { selectStr = Constants.EncoderTable + ".uniqueID = " + uniqueID; } else { if (signalOrCurve == "all") { selectStr = personIDStr + sessionIDStr + exerciseIDStr; } else { selectStr = personIDStr + sessionIDStr + exerciseIDStr + " signalOrCurve = \"" + signalOrCurve + "\""; } if (ecconSelect != EncoderSQL.Eccons.ALL) { selectStr += " AND " + Constants.EncoderTable + ".eccon = \"" + EncoderSQL.Eccons.ecS.ToString() + "\""; } } string andString = ""; if (selectStr != "") { andString = " AND "; } string onlyActiveString = ""; if (onlyActive) { onlyActiveString = " AND " + Constants.EncoderTable + ".status = \"active\" "; } string orderIDstr = ""; if (!orderIDascendent) { orderIDstr = " DESC"; } dbcmd.CommandText = "SELECT " + Constants.EncoderTable + ".*, " + Constants.EncoderExerciseTable + ".name FROM " + Constants.EncoderTable + ", " + Constants.EncoderExerciseTable + " WHERE " + selectStr + andString + Constants.EncoderTable + ".exerciseID = " + Constants.EncoderExerciseTable + ".uniqueID " + onlyActiveString + " ORDER BY substr(filename,-23,19), " + //'filename,-23,19' has the date of capture signal "uniqueID " + orderIDstr; LogB.SQL(dbcmd.CommandText.ToString()); SqliteDataReader reader; reader = dbcmd.ExecuteReader(); ArrayList array = new ArrayList(1); EncoderSQL es = new EncoderSQL(); while (reader.Read()) { string [] strFull = reader[15].ToString().Split(new char[] { ':' }); EncoderConfiguration econf = new EncoderConfiguration( (Constants.EncoderConfigurationNames) Enum.Parse(typeof(Constants.EncoderConfigurationNames), strFull[0])); econf.ReadParamsFromSQL(strFull); //if encoderGI != ALL discard non wanted repetitions if (encoderGI == Constants.EncoderGI.GRAVITATORY && econf.has_inertia) { continue; } else if (encoderGI == Constants.EncoderGI.INERTIAL && !econf.has_inertia) { continue; } LogB.Debug("EncoderConfiguration = " + econf.ToStringOutput(EncoderConfiguration.Outputs.SQL)); //if there's no video, will be "". //if there's video, will be with full path string videoURL = ""; if (reader[14].ToString() != "") { videoURL = addURLpath(fixOSpath(reader[14].ToString())); } //LogB.SQL(econf.ToString(":", true)); es = new EncoderSQL( reader[0].ToString(), //uniqueID Convert.ToInt32(reader[1].ToString()), //personID Convert.ToInt32(reader[2].ToString()), //sessionID Convert.ToInt32(reader[3].ToString()), //exerciseID reader[4].ToString(), //eccon Catalog.GetString(reader[5].ToString()), //laterality reader[6].ToString(), //extraWeight reader[7].ToString(), //signalOrCurve reader[8].ToString(), //filename addURLpath(fixOSpath(reader[9].ToString())), //url Convert.ToInt32(reader[10].ToString()), //time Convert.ToInt32(reader[11].ToString()), //minHeight reader[12].ToString(), //description reader[13].ToString(), //status videoURL, //videoURL econf, //encoderConfiguration Util.ChangeDecimalSeparator(reader[16].ToString()), //future1 (meanPower on curves) reader[17].ToString(), //future2 reader[18].ToString(), //future3 reader[19].ToString() //EncoderExercise.name ); array.Add(es); } reader.Close(); if (!dbconOpened) { Sqlite.Close(); } return(array); }
public static ArrayList SelectSessionOverviewReps(bool dbconOpened, Constants.EncoderGI encoderGI, int sessionID) { if (!dbconOpened) { Sqlite.Open(); } dbcmd.CommandText = "SELECT person77.name, person77.sex, encoder.encoderConfiguration, encoderExercise.name, encoder.extraWeight, encoder.future1 " + "FROM person77, encoderExercise, encoder " + "WHERE sessionID = " + sessionID.ToString() + " AND signalOrCurve = \"curve\" " + " AND person77.uniqueID = encoder.personID " + " AND encoderExercise.uniqueID = encoder.exerciseID " + " ORDER BY person77.name"; LogB.SQL(dbcmd.CommandText.ToString()); SqliteDataReader reader; reader = dbcmd.ExecuteReader(); ArrayList array = new ArrayList(); while (reader.Read()) { //discard if != encoderGI string [] strFull = reader[2].ToString().Split(new char[] { ':' }); EncoderConfiguration econf = new EncoderConfiguration( (Constants.EncoderConfigurationNames) Enum.Parse(typeof(Constants.EncoderConfigurationNames), strFull[0])); //if encoderGI != ALL discard non wanted repetitions if (encoderGI == Constants.EncoderGI.GRAVITATORY && econf.has_inertia) { continue; } else if (encoderGI == Constants.EncoderGI.INERTIAL && !econf.has_inertia) { continue; } if (encoderGI == Constants.EncoderGI.GRAVITATORY) { string [] s = { reader[0].ToString(), //person name reader[1].ToString(), //person sex reader[3].ToString(), //encoder exercise name reader[4].ToString(), //extra mass reader[5].ToString() //power }; array.Add(s); } else { string [] s = { reader[0].ToString(), //person name reader[1].ToString(), //person sex reader[3].ToString(), //encoder exercise name reader[5].ToString() //power }; array.Add(s); } } reader.Close(); if (!dbconOpened) { Sqlite.Close(); } return(array); }