コード例 #1
0
 /// <summary>
 /// Sets the reader to object.
 /// </summary>
 /// <param name="objCharacterLevel">The object character level.</param>
 /// <param name="result">The result.</param>
 private void SetReaderToObject(ref CharacterLevel objCharacterLevel, ref SqlDataReader result)
 {
     if (result.HasRows)
     {
         objCharacterLevel.CharacterLevelID  = (int)result.GetValue(result.GetOrdinal("CharacterLevelID"));
         objCharacterLevel.FeatAvailable     = (bool)result.GetValue(result.GetOrdinal("FeatAvailable"));
         objCharacterLevel.MinimumExperience = (int)result.GetValue(result.GetOrdinal("MinimumExperience"));
         objCharacterLevel.AbilityIncrease   = (bool)result.GetValue(result.GetOrdinal("AbilityIncrease"));
     }
 }
コード例 #2
0
        /// <summary>
        /// Clones the specified LST CharacterLevel.
        /// </summary>
        /// <param name="lstCharacterLevel">The LST CharacterLevel.</param>
        /// <returns>List<CharacterLevel></returns>
        static public List <CharacterLevel> Clone(List <CharacterLevel> lstCharacterLevel)
        {
            List <CharacterLevel> lstCCharacterLevel = new List <CharacterLevel>();

            foreach (CharacterLevel objCharacterLevel in lstCharacterLevel)
            {
                lstCCharacterLevel.Add(CharacterLevel.Clone(objCharacterLevel));
            }

            return(lstCCharacterLevel);
        }
コード例 #3
0
        /// <summary>
        /// Gets the character level list.
        /// </summary>
        /// <param name="strSprocName">Name of the string sproc.</param>
        /// <param name="strWhere">The string where.</param>
        /// <param name="strOrderBy">The string order by.</param>
        /// <returns>List of CharacterLevel Objects</returns>
        private List <CharacterLevel> GetCharacterLevelList(string strSprocName, string strWhere, string strOrderBy)
        {
            List <CharacterLevel> characterClassLevels = new List <CharacterLevel>();

            SqlDataReader      result;
            DatabaseConnection dbconn     = new DatabaseConnection();
            SqlCommand         command    = new SqlCommand();
            SqlConnection      connection = new SqlConnection(dbconn.SQLSEVERConnString);

            try
            {
                connection.Open();
                command.Connection  = connection;
                command.CommandType = CommandType.StoredProcedure;
                command.CommandText = strSprocName;
                command.Parameters.Add(dbconn.GenerateParameterObj("@strWhere", SqlDbType.VarChar, strWhere, 1000));
                command.Parameters.Add(dbconn.GenerateParameterObj("@strOrderBy", SqlDbType.VarChar, strOrderBy, 1000));
                result = command.ExecuteReader();

                while (result.Read())
                {
                    CharacterLevel obCharacterLevel = new CharacterLevel();
                    SetReaderToObject(ref obCharacterLevel, ref result);
                    characterClassLevels.Add(obCharacterLevel);
                }
            }
            catch
            {
                Exception e = new Exception();
                throw e;
            }
            finally
            {
                command.Dispose();
                connection.Close();
            }
            return(characterClassLevels);
        }
コード例 #4
0
        /// <summary>
        /// Clones the specified object CharacterLevel.
        /// </summary>
        /// <param name="objCharacterLevel">The object CharacterLevel.</param>
        /// <returns>CharacterLevel</returns>
        static public CharacterLevel Clone(CharacterLevel objCharacterLevel)
        {
            CharacterLevel objCCharacterLevel = new CharacterLevel(objCharacterLevel.CharacterLevelID);

            return(objCCharacterLevel);
        }