コード例 #1
0
        private bool IsAccountCharacter(string persistentId, int characterId, out Character character)
        {
            logDb.Open();
            var dataSet = logDb.SqlSelect(
                "SELECT * FROM characters WHERE id=@CharacterId AND account_persistent_id=@PersistentId",
                new Dictionary <string, object>()
            {
                { "@CharacterId", characterId }, { "@PersistentId", persistentId }
            });

            var rows = dataSet.Tables[0].Rows;

            logDb.Close();

            if (rows.Count > 0)
            {
                character = new Character(persistentId, int.Parse(rows[0][0].ToString()), rows[0][2].ToString(), 0, 0);
            }
            else
            {
                character = null;
            }

            return(rows.Count > 0);
        }
コード例 #2
0
        private DataRowCollection GetUser(string email)
        {
            logDb.Open();
            var dataSet = logDb.SqlSelect(
                "SELECT * FROM accounts WHERE email=@Email",
                new Dictionary <string, object>()
            {
                { "@Email", email }
            });

            logDb.Close();

            return(dataSet.Tables[0].Rows);
        }
コード例 #3
0
        public List <Character> GetCharacters(string persistentId)
        {
            var characters = new List <Character>();

            logDb.Open();
            var dataSet = logDb.SqlSelect("SELECT * FROM characters WHERE account_persistent_id=@PersistentId", new Dictionary <string, object>()
            {
                { "@PersistentId", persistentId }
            });
            var rows = dataSet.Tables[0].Rows;

            foreach (DataRow row in rows)
            {
                characters.Add(new Character(persistentId, int.Parse(row[0].ToString()), row[2].ToString(), 0, 0));
            }

            logDb.Close();

            return(characters);
        }