Beispiel #1
0
        /// <summary>
        /// Saves the weapon.
        /// </summary>
        /// <returns>Weapon Object</returns>
        public Weapon SaveWeapon()
        {
            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_Weapon";
                command.Parameters.Add(dbconn.GenerateParameterObj("@WeaponID", SqlDbType.Int, WeaponID.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@WeaponName", SqlDbType.VarChar, WeaponName.ToString(), 50));
                command.Parameters.Add(dbconn.GenerateParameterObj("@WeaponTypeID", SqlDbType.Int, WeaponTypeID.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@WeaponSizeID", SqlDbType.Int, WeaponSizeID.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@Cost", SqlDbType.Int, Cost.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@RateOfFire", SqlDbType.VarChar, RateOfFire.ToString(), 3));
                command.Parameters.Add(dbconn.GenerateParameterObj("@DamageDieNumber", SqlDbType.Int, DamageDieNumber.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@DamageDieType", SqlDbType.Int, DamageDieType.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@Stun", SqlDbType.Bit, Stun.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@StunDieNumber", SqlDbType.Int, DamageDieNumber.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@StunDieType", SqlDbType.Int, DamageDieType.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@WeaponDescription", SqlDbType.Text, WeaponDescription.ToString(), 4000));
                command.Parameters.Add(dbconn.GenerateParameterObj("@Weight", SqlDbType.Decimal, Weight.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@BookID", SqlDbType.Int, BookID.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@WeaponProficiencyFeatID", SqlDbType.Int, WeaponProficiencyFeatID.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@EmplacementPoints", SqlDbType.Int, EmplacementPoints.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@DoubleWeapon", SqlDbType.Bit, DoubleWeapon.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@AreaOfAttack", SqlDbType.Bit, AreaOfAttack.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@Accurate", SqlDbType.Bit, AreaOfAttack.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@Inaccurate", SqlDbType.Bit, AreaOfAttack.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@Slugthrower", SqlDbType.Bit, Slugthrower.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@RequiresSeperateAmmo", SqlDbType.Bit, RequiresSeperateAmmo.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@ExtraDamage", SqlDbType.Bit, ExtraDamage.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@ExtraStunDamage", SqlDbType.Bit, ExtraStunDamage.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);
        }
Beispiel #2
0
 public WeaponSize GetWeaponSize(string WeaponSizeName)
 {
     return(GetSingleWeaponSize("Select_WeaponSize", " WeaponSizeName='" + WeaponSizeID.ToString() + "'", ""));
 }
Beispiel #3
0
        public WeaponSize SaveWeaponSize()
        {
            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_WeaponSize";
                command.Parameters.Add(dbconn.GenerateParameterObj("@WeaponSizeID", SqlDbType.Int, WeaponSizeID.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@WeaponSizeName", SqlDbType.VarChar, WeaponSizeName, 50));
                command.Parameters.Add(dbconn.GenerateParameterObj("@WeaponSizeDescription", SqlDbType.VarChar, WeaponSizeDescription, 100));


                result = command.ExecuteReader();

                result.Read();
                SetReaderToObject(ref result);
            }
            catch
            {
                Exception e = new Exception();
                this._insertUpdateOK = false;
                this._insertUpdateMessage.Append(e.Message.ToString());
                throw e;
            }
            finally
            {
                command.Dispose();
                connection.Close();
            }
            return(this);
        }
Beispiel #4
0
        /// <summary>
        /// Delete the WeaponSize.
        /// </summary>
        /// <returns>Boolean</returns>
        public bool DeleteWeaponSize()
        {
            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 = "Delete_WeaponSize";
                command.Parameters.Add(dbconn.GenerateParameterObj("@WeaponSizeID", SqlDbType.Int, WeaponSizeID.ToString(), 0));
                result = command.ExecuteReader();
            }
            catch
            {
                Exception e = new Exception();
                this._deleteOK = false;
                this._deletionMessage.Append(e.Message + "                     Inner Exception= " + e.InnerException);
                throw e;
            }
            finally
            {
                command.Dispose();
                connection.Close();
            }
            return(this.DeleteOK);
        }