Exemplo n.º 1
0
        /// <summary>
        /// Saves the ClassLevelInfo.
        /// </summary>
        /// <returns>ClassLevelInfo Object</returns>
        public ClassLevelInfo SaveClassLevelInfo()
        {
            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 = "InsertUpdate_ClassLevel";

                command.Parameters.Add(dbconn.GenerateParameterObj("@ClassLevelID", SqlDbType.Int, ClassLevelID.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@ClassID", SqlDbType.Int, ClassID.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@ClassLevel", SqlDbType.Int, ClassLevel.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@BonusFeat", SqlDbType.Int, BonusFeat.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@Talent", SqlDbType.Int, Talent.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@BaseAttack", SqlDbType.Int, BaseAttack.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@ForcePointBase", SqlDbType.Int, ForcePointBase.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@ForceTechnique", SqlDbType.Int, ForceTechnique.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@ForceSecret", SqlDbType.Int, ForceSecret.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@MedicalSecret", SqlDbType.Int, MedicalSecret.ToString(), 0));

                result = command.ExecuteReader();

                result.Read();
                SetReaderToObject(ref result);
            }
            catch
            {
                Exception e = new Exception();
                this._insertUpdateOK = false;
                this._insertUpdateMessage.Append(e.Message + "                     Inner Exception= " + e.InnerException);
                throw e;
            }
            finally
            {
                command.Dispose();
                connection.Close();
            }
            return(this);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Saves the force power descriptor.
        /// </summary>
        /// <returns>Race Object</returns>
        public Race SaveRace()
        {
            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 = "InsertUpdate_Race";

                command.Parameters.Add(dbconn.GenerateParameterObj("@RaceID", SqlDbType.Int, RaceID.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@RaceName", SqlDbType.VarChar, RaceName.ToString(), 50));
                command.Parameters.Add(dbconn.GenerateParameterObj("@RaceDescription", SqlDbType.VarChar, RaceDescription.ToString(), 1000));
                command.Parameters.Add(dbconn.GenerateParameterObj("@OtherDescription", SqlDbType.VarChar, OtherDescription.ToString(), 1000));
                command.Parameters.Add(dbconn.GenerateParameterObj("@SizeID", SqlDbType.Int, SizeID.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@Sex", SqlDbType.Char, Sex.ToString(), 1));
                command.Parameters.Add(dbconn.GenerateParameterObj("@RageAbility", SqlDbType.Bit, RageAbility.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@ShapeShiftAbility", SqlDbType.Bit, ShapeShiftAbility.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@Primitive", SqlDbType.Bit, Primitive.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@BonusSkill", SqlDbType.Bit, BonusSkill.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@BonusFeat", SqlDbType.Bit, BonusFeat.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@AverageHeight", SqlDbType.Decimal, AverageHeight.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@AverageWeight", SqlDbType.Decimal, AverageWeight.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@SpeedID", SqlDbType.Int, SpeedID.ToString(), 0));

                result = command.ExecuteReader();

                result.Read();
                SetReaderToObject(ref result);
            }
            catch
            {
                Exception e = new Exception();
                this._insertUpdateOK = false;
                this._insertUpdateMessage.Append(e.Message + "                     Inner Exception= " + e.InnerException);
                throw e;
            }
            finally
            {
                command.Dispose();
                connection.Close();
            }
            return(this);
        }