private void loadDo() { TreeModel model; TreeIter iter; if (treeview_load.Selection.GetSelected(out model, out iter)) { int uniqueID = UtilGtk.GetSelectedRowUniqueID( treeview_load, store_load, store_load_uniqueID_col); if (uniqueID > 0) { ExecuteAutoSQL eaSQL = SqliteExecuteAuto.Select(false, uniqueID)[0]; foreach (int i in eaSQL.Serie1IDs) { button_simulate_exercise_clicked(i, 1); //first treeview } mode = eaSQL.Mode; if (mode == ExecuteAuto.ModeTypes.BY_SETS) { foreach (int i in eaSQL.Serie2IDs) { button_simulate_exercise_clicked(i, 2); } foreach (int i in eaSQL.Serie3IDs) { button_simulate_exercise_clicked(i, 3); } } } } }
/* * class methods */ public static void Insert(bool dbconOpened, ExecuteAutoSQL eaSQL) { if (!dbconOpened) { Sqlite.Open(); } dbcmd.CommandText = "INSERT INTO " + Constants.ExecuteAutoTable + " (uniqueID, name, mode, description, " + " serie1IDs, serie2IDs, serie3IDs, " + " future1, future2, future3)" + " VALUES ( NULL, \"" + eaSQL.name + "\", \"" + eaSQL.Mode.ToString() + "\", \"" + eaSQL.Description + "\", \"" + eaSQL.SerieIDsToStr(eaSQL.Serie1IDs) + "\", \"" + eaSQL.SerieIDsToStr(eaSQL.Serie2IDs) + "\", \"" + eaSQL.SerieIDsToStr(eaSQL.Serie3IDs) + "\", " + "\"\", \"\", \"\")"; //future1, future2, future3 LogB.SQL(dbcmd.CommandText.ToString()); dbcmd.ExecuteNonQuery(); if (!dbconOpened) { Sqlite.Close(); } }
private void on_button_save_clicked(object o, EventArgs args) { ExecuteAutoSQL eaSQL = new ExecuteAutoSQL(-1, entry_save_name.Text.ToString(), mode, entry_save_description.Text.ToString(), getTrComboInts(treeviewSerie1Array), getTrComboInts(treeviewSerie2Array), getTrComboInts(treeviewSerie3Array)); bool saved = eaSQL.SaveToSQL(); if (saved) { new DialogMessage(Constants.MessageTypes.INFO, Catalog.GetString("Saved")); } else { new DialogMessage(Constants.MessageTypes.WARNING, String.Format(Catalog.GetString("Sorry, this sequence '{0}' already exists in database"), eaSQL.name)); } }
//uniqueID == -1 selects all ExecuteAutoSQLs //uniqueID > 0 selects one ExecuteAutoSQL public static List <ExecuteAutoSQL> Select(bool dbconOpened, int uniqueID) { if (!dbconOpened) { Sqlite.Open(); } string whereStr = ""; if (uniqueID != -1) { whereStr = " WHERE uniqueID == " + uniqueID; } dbcmd.CommandText = "SELECT * from " + Constants.ExecuteAutoTable + whereStr; LogB.SQL(dbcmd.CommandText.ToString()); SqliteDataReader reader; reader = dbcmd.ExecuteReader(); List <ExecuteAutoSQL> sequences = new List <ExecuteAutoSQL>(); int i; while (reader.Read()) { i = 0; ExecuteAutoSQL eaSQL = new ExecuteAutoSQL( Convert.ToInt32(reader[i++].ToString()), //uniqueID reader[i++].ToString(), //name (ExecuteAuto.ModeTypes)Enum.Parse(typeof(ExecuteAuto.ModeTypes), reader[i++].ToString()), //mode reader[i++].ToString(), //description ExecuteAutoSQL.SerieIDsFromStr(reader[i++].ToString()), //serie1IDs ExecuteAutoSQL.SerieIDsFromStr(reader[i++].ToString()), //serie2IDs ExecuteAutoSQL.SerieIDsFromStr(reader[i++].ToString()) //serie3IDs ); sequences.Add(eaSQL); } reader.Close(); if (!dbconOpened) { Sqlite.Close(); } return(sequences); }
/* * class methods */ public static void Insert(bool dbconOpened, ExecuteAutoSQL eaSQL) { if(! dbconOpened) Sqlite.Open(); dbcmd.CommandText = "INSERT INTO " + Constants.ExecuteAutoTable + " (uniqueID, name, mode, description, " + " serie1IDs, serie2IDs, serie3IDs, " + " future1, future2, future3)" + " VALUES ( NULL, \"" + eaSQL.name + "\", \"" + eaSQL.Mode.ToString() + "\", \"" + eaSQL.Description + "\", \"" + eaSQL.SerieIDsToStr(eaSQL.Serie1IDs) + "\", \"" + eaSQL.SerieIDsToStr(eaSQL.Serie2IDs) + "\", \"" + eaSQL.SerieIDsToStr(eaSQL.Serie3IDs) + "\", " + "\"\", \"\", \"\")"; //future1, future2, future3 LogB.SQL(dbcmd.CommandText.ToString()); dbcmd.ExecuteNonQuery(); if(! dbconOpened) Sqlite.Close(); }
private void on_button_save_clicked(object o, EventArgs args) { ExecuteAutoSQL eaSQL = new ExecuteAutoSQL(-1, entry_save_name.Text.ToString(), mode, entry_save_description.Text.ToString(), getTrComboInts(treeviewSerie1Array), getTrComboInts(treeviewSerie2Array), getTrComboInts(treeviewSerie3Array)); bool saved = eaSQL.SaveToSQL(); if(saved) new DialogMessage(Constants.MessageTypes.INFO, Catalog.GetString("Saved")); else new DialogMessage(Constants.MessageTypes.WARNING, String.Format(Catalog.GetString("Sorry, this sequence '{0}' already exists in database"), eaSQL.name)); }
//uniqueID == -1 selects all ExecuteAutoSQLs //uniqueID > 0 selects one ExecuteAutoSQL public static List<ExecuteAutoSQL> Select(bool dbconOpened, int uniqueID) { if(! dbconOpened) Sqlite.Open(); string whereStr = ""; if(uniqueID != -1) whereStr = " WHERE uniqueID == " + uniqueID; dbcmd.CommandText = "SELECT * from " + Constants.ExecuteAutoTable + whereStr; LogB.SQL(dbcmd.CommandText.ToString()); SqliteDataReader reader; reader = dbcmd.ExecuteReader(); List<ExecuteAutoSQL> sequences = new List<ExecuteAutoSQL>(); int i; while(reader.Read()) { i=0; ExecuteAutoSQL eaSQL = new ExecuteAutoSQL( Convert.ToInt32(reader[i++].ToString()), //uniqueID reader[i++].ToString(), //name (ExecuteAuto.ModeTypes) Enum.Parse(typeof(ExecuteAuto.ModeTypes), reader[i++].ToString()), //mode reader[i++].ToString(), //description ExecuteAutoSQL.SerieIDsFromStr(reader[i++].ToString()), //serie1IDs ExecuteAutoSQL.SerieIDsFromStr(reader[i++].ToString()), //serie2IDs ExecuteAutoSQL.SerieIDsFromStr(reader[i++].ToString()) //serie3IDs ); sequences.Add(eaSQL); } reader.Close(); if(! dbconOpened) Sqlite.Close(); return sequences; }