Exemplo n.º 1
0
 public WeaponAmmo GetWeaponAmmo(string WeaponAmmoName)
 {
     return(GetSingleWeaponAmmo("Select_WeaponAmmo", " WeaponAmmoName='" + WeaponAmmoID.ToString() + "'", ""));
 }
Exemplo n.º 2
0
        public WeaponAmmo SaveWeaponAmmo()
        {
            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_WeaponAmmo";
                command.Parameters.Add(dbconn.GenerateParameterObj("@WeaponAmmoID", SqlDbType.Int, WeaponAmmoID.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@WeaponAmmoName", SqlDbType.VarChar, WeaponAmmoName.ToString(), 50));
                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("@WeaponAmmoDescription", SqlDbType.Text, WeaponAmmoDescription.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("@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.ToString());
                throw e;
            }
            finally
            {
                command.Dispose();
                connection.Close();
            }
            return(this);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Delete the WeaponAmmo.
        /// </summary>
        /// <returns>Boolean</returns>
        public bool DeleteWeaponAmmo()
        {
            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_WeaponAmmo";
                command.Parameters.Add(dbconn.GenerateParameterObj("@WeaponAmmoID", SqlDbType.Int, WeaponAmmoID.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);
        }
Exemplo n.º 4
0
 public List <WeaponAmmo> GetWeaponAmmoByWeapon(int WeaponID)
 {
     return(GetWeaponAmmoList("Select_WeaponWeaponAmmo", " WeaponAmmoName='" + WeaponAmmoID.ToString() + "'", "WeaponAmmoName"));
 }