Exemple #1
0
        /// <summary>
        /// Sets the reader to object.
        /// </summary>
        /// <param name="result">The result.</param>
        private void SetReaderToObject(ref SqlDataReader result)
        {
            if (result.HasRows)
            {
                this.WeaponID        = (int)result.GetValue(result.GetOrdinal("WeaponID"));
                this.WeaponName      = result.GetValue(result.GetOrdinal("WeaponName")).ToString();
                this.WeaponTypeID    = (int)result.GetValue(result.GetOrdinal("WeaponTypeID"));
                this.DamageDieNumber = (int)result.GetValue(result.GetOrdinal("DamageDieNumber"));
                this.DamageDieType   = (int)result.GetValue(result.GetOrdinal("DamageDieType"));
                this.WeaponSizeID    = (int)result.GetValue(result.GetOrdinal("WeaponSizeID"));
                this.Cost            = (int)result.GetValue(result.GetOrdinal("Cost"));
                this.RateOfFire      = result.GetValue(result.GetOrdinal("RateOfFire")).ToString();

                this.Stun                    = (bool)result.GetValue(result.GetOrdinal("Stun"));
                this.StunDieNumber           = (int)result.GetValue(result.GetOrdinal("StunDieNumber"));
                this.StunDieType             = (int)result.GetValue(result.GetOrdinal("StunDieType"));
                this.WeaponDescription       = result.GetValue(result.GetOrdinal("WeaponDescription")).ToString();
                this.Weight                  = (decimal)result.GetValue(result.GetOrdinal("Weight"));
                this.BookID                  = (int)result.GetValue(result.GetOrdinal("BookID"));
                this.WeaponProficiencyFeatID = (int)result.GetValue(result.GetOrdinal("WeaponProficiencyFeatID"));
                this.EmplacementPoints       = (int)result.GetValue(result.GetOrdinal("EmplacementPoints"));
                this.DoubleWeapon            = (bool)result.GetValue(result.GetOrdinal("DoubleWeapon"));
                this.AreaOfAttack            = (bool)result.GetValue(result.GetOrdinal("AreaOfAttack"));
                this.Accurate                = (bool)result.GetValue(result.GetOrdinal("Accurate"));
                this.Inaccurate              = (bool)result.GetValue(result.GetOrdinal("Inaccurate"));
                this.Slugthrower             = (bool)result.GetValue(result.GetOrdinal("Slugthrower"));
                this.RequiresSeperateAmmo    = (bool)result.GetValue(result.GetOrdinal("RequiresSeperateAmmo"));
                this.ExtraDamage             = (int)result.GetValue(result.GetOrdinal("ExtraDamage"));
                this.ExtraStunDamage         = (int)result.GetValue(result.GetOrdinal("ExtraStunDamage"));

                WeaponType objWeaponType = new WeaponType();
                if (!(this.WeaponTypeID == 0))
                {
                    objWeaponType.GetWeaponType(this.WeaponTypeID);
                }
                this.objWeaponType = objWeaponType;

                Range objRange = new Range();
                this.objRanges = objRange.GetWeaponRanges("WeaponID=" + this.WeaponID.ToString(), "BeginSquare");

                Book objBk = new Book(this.BookID);
                this.objBook = objBk;

                WeaponSize objWS = new WeaponSize(this.WeaponSizeID);
                this.objWeaponSize = objWS;

                Feat objWPFeat = new Feat(this.WeaponProficiencyFeatID);
                this.objWeaponProficiencyFeat = objWPFeat;

                ItemAvailabilityType objIAT = new ItemAvailabilityType();
                this.lstWeaponAvailability = objIAT.GetWeaponAvailabilityTypes(this.WeaponID);

                WeaponAmmo objWA = new WeaponAmmo();
                this.lstWeaponAmmo = objWA.GetWeaponAmmoByWeapon(this.WeaponID);

                this._objComboBoxData.Add(this.WeaponID, this.WeaponName);
            }
        }
Exemple #2
0
        private List <WeaponAmmo> GetWeaponAmmoList(string strSprocName, string strWhere, string strOrderBy)
        {
            List <WeaponAmmo> WeaponAmmos = new List <WeaponAmmo>();

            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())
                {
                    WeaponAmmo objWeaponAmmo = new WeaponAmmo();
                    SetReaderToObject(ref objWeaponAmmo, ref result);
                    WeaponAmmos.Add(objWeaponAmmo);
                }
            }
            catch
            {
                Exception e = new Exception();
                throw e;
            }
            finally
            {
                command.Dispose();
                connection.Close();
            }
            return(WeaponAmmos);
        }
Exemple #3
0
        private void SetReaderToObject(ref WeaponAmmo objWeaponAmmo, ref SqlDataReader result)
        {
            if (result.HasRows)
            {
                objWeaponAmmo.WeaponAmmoID          = (int)result.GetValue(result.GetOrdinal("WeaponAmmoID"));
                objWeaponAmmo.WeaponAmmoName        = result.GetValue(result.GetOrdinal("WeaponAmmoName")).ToString();
                objWeaponAmmo.WeaponAmmoDescription = result.GetValue(result.GetOrdinal("WeaponAmmoDescription")).ToString();

                objWeaponAmmo.DamageDieNumber = (int)result.GetValue(result.GetOrdinal("DamageDieNumber"));
                objWeaponAmmo.DamageDieType   = (int)result.GetValue(result.GetOrdinal("DamageDieType"));
                objWeaponAmmo.Cost            = (int)result.GetValue(result.GetOrdinal("Cost"));
                objWeaponAmmo.RateOfFire      = result.GetValue(result.GetOrdinal("RateOfFire")).ToString();

                objWeaponAmmo.Stun                  = (bool)result.GetValue(result.GetOrdinal("Stun"));
                objWeaponAmmo.StunDieNumber         = (int)result.GetValue(result.GetOrdinal("StunDieNumber"));
                objWeaponAmmo.StunDieType           = (int)result.GetValue(result.GetOrdinal("StunDieType"));
                objWeaponAmmo.WeaponAmmoDescription = result.GetValue(result.GetOrdinal("WeaponAmmoDescription")).ToString();
                objWeaponAmmo.Weight                = (decimal)result.GetValue(result.GetOrdinal("Weight"));
                objWeaponAmmo.BookID                = (int)result.GetValue(result.GetOrdinal("BookID"));
                objWeaponAmmo.ExtraDamage           = (int)result.GetValue(result.GetOrdinal("ExtraDamage"));
                objWeaponAmmo.ExtraStunDamage       = (int)result.GetValue(result.GetOrdinal("ExtraStunDamage"));
            }
        }