Example #1
0
        public void UpdateNode(DataRow row, string result)
        {
            long   id     = (long)row.ItemArray[0];
            string param1 = $"Total = {(long)row.ItemArray[5] + 1}";
            string param2 = "";

            if (result == "WIN")
            {
                param2 = $", Wins = {(long)row.ItemArray[3] + 1}";
            }
            else if (result == "DRAW")
            {
                param2 = $", Draws = {(long)row.ItemArray[4] + 1}";
            }

            _sqlManager.ExecuteQuery($"UPDATE Nodes SET {param1}{param2} WHERE id = {id};");
        }
Example #2
0
 /// <summary>
 /// Create the table Nodes in DB if it does not already exist.
 /// </summary>
 private void CreateTable()
 {
     _sqlManager = new SQLiteManager(_dataBaseFileName);
     _sqlManager.ExecuteQuery(@"CREATE TABLE IF NOT EXISTS Nodes (id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, CurrentNode NCHAR(9) NOT NULL, MoveNode NCHAR(9) NOT NULL, Wins INTEGER NOT NULL, Draws INTEGER NOT NULL, Total INTEGER NOT NULL);");
 }