Exemplo n.º 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);
            }
        }
Exemplo n.º 2
0
 private void SetReaderToObject(ref WeaponSize objWeaponSize, ref SqlDataReader result)
 {
     if (result.HasRows)
     {
         objWeaponSize.WeaponSizeID          = (int)result.GetValue(result.GetOrdinal("WeaponSizeID"));
         objWeaponSize.WeaponSizeName        = result.GetValue(result.GetOrdinal("WeaponSizeName")).ToString();
         objWeaponSize.WeaponSizeDescription = result.GetValue(result.GetOrdinal("WeaponSizeDescription")).ToString();
     }
 }
Exemplo n.º 3
0
        private List <WeaponSize> GetWeaponSizeList(string strSprocName, string strWhere, string strOrderBy)
        {
            List <WeaponSize> WeaponSizes = new List <WeaponSize>();

            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())
                {
                    WeaponSize objWeaponSize = new WeaponSize();
                    SetReaderToObject(ref objWeaponSize, ref result);
                    WeaponSizes.Add(objWeaponSize);
                }
            }
            catch
            {
                Exception e = new Exception();
                throw e;
            }
            finally
            {
                command.Dispose();
                connection.Close();
            }
            return(WeaponSizes);
        }