Beispiel #1
0
        /// <summary>
        /// </summary>
        /// <param name="charId">
        /// </param>
        /// <returns>
        /// </returns>
        public static DBLoginData GetByCharacterId(int charId)
        {
            DBCharacter character = null;

            try
            {
                using (IDbConnection conn = Connector.GetConnection())
                {
                    character = CharacterDao.GetById(charId).First();
                    DynamicParameters p = new DynamicParameters();
                    p.Add("username", character.Username);
                    return(conn.Query <DBLoginData>("SELECT * FROM login WHERE Username=@username", p).First());
                }
            }
            catch (Exception)
            {
                if (character == null)
                {
                    LogUtil.Debug("No character " + charId + " in database. huh?");
                }
                else
                {
                    LogUtil.Debug("No Account found for Character " + character.Name + " (" + character.Id + ")");
                }

                throw;
            }
        }
Beispiel #2
0
        /// <summary>
        /// </summary>
        /// <param name="user">
        /// </param>
        public static void LogoffChars(string user)
        {
            IEnumerable <DBCharacter> characters = CharacterDao.GetAllForUser(user);

            foreach (DBCharacter character in characters)
            {
                OnlineDao.SetOffline(character.Id);
            }
        }