public void cargarDatos(dbAccess dbacces) { SaveGameManager sgm = new SaveGameManager(); dbacces.OpenReadDB(); sgm = dbacces.sgm; #region CargaArma controlLogico.SetArmas(sgm.ControlLogico.GetArmas()); #endregion #region CargarEscenarios controlLogico.SetListEscenario(sgm.ControlLogico.GetListEscenario()); #endregion #region CargaMembrecias controlLogico.SetMembresia(sgm.ControlLogico.GetMembresia()); #endregion #region cargaPuntuacion controlLogico.SetPuntuacion(sgm.ControlLogico.GetPuntuacion()); #endregion #region cargaPersonajes personajes = sgm.Personajes; #endregion }
// Use this for initialization void Start() { resultado.text = " "; // Retrieve next word from database description = "something went wrong with the database"; db = GetComponent <dbAccess>(); if (!System.IO.File.Exists(Application.persistentDataPath + "/" + "InGame.db")) { db.OpenDB("InGame.db"); } else { db.OpenDB("InGame.db"); } //reader = db.BasicQuery("drop table if exists users"); reader = db.BasicQuery("SELECT name FROM sqlite_master WHERE type = 'table' AND name = 'users';"); string[] col = { "kp", "nombre", "pw" }; string[] colType = { "integer primary key autoincrement", "text", "text" }; if (!db.CreateTable("users", col, colType)) { Debug.Log("Error creating table"); } db.CloseDB(); }
public ArrayList ReadDBDataFromRound(int ID) { Debug.Log("Reading Data by round_id"); ArrayList balls = new ArrayList(); dbAccess db = GetComponent <dbAccess>(); db.OpenDB("VBBS.db"); // SELECT * FROM ball where match_id = 1 // "ID, time, start_X, start_Y, end_X, end_Y, attacker, team_player, enemy_player, skill, good, score, score_reason, team_change, team_switch, team_position, team_score, enemy_score, enemy_change, enemy_switch, enemy_position, match_ID" IDataReader reader = db.BasicQuery("SELECT attacker, team_player, enemy_player, skill, good, score, score_reason FROM balls where round_ID =" + ID); string path = "Assets/Resources/test.txt"; // Write some text to the test.txt file System.IO.StreamWriter writer = new System.IO.StreamWriter(path, true); while (reader.Read()) { Ball b = new Ball(reader.GetInt32(0), reader.GetInt32(1), reader.GetInt32(2), reader.GetInt32(3), reader.GetInt32(4), reader.GetInt32(5), reader.GetInt32(6)); string l = "attacker: " + b.attacker + " ,teamplayer: " + b.team_player + ",enemyplayer: " + b.enemy_player + ",skill: " + b.skill + ",good: " + b.good + ",score: " + b.score + ",reason: " + b.score_reason; writer.WriteLine(l); balls.Add(b); } writer.Close(); db.CloseDB(); Debug.Log("Total Ball Count: " + balls.Count); return(balls); }
public bool CreateShortURLRegister(string urlOriginal, string urlShort, string alias, int isAliasAutomatic) { string sql = string.Empty; dbAccess db = new dbAccess(); sql += "INSERT INTO tblShortURL "; sql += "( "; sql += "OriginalURL "; sql += ", ShortURL "; sql += ", alias "; sql += ", isAutomaticAlias "; sql += ", dtCreation "; sql += ") "; sql += "VALUES "; sql += "( "; sql += "@OriginalURL "; sql += ", @ShortURL "; sql += ", @alias "; sql += ", @isAutomaticAlias "; sql += ", GETDATE() "; sql += "); "; sql += "SELECT 100 AS RETORNO; "; return(db.TrataRetorno(db.SelectAccessDBSqlServer(sql, _configuration.GetConnectionString("DefaultConnection").ToString(), new SqlParameter("@OriginalURL", urlOriginal.Trim()), new SqlParameter("@ShortURL", urlShort.Trim()), new SqlParameter("@alias", alias), new SqlParameter("@isAutomaticAlias", isAliasAutomatic)))); }
public void createNewUser(string userName, string password) { // Give ourselves a dbAccess object to work with, and open it db = new dbAccess(); db.OpenDB(DatabaseName); // Let's make sure we've got a table to work with as well! string tableName = TableName; var columnNames = new ArrayList(); columnNames.Add(userNameKey); columnNames.Add(passwordKey); columnNames.Add(serializedDataKey); var columnValues = new ArrayList(); columnValues.Add(userName); columnValues.Add(password); columnValues.Add(DEFAULT_NEW_SAVE); try { if (!userName.Equals("") && password.Length >= MIN_PASS_LENGTH) { db.Insert(tableName, columnNames, columnValues); } else { errorLabelScript.text = "Could not create new user"; } } catch (Exception e) { // Do nothing - our table was already created Debug.Log(e.Message); errorLabelScript.text = "User already exists in system"; } // createUser = false; }
public bool ValidaRFC(int Id_Acr, string Acr_RFC, string Conexion) { bool Result = false; using (dbAccess oDB = new dbAccess(Conexion)) { try { Result = (bool)oDB.spExecScalar( "spCatAcreedor_ValidaRFC", new SqlParameter("@Id_Acr", Id_Acr), new SqlParameter("@Acr_RFC", Acr_RFC) ); } catch (Exception ex) { throw ex; } finally { oDB.Dispose(); } } return(Result); }
public void InfoCardOnClick() { db = GameObject.Find("database").GetComponent <dbAccess>(); msg = GameObject.Find("EngineMain").GetComponent <MainEngine>(); session_id = GameObject.Find("EventSystem").GetComponent <StartGame>().active_session_id; infonumber = db.BasicQuery("SELECT COUNT(id) FROM tbl_Info_Card;"); infonumber.Read(); maxNumbers = infonumber.GetInt32(0); maxNumbers = checkmaxnumber(maxNumbers, 12); int selectednumber = EventSystem.current.currentSelectedGameObject.GetComponent <value>().no_card; string selectedbutton = EventSystem.current.currentSelectedGameObject.name; GameObject.Find("CardBackgroundi").GetComponent <RectTransform>().localPosition = new Vector3(posopencard(selectedbutton), -80, 0); ArrayList result = db.SingleSelectWhere("tbl_Info_Card", "*", "id", "=", selectednumber.ToString()); desc = ((string[])result[0])[1]; reward = "$2"; correctanswer = ((string[])result[0])[2]; GameObject.Find("Content").GetComponent <Text> ().text = desc; GameObject.Find("Reward").GetComponent <Text> ().text = reward; showcard(); }
void newQuestion() { answerResultWindow.SetActive(false); Question q = new Question(); if (Application.platform == RuntimePlatform.WebGLPlayer) { FetchQuestion(); q.QuestionText = node.ChildNodes[1].InnerText; q.CorrectAnswer = node.ChildNodes[2].InnerText; q.WrongAnswer1 = node.ChildNodes[3].InnerText; q.WrongAnswer2 = node.ChildNodes[4].InnerText; q.WrongAnswer3 = node.ChildNodes[5].InnerText; q.SubmissionName = node.ChildNodes[6].InnerText; q.Passage = node.ChildNodes[7].InnerText; } else { dbAccess db = GetComponent <dbAccess>(); db.OpenDB("Questions.db"); ArrayList result = db.RandomSelect("QUESTIONS", "*"); string[] s = ((string[])result[0]); q.QuestionText = s[1]; q.CorrectAnswer = s[2]; q.WrongAnswer1 = s[3]; q.WrongAnswer2 = s[4]; q.WrongAnswer3 = s[5]; q.SubmissionName = s[6]; q.Passage = s[7]; db.CloseDB(); } question = q; questionObj.GetComponent <Text>().text = question.QuestionText; List <string> answerList = new List <string>(); answerList.Add(question.CorrectAnswer); answerList.Add(question.WrongAnswer1); answerList.Add(question.WrongAnswer2); answerList.Add(question.WrongAnswer3); Shuffle(answerList); setupAnswerButton(button1Text, button1, answerList[0], question.CorrectAnswer); setupAnswerButton(button2Text, button2, answerList[1], question.CorrectAnswer); setupAnswerButton(button3Text, button3, answerList[2], question.CorrectAnswer); setupAnswerButton(button4Text, button4, answerList[3], question.CorrectAnswer); if (question.SubmissionName != null && question.SubmissionName != "") { submissionName.GetComponent <Text>().text = question.SubmissionName; } else { submissionName.GetComponent <Text>().text = "Anonymous"; } }
void Start() { GameObject.Find("MenuScreen").GetComponent <Canvas>().sortingOrder = 0; GameObject.Find("SettingPanel").GetComponent <Canvas>().sortingOrder = 1; db = GameObject.Find("database").GetComponent <dbAccess>(); db.OpenDB("mydb.sdb"); GameObject.Find("err").GetComponent <Text> ().text = db.err; }
void Start() { db = GetComponent <dbAccess>(); nextIncrement = 0; dataHandler = GameObject.Find("DataHandler"); ino = dataHandler.GetComponent <inventory>(); dicForCompare = ino.dic; nextIncrement = ino.count; }
// Use this for initialization to connect database void Start() { //Load required scenes for the games SceneManager.UnloadScene("New"); setassetscene(); //get values of active session and number of active players activesessionid = GameObject.Find("EventSystem").GetComponent <StartGame>().active_session_id; avataractive = GameObject.Find("EventSystem").GetComponent <StartGame>().avataractive; //db = GetComponent<dbAccess>(); db = GameObject.Find("database").GetComponent <dbAccess>(); db.OpenDB("mydb.sdb"); ArrayList result = db.SelectLastRecord("id", "tbl_Sessions"); session_id = ((string[])result[0])[0]; //Set active_session_id on EventSystem to be used laterduring the game GameObject.Find("EventSystem").GetComponent <StartGame>().active_session_id = session_id; //this function is to insert history into table hismsg = "Game Starts"; db.InsertHistory(hismsg, session_id); HistPrint("-"); HistPrint("-"); HistPrint(hismsg); totplayeractive = db.BasicQuery("SELECT COUNT(id) FROM tbl_players WHERE tbl_Sessions_id=" + session_id); totplayeractive.Read(); totnumplayeractive = totplayeractive.GetInt32(0); playernumber = db.BasicQuery("SELECT id FROM tbl_players WHERE tbl_Sessions_id=" + session_id); playernum = new ArrayList(); while (playernumber.Read()) { for (var i = 0; i < playernumber.FieldCount; i++) { playernum.Add(playernumber.GetValue(i)); // This reads the entries in a row } } avatarnumber = db.BasicQuery("SELECT avatar_number FROM tbl_players WHERE tbl_Sessions_id=" + session_id); avatarnum = new ArrayList(); while (avatarnumber.Read()) { for (var k = 0; k < avatarnumber.FieldCount; k++) { avatarnum.Add(avatarnumber.GetValue(k)); // This reads the entries in a row } } disableandenabletab(); disableandenabletab2(); PlayerOnClick(1); GameObject.Find("BtnPlayer" + nextactive).GetComponent <Image>().color = Color.blue; PlayerNameActive = GameObject.Find("numPlayerName").GetComponent <Text>().text; }
// This function will insert our calibration data points as a row in the calibration database table void SaveData() { // Instantiate instance of db access controller and open up our database db_control = new dbAccess (); db_control.OpenDB (); db_control.InsertInto(right_calibration_table, rightCalibrationPoints); db_control.InsertInto(left_calibration_table, leftCalibrationPoints); db_control.CloseDB (); }
// Use this for initialization void Start() { Debug.Log("starting SQLiteLoad app"); // Retrieve next word from database description = "something went wrong with the database"; db = new dbAccess(); if (db != null) { db.OpenDB("word.db"); System.Data.IDataReader reader = db.BasicQuery("SELECT * FROM words"); //System.Collections.Generic.List<string> reader = db.getWords(); if (reader != null) { description = ""; string water = "\u6C34"; //string disaster = "\u707D"; Word d = db.getWord(water); if (d != null) { description = "it works!"; } else { description = water; } /* * while(reader.Read()){ * description += reader.GetString(0) + " "; * description += reader.GetString(1) + " "; * description += reader.GetInt32(2) + " "; * string t = (string)reader.GetValue(3); * if(t == null) description +="NULL "; * else description += t + " "; * //description += reader.GetValue(3) + " "; * description += reader.GetValue(4) + " "; * description += reader.GetValue(5) + " "; * description += reader.GetValue(6) + " "; * description += reader.GetValue(7) + " "; * description += reader.GetValue(8) + " "; * /*for(int i=0; i<reader.FieldCount;i++){ * description += reader.GetString(i) + "\t"; * }//*/ // description += "\n"; //} } } else { toggle = true; } DontDestroyOnLoad(gameObject); }
// void OnGUI() { // GUI.Window (0, new Rect (Screen.width / 4, Screen.height / 4, Screen.width / 2, Screen.height / 2 - 70), LoginWindow, "Login"); // if (login){ // loginUser (); // } // if (createUser){ // createNewUser (); // } // } void createTable(dbAccess db, string tableName, ArrayList columnNames, ArrayList columnValues) { db.OpenDB(DatabaseName); try{ db.CreateTable(tableName, columnNames, columnValues); Debug.Log("Created DB table"); } catch (Exception e) { Debug.Log(TableName + " already exists."); } }
public void DeleteMatch() { dbAccess db = GetComponent <dbAccess>(); db.OpenDB("VBBS.db"); IDataReader reader = db.BasicQuery("DELETE from matches WHERE ID = " + match_id); db.CloseDB(); }
void Start() { tabInt = 0; statsSwitch = 0; if (LoginScreen.currentID > 0) { db = new dbAccess(); db.OpenDB(dbName); } }
public void SetRoundScore(int teamScore, int enemyScore) { Debug.Log("Round has ended"); dbAccess db = GetComponent <dbAccess>(); db.OpenDB("VBBS.db"); db.BasicQuery("UPDATE rounds SET team_score = " + teamScore + ", enemy_score = " + enemyScore + " WHERE round_id = " + round_id); db.CloseDB(); }
// Use this for initialization void Start() { catchCount = 0; user_id = PlayerPrefs.GetInt ("ActiveUser"); scores_table = PlayerPrefs.GetString ("ScoresTable"); db_name = PlayerPrefs.GetString ("DBName"); userid_field = "user_id"; time_field = "reachback_time"; count_field = "reachback_count"; db_control = new dbAccess (); }
public int GetRoundIDFromMatch(int ID) { dbAccess db = GetComponent <dbAccess>(); db.OpenDB("VBBS.db"); IDataReader reader = db.BasicQuery("Select ID from rounds WHERE match_id = " + ID); reader.Read(); return(reader.GetInt32(0)); }
public void ProblemCardOnClick() { db = GameObject.Find("database").GetComponent <dbAccess>(); msg = GameObject.Find("EngineMain").GetComponent <MainEngine>(); session_id = GameObject.Find("EventSystem").GetComponent <StartGame>().active_session_id; string selectedbutton = EventSystem.current.currentSelectedGameObject.name; GameObject.Find("CardBackgroundP").GetComponent <RectTransform>().localPosition = new Vector3(posopencard(selectedbutton), -80, 0); GameObject.Find("CardBackgroundP").GetComponent <Image>().enabled = true; }
// Use this for initialization void Start() { sampler = new JointSampler (); user_id = PlayerPrefs.GetInt ("ActiveUser", 1); // Load ZigFu game object. This game object has 4 Zig related script Components. Use this object // to instances of these script's classes in order to access event information :) zigfu = GameObject.Find ("ZigFu"); zig_control = zigfu.GetComponent <Zig>(); skeleton = GetComponent <ZigSkeleton>(); db_control = new dbAccess (); reader = new GloveReader (); }
public bool AliasExists(string alias) { string sql = string.Empty; dbAccess db = new dbAccess(); sql += "SELECT COUNT(*) AS QTD "; sql += "FROM tblShortURL "; sql += "WHERE alias = @alias "; return(db.TrataExists(db.SelectAccessDBSqlServer(sql, _configuration.GetConnectionString("DefaultConnection").ToString(), new SqlParameter("@alias", alias)))); }
public void loginUser(string userName, string password) { Debug.Log(userName + ": " + password); // Give ourselves a dbAccess object to work with, and open it db = new dbAccess(); db.OpenDB(DatabaseName); // Let's make sure we've got a table to work with as well! string tableName = TableName; string readValue = null; try { if (!userName.Equals("")) { Debug.Log(db.ReadColumn(passwordKey, tableName, userNameKey, userName)); if (password.Equals(db.ReadColumn(passwordKey, tableName, userNameKey, userName))) { readValue = db.ReadColumn(serializedDataKey, tableName, userNameKey, userName); Debug.Log(readValue); } else { Debug.Log("Password did not match."); errorLabelScript.text = "Password is incorrect."; } } else { Debug.Log("Please enter a valid user in the DB."); errorLabelScript.text = "Incorrect Username/Password"; } } catch (Exception e) { // Do nothing - our table was already created Debug.Log(e.Message); } if (readValue != null) { if (readValue.Equals("NEW GAME")) { setLoginInfo(userName, DatabaseName, tableName, readValue); eventHandlerScript.StartNewGame(); } else { setLoginInfo(userName, DatabaseName, tableName, readValue); eventHandlerScript.LoadGame(readValue); } } else { errorLabelScript.text = "User does not exist"; } }
// Use this for initialization public void LoadInfoScene() { hideinfocard(); db = GameObject.Find("database").GetComponent <dbAccess>(); infonumber = db.BasicQuery("SELECT COUNT(id) FROM tbl_Info_Card;"); infonumber.Read(); maxNumbers = infonumber.GetInt32(0); //Debug.Log (maxNumbers); uniqueNumber = new List <int>(); finishedList = new List <int>(); AssignedValue(); }
// Use this for initialization void Start() { dbAccess db = GetComponent <dbAccess>(); db.OpenDB("game.db"); count = db.getCount("loadCount", "id", "count"); db.CloseDB(); last = count + 5; db.updatetData("loadCount", "count", last); db.CloseDB(); }
public GloveReader() { init = true; RightIsGrab = false; LeftIsGrab = false; // Instantiate database access object db_control = new dbAccess(); // Read from global user id: user_id = ... // Get active user from player prefs. Use default user 1 if no active user is set active_user = PlayerPrefs.GetInt("ActiveUser", 1); Debug.Log ("Glove reader sees active user: " + active_user); allFingerZones = readDB (active_user); rightFingerZones = (int[]) allFingerZones [0]; leftFingerZones = (int[]) allFingerZones [1]; }
void Start() { loginInfoScript = user.GetComponent <LoginInfo> (); eventHandlerScript = eventHandler.GetComponent <EventHandler> (); errorLabelScript = errorLabel.GetComponent <UILabel> (); db = new dbAccess(); columnNames = new ArrayList(); columnNames.Add(userNameKey); columnNames.Add(passwordKey); columnNames.Add(serializedDataKey); var columnValues = new ArrayList(); columnValues.Add("TEXT PRIMARY KEY NOT NULL"); columnValues.Add("TEXT NOT NULL CHECK (length(" + passwordKey + ") >= " + MIN_PASS_LENGTH + ")"); columnValues.Add("VARCHAR(25000) NOT NULL DEFAULT ''"); createTable(db, TableName, columnNames, columnValues); }
// Use this for initialization void Start () { Uid = ""; isDebug = false; checkUpdate = true; loadTime = 0; db = GetComponent<dbAccess>(); createDb (); haveInet = false; checkConnection (); Screen.sleepTimeout = SleepTimeout.NeverSleep; DontDestroyOnLoad (transform.gameObject); if (Uid == "") { if (PlayerPrefs.HasKey ("Uid")) { Uid = PlayerPrefs.GetString ("Uid"); } else { Uid = SystemInfo.deviceUniqueIdentifier; PlayerPrefs.SetString ("Uid", Uid); } } if (!PlayerPrefs.HasKey ("config_alerts")) { PlayerPrefs.SetString ("config_alerts", "true"); } else { string config_alerts = PlayerPrefs.GetString ("config_alerts"); if(config_alerts == "false"){ notificationsScript.disableNotifs(); } } StartCoroutine (call_sync()); StartCoroutine (get_updates ()); //ej sync: /*string[] fields = {"puntos", "kilometros", "perros_id", "usuarios_id"}; string[] values = {"100", "150", "454545" , "3"}; insert_sync(fields, values, "perros_puntos");*/ //PlayerPrefs.DeleteAll (); }
public ArrayList GetAllRound() { dbAccess db = GetComponent <dbAccess>(); db.OpenDB("VBBS.db"); IDataReader reader = db.BasicQuery("Select * from rounds"); ArrayList rounds = new ArrayList(); while (reader.Read()) { int id = reader.GetInt32(0); rounds.Add(id); } db.CloseDB(); return(rounds); }
public void InsertNewRound() { dbAccess db = GetComponent <dbAccess>(); db.OpenDB("VBBS.db"); string attr = "team_score, enemy_score, match_ID"; string values = "0,0," + match_id; db.BasicQuery("INSERT INTO rounds (" + attr + ") values (" + values + ")"); IDataReader reader = db.BasicQuery("SELECT last_insert_rowid();"); if (reader.Read()) { round_id = reader.GetInt32(0); } db.CloseDB(); }
public void InsertNewMatch(string date, string time, string location, string name, string team, string enemy, int matchStyle, int ruleStyle) { dbAccess db = GetComponent <dbAccess>(); db.OpenDB("VBBS.db"); string attr = "date, time, location, name, team, enemy, matchStyle, ruleStyle"; string values = "'" + date + "','" + time + "','" + location + "','" + name + "','" + team + "','" + enemy + "'," + matchStyle + "," + ruleStyle; db.BasicQuery("INSERT INTO matches (" + attr + ") values (" + values + ")"); IDataReader reader = db.BasicQuery("SELECT last_insert_rowid();"); if (reader.Read()) { match_id = reader.GetInt32(0); } db.CloseDB(); }
public void cargarDatos(dbAccess dbacces) { SaveGameManager sgm = new SaveGameManager(); dbacces.OpenReadDB(); sgm = dbacces.Sgm; #region CargaArma controlLogico.SetArmas(sgm.ControlLogico.GetArmas()); #endregion #region CargarEscenarios controlLogico.SetListEscenario(sgm.ControlLogico.GetListEscenario()); #endregion #region CargaMembrecias controlLogico.SetMembresia(sgm.ControlLogico.GetMembresia()); #endregion #region cargaPuntuacion controlLogico.SetPuntuacion(sgm.ControlLogico.GetPuntuacion()); #endregion #region cargaPersonajes personajes = sgm.Personajes; #endregion #region Idioma lenguaje = sgm.Lenguaje; #endregion #region Navegacion navegacion = sgm.Navegacion; #endregion }
public bool RemoveLastBall() { if (last_ball_id == -1) { return(false); } dbAccess db = GetComponent <dbAccess>(); db.OpenDB("VBBS.db"); IDataReader reader = db.BasicQuery("SELECT score FROM balls WHERE ID = " + last_ball_id); int score = 0; while (reader.Read()) { score = reader.GetInt32(0); } if (score == 1) { model.team_score--; Text txt = scoreA.GetComponent <Text>(); txt.text = model.team_score.ToString(); } else if (score == 2) { model.enemy_score--; Text txt = scoreB.GetComponent <Text>(); txt.text = model.enemy_score.ToString(); } try { db.BasicQuery("DELETE FROM balls WHERE ID = " + last_ball_id); } catch (System.Exception e) { Debug.Log(e); return(false); } db.CloseDB(); return(true); }
public List <ResponseShortUrlViewModel_TopTen> GetTopTen() { string sql = string.Empty; dbAccess db = new dbAccess(); DataTable dt = new DataTable(); List <ResponseShortUrlViewModel_TopTen> tt = new List <ResponseShortUrlViewModel_TopTen>(); sql += "SELECT Top 10 ShortURL, count(*) as qtdAccess "; sql += "FROM tblShortURL_Access "; sql += "group by ShortURL "; sql += "order by qtdAccess desc "; string ret = db.DataTableToJSON(db.SelectAccessDBSqlServer(sql, _configuration.GetConnectionString("DefaultConnection").ToString())); var o = JsonConvert.DeserializeObject <List <ResponseShortUrlViewModel_TopTen> >(ret); return(o); }
public ArrayList GetAllMatch() { dbAccess db = GetComponent <dbAccess>(); db.OpenDB("VBBS.db"); IDataReader reader = db.BasicQuery("Select * from matches"); ArrayList matches = new ArrayList(); while (reader.Read()) { Match match = new Match(reader.GetInt32(0), reader.GetString(1), reader.GetString(4), reader.GetString(5), reader.GetString(6)); matches.Add(match); } db.CloseDB(); return(matches); }
void Start() { SceneManager.UnloadScene("Menu"); GameObject.Find("NewGameScreen").GetComponent <Canvas>().sortingOrder = 0; GameObject.Find("SettingPanel").GetComponent <Canvas>().sortingOrder = 1; numSelectors = 4; player = new GameObject[numSelectors]; playerusername = new string[numSelectors]; playerusernameactive = new string[numSelectors]; disableAvatar(); //player [0].SetActive (true); numplayers = 4; numplayersactive = 0; db = GameObject.Find("database").GetComponent <dbAccess>(); db.OpenDB("mydb.sdb"); defvalueavatar = GameObject.Find("EventSystem").GetComponent <StartGame>(); }
// Use this for initialization void Start () { if( m_ColumnLabels.Length != m_ValuesType.Length ) return ; m_DB = new dbAccess() ; m_DB.OpenDB( m_DataBaseFileName ) ; Debug.Log( "m_DB.OpenDB done" ) ; try { m_DB.CreateTable( m_DataBaseTable1Name , m_ColumnLabels , m_ValuesType ) ; Debug.Log( "m_DB.CreateTable done" ) ; } catch { } RefreshData() ; Debug.Log( "m_DataBaseContent" + m_DataBaseContent.Count ) ; }
public void finishSession() { ID = 0; db = new dbAccess(); db.OpenDB(dbName); // If not accidental login if(sessionTime > 0) { TimeSpan duration = TimeSpan.FromSeconds((int)sessionTime); db.UpdateSpecific(patientTable, "SessionLength", sessionTime.ToString(), "SessionID", sessionNum); db.UpdateSpecific(patientTable, "NumOfPlays", numPlays.ToString(), "SessionID", sessionNum); } // If accidental login, delete the row made for this session else { db.DeleteRow(patientTable, "SessionID", sessionNum); } db.CloseDB(); }
public void newStats(float timePlayed, string bbsActivity, int bbsGrade) { numPlays++; if(numPlays <= 100) { db = new dbAccess(); db.OpenDB(dbName); // Get Play Duration string playColumn = "Play" + numPlays.ToString(); TimeSpan duration = TimeSpan.FromSeconds((int)timePlayed); // Store values into DB string playString = duration.ToString() + "|" + bbsActivity + "|" + bbsGrade.ToString(); db.UpdateSpecific(patientTable, playColumn, playString, "SessionID", sessionNum); // Update session stats sessionTime += timePlayed; db.CloseDB(); } }
public JointSampler() { init = true; db_control = new dbAccess (); active_user = PlayerPrefs.GetInt ("ActiveUser", 1); }
void Start() { selectedID = -1; currentID = 0; db = new dbAccess(); db.OpenDB(dbName); newpatientCol = new List<string>(); newpatientEntries = new List<string>(); newtableCol = new List<string>(); newtableVal = new List<string>(); LoginScreen.newsessionCol = new List<string>(); LoginScreen.newsessionEntries = new List<string>(); SetupNewPatient(); newpatientCol.Add ("LastName"); newpatientCol.Add ("FirstName"); newpatientCol.Add ("Therapist"); newpatientCol.Add ("username"); newpatientCol.Add ("password"); }
private void search(object file) { bool right = false; string errorMessage = ""; AsyncEnableButton(false); try { project pro = new project(); pro = (project)file; Cursor.Current = Cursors.WaitCursor; switch (pro.dbDataType) { case project.databaseType.mySql: String connectionString = null; connectionString = "Server=" + pr.host + ";Database=" + pr.database + ";Uid=" + pr.user + ";Pwd=" + pr.password + ";"; dbMySql db = new dbMySql(); errorMessage = db.test(connectionString); if (errorMessage.Equals("")) { AsyncWrite(""); AsyncWriteLine("Success connection \n"); //pr = new project(); //pr.name = pr.name; // lets get the tables... List<table> lista = new List<table>(); lista = db.getTables(connectionString, pr.database); //lista.Sort(); pr.tables.Clear(); foreach (table item in lista) { AsyncWriteLine("Found table... " + item.Name + "\n"); // now lets get the fields for each table... List<field> listaField = new List<field>(); listaField = db.getFields(connectionString, pr.database, item.Name); if (listaField != null) { foreach (field fi in listaField) { item.fields.Add(fi); AsyncWriteLine("Found field... " + fi.Name + "\n"); } // the descriptionField its the first string field of table... foreach (field campito in listaField) { if (campito.type.ToString().Equals("_string") || campito.type.ToString().Equals("_text")) { item.fieldDescription = campito.Name; break; } } if (item.fieldDescription == null) item.fieldDescription = listaField[0].Name; } // lets get primary keys and foreign keys for the table... db.getKeys(connectionString, item, pr.database); // lets sort the fields in the table... // we order but put first key fields if (general.orderFields) { item.fields.Sort(new compareFields(compareFields.CompareByOptions.name)); item.fields.Sort(new compareFields(compareFields.CompareByOptions.key)); } pr.tables.Add(item); } pr.tables.Sort(); //// now lets get the relations ... pr.relations.Clear(); List<relation> listarelation = new List<relation>(); listarelation = db.getRelations(connectionString, pr.database); if (listarelation != null) { foreach (relation re in listarelation) { // found description of fields... foreach (table item in pr.tables) { if (item.Name.ToLower().Equals(re.childTable.ToLower())) { re.childDescription = item.fieldDescription; // we put the field as keyfield... foreach (field fi in item.fields) { if (fi.Name.ToLower().Equals(re.childField.ToLower())) fi.isForeignKey = true; } } if (item.Name.ToLower().Equals(re.parentTable.ToLower())) re.parentDescription = item.fieldDescription; } if (!pr.existsRelation(re.parentTable, re.childTable)) { pr.relations.Add(re); AsyncWriteLine("Found relation... " + re.name + "\n"); } // now if the relation has to do with the tables... foreach (table item in pr.tables) { // we put the relation in the child table... if (item.Name.ToLower().Equals(re.childTable.ToLower())) item.relations.Add(re); } } } // also we can get relations about the field names foreach (table tab in pr.tables) { foreach (field campo in tab.fields) { if (campo.isKey) { foreach (table tab2 in pr.tables) { if (!tab.Name.ToLower().Equals(tab2.Name.ToLower())) { foreach (field campo2 in tab2.fields) { if (campo.Name.ToLower().Equals(campo2.Name.ToLower())) { // check if relation exists.. if (!pr.existsRelation(tab.Name, tab2.Name)) { campo2.isForeignKey = true; relation rel = new relation(); rel.name = tab2.Name + "_" + tab.Name; bool found = false; foreach (relation relax in pr.relations) { if (relax.name.Equals(rel.name)) found = true; } if (!found) { rel.parentTable = tab.Name; rel.parentField = campo.Name; rel.childTable = tab2.Name; rel.childField = campo2.Name; // found description of fields... foreach (table item in pr.tables) { if (item.Name.ToLower().Equals(rel.childTable.ToLower())) rel.childDescription = item.fieldDescription; if (item.Name.ToLower().Equals(rel.parentTable.ToLower())) rel.parentDescription = item.fieldDescription; } pr.relations.Add(rel); // now if the relation has to do with the tables... foreach (table item in pr.tables) { if (item.Name.Equals(tab2.Name)) item.relations.Add(rel); } } } } } } } } } } right = true; pr.host = pro.host; pr.database = pro.database; pr.user = pro.user; pr.password = pro.password; pr.dbDataType = pro.dbDataType; //pr.saveProject(Path.Combine(util.projects_dir, pro.name + ".xml")); // lets save it for next load of application... // pr.saveProject(Path.Combine(util.projects_dir, "conf.xml")); // AsyncWriteLine("Project saved... \n"); } else { AsyncWrite(errorMessage); } break; case project.databaseType.SqlServer: connectionString = "Data Source=" + pro.host + ";Network Library=DBMSSOCN;Initial Catalog=" + pro.database + ";User ID=" + pro.user + ";Password="******";"; // connectionStringOleDb = "Provider=SQLNCLI;Server=" + txtHost.Text + ";Database=" + txtDatabase.Text + ";Uid=" + txtUser.Text + ";Pwd=" + txtPassword.Text + ";"; dbSql2005 dbSqlServer = new dbSql2005(); errorMessage = dbSqlServer.test(connectionString); if (errorMessage.Equals("")) { AsyncWrite(""); AsyncWriteLine("Success connection \n"); //pr = new project(); //pr.name = pro.name; // lets get the tables... List<table> lista = new List<table>(); lista = dbSqlServer.getTables(connectionString, pro.database); //lista.Sort(); foreach (table item in lista) { AsyncWriteLine("Found table... " + item.Name + "\n"); // now lets get the fields for each table... List<field> listaField = new List<field>(); listaField = dbSqlServer.getFields(connectionString, item.Name); if (listaField != null) { foreach (field fi in listaField) { item.fields.Add(fi); AsyncWriteLine("Found field... " + fi.Name + "\n"); } // the descriptionField its the first string field of table... foreach (field campito in listaField) { if (campito.type.ToString().Equals("_string") || campito.type.ToString().Equals("_text")) { item.fieldDescription = campito.Name; break; } } if (item.fieldDescription == null) item.fieldDescription = listaField[0].Name; } // lets get primary keys and foreign keys for the table... dbSqlServer.getKeys(connectionString, item); // lets get not primary keys foreach (field campito in item.fields) { if (!campito.isKey) item.getNotKeyFields.Add(campito); } // lets sort the fields in the table... // we order but put first key fields if (general.orderFields) { item.fields.Sort(new compareFields(compareFields.CompareByOptions.name)); item.fields.Sort(new compareFields(compareFields.CompareByOptions.key)); } pr.tables.Add(item); // lets get description of table string DescriptionOfTable = ""; DescriptionOfTable = dbSqlServer.getCommentsFromTable(connectionString, item.Name); if (DescriptionOfTable.IndexOf("#exclude#") != -1) { item.excludeFromGeneration = true; DescriptionOfTable.Replace("#exclude#", ""); } if (!DescriptionOfTable.Equals("")) item.TargetName = DescriptionOfTable; // end of description for table } pr.tables.Sort(); // now lets get the relations ... List<relation> listarelation = new List<relation>(); listarelation = dbSqlServer.getRelations(connectionString); if (listarelation != null) { foreach (relation re in listarelation) { // item.fields.Add(re); pr.relations.Add(re); AsyncWriteLine("Found relation... " + re.name + "\n"); // now if the relation has to do with the tables... foreach (table item in pr.tables) { // we put the relation in the parent table... if (item.Name.ToLower().Equals(re.parentTable.ToLower())) { // le añadimos la descripcion re.parentDescription = item.fieldDescription; foreach (table taby in pr.tables) { if (taby.Name.Equals(re.childTable)) re.childDescription = taby.fieldDescription; } item.relations.Add(re); } } } } // also we can get relations about the field names foreach (table tab in pr.tables) { foreach (field campo in tab.fields) { if (campo.isKey) { foreach (table tab2 in pr.tables) { if (!tab.Name.ToLower().Equals(tab2.Name.ToLower())) { foreach (field campo2 in tab2.fields) { if (campo.Name.ToLower().Equals(campo2.Name.ToLower())) { campo2.isForeignKey = true; relation rel = new relation(); rel.name = tab.Name + "_" + tab2.Name; if (!pr.relations.Contains(rel.name)) { rel.parentTable = tab2.Name; rel.parentField = campo2.Name; rel.childTable = tab.Name; rel.childField = campo.Name; // found description of fields... foreach (table item in pr.tables) { if (item.Name.ToLower().Equals(rel.childTable.ToLower())) rel.childDescription = item.fieldDescription; if (item.Name.ToLower().Equals(rel.parentTable.ToLower())) rel.parentDescription = item.fieldDescription; } pr.relations.Add(rel); // now if the relation has to do with the tables... foreach (table item in pr.tables) { if (item.Name.Equals(tab2.Name)) { // see if the relation exists.. bool seguir = true; foreach (relation rel2 in tab2.relations) { if (rel2.name.ToLower().Equals(rel.name.ToLower())) seguir = false; } if (seguir) item.relations.Add(rel); } } } } } } } } } } right = true; pr.host = pro.host; pr.database = pro.database; pr.user = pro.user; pr.password = pro.password; pr.dbDataType = pro.dbDataType; //pr.saveProject(Path.Combine(util.projects_dir, pro.name + ".xml")); // lets save it for next load of application... // pr.saveProject(Path.Combine(util.projects_dir, "conf.xml")); //AsyncWriteLine("Project saved... \n"); } else { AsyncWrite(errorMessage); } break; case project.databaseType.dbf: connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + pro.database + ";Extended Properties=dBASE IV;User ID=" + pro.user + ";Password="******";"; dbDbf dbf = new dbDbf(); errorMessage = dbf.test(connectionString); if (errorMessage.Equals("")) { AsyncWrite(""); AsyncWriteLine("Success connection \n"); //pr = new project(); //pr.name = pro.name; // lets get the tables... List<table> lista = new List<table>(); lista = dbf.getTables(connectionString, pro.database); //lista.Sort(); foreach (table item in lista) { AsyncWriteLine("Found table... " + item.Name + "\n"); // now lets get the fields for each table... List<field> listaField = new List<field>(); listaField = dbf.getFields(connectionString, item.Name); if (listaField != null) { foreach (field fi in listaField) { item.fields.Add(fi); AsyncWriteLine("Found field... " + fi.Name + "\n"); } // the descriptionField its the first string field of table... foreach (field campito in listaField) { if (campito.type.ToString().Equals("_string") || campito.type.ToString().Equals("_text")) { item.fieldDescription = campito.Name; break; } } if (item.fieldDescription == null) item.fieldDescription = listaField[0].Name; } // lets get primary keys and foreign keys for the table... dbf.getKeys(connectionString, item); // lets sort the fields in the table... // we order but put first key fields if (general.orderFields) { item.fields.Sort(new compareFields(compareFields.CompareByOptions.name)); item.fields.Sort(new compareFields(compareFields.CompareByOptions.key)); } pr.tables.Add(item); } pr.tables.Sort(); // now lets get the relations ... List<relation> listarelation = new List<relation>(); listarelation = dbf.getRelations(connectionString); if (listarelation != null) { foreach (relation re in listarelation) { // item.fields.Add(re); pr.relations.Add(re); AsyncWriteLine("Found relation... " + re.name + "\n"); // now if the relation has to do with the tables... foreach (table item in pr.tables) { // we put the relation in the parent table... if (item.Name.ToLower().Equals(re.parentTable.ToLower())) { // le añadimos la descripcion re.parentDescription = item.fieldDescription; foreach (table taby in pr.tables) { if (taby.Name.Equals(re.childTable)) re.childDescription = taby.fieldDescription; } item.relations.Add(re); } } } } // also we can get relations about the field names foreach (table tab in pr.tables) { foreach (field campo in tab.fields) { if (campo.isKey) { foreach (table tab2 in pr.tables) { if (!tab.Name.ToLower().Equals(tab2.Name.ToLower())) { foreach (field campo2 in tab2.fields) { if (campo.Name.ToLower().Equals(campo2.Name.ToLower())) { campo2.isForeignKey = true; relation rel = new relation(); rel.name = tab.Name + "_" + tab2.Name; if (!pr.relations.Contains(rel.name)) { rel.parentTable = tab2.Name; rel.parentField = campo2.Name; rel.childTable = tab.Name; rel.childField = campo.Name; // found description of fields... foreach (table item in pr.tables) { if (item.Name.ToLower().Equals(rel.childTable.ToLower())) rel.childDescription = item.fieldDescription; if (item.Name.ToLower().Equals(rel.parentTable.ToLower())) rel.parentDescription = item.fieldDescription; } pr.relations.Add(rel); // now if the relation has to do with the tables... foreach (table item in pr.tables) { if (item.Name.Equals(tab2.Name)) { // see if the relation exists.. bool seguir = true; foreach (relation rel2 in tab2.relations) { if (rel2.name.ToLower().Equals(rel.name.ToLower())) seguir = false; } if (seguir) item.relations.Add(rel); } } } } } } } } } } right = true; pr.host = pro.host; pr.database = pro.database; pr.user = pro.user; pr.password = pro.password; pr.dbDataType = pro.dbDataType; } else { AsyncWriteLine(errorMessage); } break; case project.databaseType.access2003: connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + pro.database + ";User ID=" + pro.user + ";Password="******";"; dbAccess dba2003 = new dbAccess(); errorMessage = dba2003.test(connectionString); if (errorMessage.Equals("")) { AsyncWrite(""); AsyncWriteLine("Success connection \n"); //pr = new project(); //pr.name = pro.name; // lets get the tables... List<table> lista = new List<table>(); lista = dba2003.getTables(connectionString, pro.database); //lista.Sort(); foreach (table item in lista) { AsyncWriteLine("Found table... " + item.Name + "\n"); // now lets get the fields for each table... List<field> listaField = new List<field>(); listaField = dba2003.getFields(connectionString, item.Name); if (listaField != null) { foreach (field fi in listaField) { item.fields.Add(fi); AsyncWriteLine("Found field... " + fi.Name + "\n"); } } // lets get primary keys and foreign keys for the table... dba2003.getKeys(connectionString, item); // now we search a text field that is not key if (listaField != null) { // the descriptionField its the first string field of table... foreach (field campito in listaField) { if (campito.type.ToString().Equals("_string") && !campito.isKey) { item.fieldDescription = campito.Name; break; } } } if (item.fieldDescription == null) item.fieldDescription = item.GetKey; // lets sort the fields in the table... // we order but put first key fields if (general.orderFields) { item.fields.Sort(new compareFields(compareFields.CompareByOptions.name)); item.fields.Sort(new compareFields(compareFields.CompareByOptions.key)); } pr.tables.Add(item); } pr.tables.Sort(); // now lets get the relations ... List<relation> listarelation = new List<relation>(); listarelation = dba2003.getRelations(connectionString); if (listarelation != null) { foreach (relation re in listarelation) { // item.fields.Add(re); pr.relations.Add(re); AsyncWriteLine("Found relation... " + re.name + "\n"); // now if the relation has to do with the tables... foreach (table item in pr.tables) { // we put the relation in the parent table... if (item.Name.ToLower().Equals(re.parentTable.ToLower())) { // le añadimos la descripcion re.parentDescription = item.fieldDescription; foreach (table taby in pr.tables) { if (taby.Name.Equals(re.childTable)) re.childDescription = taby.fieldDescription; } item.relations.Add(re); } } } } // also we can get relations about the field names foreach (table tab in pr.tables) { foreach (field campo in tab.fields) { if (campo.isKey) { foreach (table tab2 in pr.tables) { if (!tab.Name.ToLower().Equals(tab2.Name.ToLower())) { foreach (field campo2 in tab2.fields) { if (campo.Name.ToLower().Equals(campo2.Name.ToLower())) { campo2.isForeignKey = true; relation rel = new relation(); rel.name = tab.Name + "_" + tab2.Name; if (!pr.relations.Contains(rel.name)) { rel.parentTable = tab2.Name; rel.parentField = campo2.Name; rel.childTable = tab.Name; rel.childField = campo.Name; // found description of fields... foreach (table item in pr.tables) { if (item.Name.ToLower().Equals(rel.childTable.ToLower())) rel.childDescription = item.fieldDescription; if (item.Name.ToLower().Equals(rel.parentTable.ToLower())) rel.parentDescription = item.fieldDescription; } pr.relations.Add(rel); // now if the relation has to do with the tables... foreach (table item in pr.tables) { if (item.Name.Equals(tab2.Name)) { // see if the relation exists.. bool seguir = true; foreach (relation rel2 in tab2.relations) { if (rel2.name.ToLower().Equals(rel.name.ToLower())) seguir = false; } if (seguir) item.relations.Add(rel); } } } } } } } } } } right = true; pr.host = pro.host; pr.database = pro.database; pr.user = pro.user; pr.password = pro.password; pr.dbDataType = pro.dbDataType; } else { AsyncWriteLine(errorMessage); } break; case project.databaseType.access2007: connectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + pro.database + ";Persist Security Info=False;"; //Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + pro.database + ";Jet OLEDB:Database Password=MyDbPassword; dbAccess dba2007 = new dbAccess(); errorMessage = dba2007.test(connectionString); if (errorMessage.Equals("")) { AsyncWrite(""); AsyncWriteLine("Success connection \n"); //pr = new project(); //pr.name = pro.name; // lets get the tables... List<table> lista = new List<table>(); lista = dba2007.getTables(connectionString, pro.database); //lista.Sort(); foreach (table item in lista) { AsyncWriteLine("Found table... " + item.Name + "\n"); // now lets get the fields for each table... List<field> listaField = new List<field>(); listaField = dba2007.getFields(connectionString, item.Name); if (listaField != null) { foreach (field fi in listaField) { item.fields.Add(fi); AsyncWriteLine("Found field... " + fi.Name + "\n"); } } // lets get primary keys and foreign keys for the table... dba2007.getKeys(connectionString, item); // now we search a text field that is not key if (listaField != null) { // the descriptionField its the first string field of table... foreach (field campito in listaField) { if (campito.type.ToString().Equals("_string") || campito.type.ToString().Equals("_text") ) { item.fieldDescription = campito.Name; break; } } } if (item.fieldDescription == null) item.fieldDescription = item.GetKey; // lets sort the fields in the table... // we order but put first key fields if (general.orderFields) { item.fields.Sort(new compareFields(compareFields.CompareByOptions.name)); item.fields.Sort(new compareFields(compareFields.CompareByOptions.key)); } pr.tables.Add(item); } pr.tables.Sort(); // now lets get the relations ... List<relation> listarelation = new List<relation>(); listarelation = dba2007.getRelations(connectionString); if (listarelation != null) { foreach (relation re in listarelation) { // item.fields.Add(re); pr.relations.Add(re); AsyncWriteLine("Found relation... " + re.name + "\n"); // now if the relation has to do with the tables... foreach (table item in pr.tables) { // we put the relation in the parent table... if (item.Name.ToLower().Equals(re.parentTable.ToLower())) { // le añadimos la descripcion re.parentDescription = item.fieldDescription; foreach (table taby in pr.tables) { if (taby.Name.Equals(re.childTable)) re.childDescription = taby.fieldDescription; } item.relations.Add(re); } } } } // also we can get relations about the field names foreach (table tab in pr.tables) { foreach (field campo in tab.fields) { if (campo.isKey) { foreach (table tab2 in pr.tables) { if (!tab.Name.ToLower().Equals(tab2.Name.ToLower())) { foreach (field campo2 in tab2.fields) { if (campo.Name.ToLower().Equals(campo2.Name.ToLower())) { campo2.isForeignKey = true; relation rel = new relation(); rel.name = tab.Name + "_" + tab2.Name; if (!pr.relations.Contains(rel.name)) { rel.parentTable = tab2.Name; rel.parentField = campo2.Name; rel.childTable = tab.Name; rel.childField = campo.Name; // found description of fields... foreach (table item in pr.tables) { if (item.Name.ToLower().Equals(rel.childTable.ToLower())) rel.childDescription = item.fieldDescription; if (item.Name.ToLower().Equals(rel.parentTable.ToLower())) rel.parentDescription = item.fieldDescription; } pr.relations.Add(rel); // now if the relation has to do with the tables... foreach (table item in pr.tables) { if (item.Name.Equals(tab2.Name)) { // see if the relation exists.. bool seguir = true; foreach (relation rel2 in tab2.relations) { if (rel2.name.ToLower().Equals(rel.name.ToLower())) seguir = false; } if (seguir) item.relations.Add(rel); } } } } } } } } } } right = true; pr.host = pro.host; pr.database = pro.database; pr.user = pro.user; pr.password = pro.password; pr.dbDataType = pro.dbDataType; } else { AsyncWriteLine(errorMessage); } break; // end of access2007 case project.databaseType.excelOrCsv: if (pr.database.Contains("xls")) connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + pr.database + ";Extended Properties=\"text;HDR=Yes;FMT=Delimited\""; else connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + pr.database + ";Extended Properties=\"Excel 8.0;HDR=Yes;IMEX=1\""; dbExcelOrCsv dbaODBC = new dbExcelOrCsv(); errorMessage = dbaODBC.test(connectionString); if (errorMessage.Equals("")) { AsyncWrite(""); AsyncWriteLine("Success connection \n"); //pr = new project(); //pr.name = pro.name;9 // lets get the tables... List<table> lista = new List<table>(); lista = dbaODBC.getTables(connectionString, pr.database); //lista.Sort(); foreach (table item in lista) { AsyncWriteLine("Found table... " + item.Name + "\n"); // now lets get the fields for each table... List<field> listaField = new List<field>(); listaField = dbaODBC.getFields(connectionString, item.Name); if (listaField != null) { foreach (field fi in listaField) { item.fields.Add(fi); AsyncWriteLine("Found field... " + fi.Name + "\n"); } } // lets get primary keys and foreign keys for the table... dbaODBC.getKeys(connectionString, item); // now we search a text field that is not key if (listaField != null) { // the descriptionField its the first string field of table... foreach (field campito in listaField) { if (campito.type.ToString().Equals("_string") || campito.type.ToString().Equals("_text")) { item.fieldDescription = campito.Name; break; } } } if (item.fieldDescription == null) item.fieldDescription = item.GetKey; // lets sort the fields in the table... // we order but put first key fields if (general.orderFields) { item.fields.Sort(new compareFields(compareFields.CompareByOptions.name)); item.fields.Sort(new compareFields(compareFields.CompareByOptions.key)); } pr.tables.Add(item); } pr.tables.Sort(); // now lets get the relations ... List<relation> listarelation = new List<relation>(); listarelation = dbaODBC.getRelations(connectionString); if (listarelation != null) { foreach (relation re in listarelation) { // item.fields.Add(re); pr.relations.Add(re); AsyncWriteLine("Found relation... " + re.name + "\n"); // now if the relation has to do with the tables... foreach (table item in pr.tables) { // we put the relation in the parent table... if (item.Name.ToLower().Equals(re.parentTable.ToLower())) { // le añadimos la descripcion re.parentDescription = item.fieldDescription; foreach (table taby in pr.tables) { if (taby.Name.Equals(re.childTable)) re.childDescription = taby.fieldDescription; } item.relations.Add(re); } } } } // also we can get relations about the field names foreach (table tab in pr.tables) { foreach (field campo in tab.fields) { if (campo.isKey) { foreach (table tab2 in pr.tables) { if (!tab.Name.ToLower().Equals(tab2.Name.ToLower())) { foreach (field campo2 in tab2.fields) { if (campo.Name.ToLower().Equals(campo2.Name.ToLower())) { campo2.isForeignKey = true; relation rel = new relation(); rel.name = tab.Name + "_" + tab2.Name; if (!pr.relations.Contains(rel.name)) { rel.parentTable = tab2.Name; rel.parentField = campo2.Name; rel.childTable = tab.Name; rel.childField = campo.Name; // found description of fields... foreach (table item in pr.tables) { if (item.Name.ToLower().Equals(rel.childTable.ToLower())) rel.childDescription = item.fieldDescription; if (item.Name.ToLower().Equals(rel.parentTable.ToLower())) rel.parentDescription = item.fieldDescription; } pr.relations.Add(rel); // now if the relation has to do with the tables... foreach (table item in pr.tables) { if (item.Name.Equals(tab2.Name)) { // see if the relation exists.. bool seguir = true; foreach (relation rel2 in tab2.relations) { if (rel2.name.ToLower().Equals(rel.name.ToLower())) seguir = false; } if (seguir) item.relations.Add(rel); } } } } } } } } } } right = true; pr.host = pr.host; pr.database = pr.database; pr.user = pr.user; pr.password = pr.password; pr.dbDataType = pr.dbDataType; } else { AsyncWriteLine(errorMessage); } break; // end of excelOrCsv } Cursor.Current = Cursors.Default; switch (right) { case true: AsyncWriteLine("All right. Now you can save the project..."); AsyncEnableButton(true); SystemSounds.Exclamation.Play(); break; case false: AsyncWriteLine("Error, review the configuration."); AsyncEnableButton(false); //util.playSimpleSound(Path.Combine(util.sound_dir, "zasentodalaboca.wav")); SystemSounds.Asterisk.Play(); break; } // we have finished with new project Cursor.Current = Cursors.Default; } catch (Exception ex) { AsyncWrite(ex.Message); } }
void Start() { // --------------------initialize database stuff-------------------- db = new dbAccess(); db.OpenDB(dbName); columnNames = new List<string>(); columnValues = new List<string>(); newpatientCol = new List<string>(); newpatientEntries = new List<string>(); newtableCol = new List<string>(); newtableVal = new List<string>(); newsessionCol = new List<string>(); newsessionEntries = new List<string>(); SetupNewPatient(); PresetNewSessionValues(); newpatientCol.Add ("LastName"); newpatientCol.Add ("FirstName"); newpatientCol.Add ("Therapist"); newpatientCol.Add ("username"); newpatientCol.Add ("password"); // If first time playing, create patient table columnNames.Add ("PatientID"); columnNames.Add ("LastName"); columnNames.Add ("FirstName"); columnNames.Add ("Therapist"); columnNames.Add ("username"); columnNames.Add ("password"); columnValues.Add ("INTEGER"); columnValues.Add ("text"); columnValues.Add ("text"); columnValues.Add ("text"); columnValues.Add ("text"); columnValues.Add ("text"); db.CreateTableIfNotExist(tableName,columnNames,columnValues); }
void Start() { tabInt = 0; statsSwitch = 0; if(LoginScreen.currentID > 0) { db = new dbAccess(); db.OpenDB(dbName); } }
// Use this for initialization void Start() { // Instantiate objects // Load ZigFu game object. This game object has 4 Zig related script Components. Use this object // to instances of these script's classes in order to access event information :) zigfu = GameObject.Find ("ZigFu"); sampler = new JointSampler (); zig_control = zigfu.GetComponent <Zig>(); // This script is attached to Carl so GetComponent can be called directly skeleton = GetComponent <ZigSkeleton>(); l_shoulder_angles = new Vector3(); r_shoulder_angles = new Vector3(); db_control = new dbAccess (); user_id = PlayerPrefs.GetInt ("ActiveUser", 1); // DEBUG: Access some application run-time data. Compare this output to where the scene was loaded from //Debug.Log ("isEditor: " + Application.isEditor + "\nisLoadinglevel: " + Application.isLoadingLevel + "\nLoadedLevelName: " + Application.loadedLevelName + // "\nplatform: " + Application.platform + "\nGenuine: " + Application.genuine + "\ngenuineCheckAvailable: " + Application.genuineCheckAvailable + // "\nbackgroundLoadingPriority: " + Application.backgroundLoadingPriority); // Calculate max and min y-axis rotations to allow abduction measurements max_y_rotation = degrees_freedom; min_y_rotation = -degrees_freedom; // Get zig joint identification numbers for each shoulder R_shoulder_id = ZigJointId.RightShoulder; L_shoulder_id = ZigJointId.LeftShoulder; currentExercise = 0; exercise = "Press Next To Start"; style = new GUIStyle(); instructions = " "; time_hold = 0; inPosition = true; }