Exemplo n.º 1
0
        /// <summary>
        /// Sets the reader to the Paramter Ability object .
        /// </summary>
        /// <param name="objArmor">The object armor.</param>
        /// <param name="result">The result.</param>
        private void SetReaderToObject(ref Armor objArmor, ref SqlDataReader result)
        {
            if (result.HasRows)
            {
                objArmor.ArmorID             = (int)result.GetValue(result.GetOrdinal("ArmorID"));
                objArmor.ArmorTypeID         = (int)result.GetValue(result.GetOrdinal("ArmorTypeID"));
                objArmor.ArmorName           = result.GetValue(result.GetOrdinal("ArmorName")).ToString();
                objArmor.ArmorDescription    = result.GetValue(result.GetOrdinal("ArmorDescription")).ToString();
                objArmor.ReflexAdjustment    = (int)result.GetValue(result.GetOrdinal("ReflexAdjustment"));
                objArmor.FortitudeAdjustment = (int)result.GetValue(result.GetOrdinal("FortitudeAdjustment"));
                objArmor.EmplacementPoints   = (int)result.GetValue(result.GetOrdinal("EmplacementPoints"));
                objArmor.Cost                   = (int)result.GetValue(result.GetOrdinal("Cost"));
                objArmor.Weight                 = (decimal)result.GetValue(result.GetOrdinal("Weight"));
                objArmor.MaxDefBonus            = (int)result.GetValue(result.GetOrdinal("MaxDefBonus"));
                objArmor.BookID                 = (int)result.GetValue(result.GetOrdinal("BookID"));
                objArmor.ArmorProficiencyFeatID = (int)result.GetValue(result.GetOrdinal("ArmorProficiencyFeatID"));

                ArmorType objArmorType = new ArmorType();
                if (!(objArmor.ArmorTypeID == 0))
                {
                    objArmorType.GetArmorType(objArmor.ArmorTypeID);
                }
                objArmor.objArmorType = objArmorType;

                ItemAvailabilityType objAA = new ItemAvailabilityType();
                objArmor.lstArmorAvailability = objAA.GetArmorAvailabilityTypes(objArmor.ArmorID);

                objArmor.objArmorProfFeat = new Feat(objArmor.ArmorProficiencyFeatID);


                objArmor.objBook = new Book(objArmor.BookID);

                objArmor._objComboBoxData.Add(objArmor.ArmorID, objArmor.ArmorName);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Clones the specified object Armor.
        /// </summary>
        /// <param name="objArmor">The object Armor.</param>
        /// <returns>Armor</returns>
        static public Armor Clone(Armor objArmor)
        {
            Armor objCArmor = new Armor();

            if (objArmor.ArmorID != 0)
            {
                objCArmor.GetArmor(objArmor.ArmorID);
            }
            else
            {
                objCArmor.ArmorID                = 0;
                objCArmor.ArmorDescription       = objArmor.ArmorDescription;
                objCArmor.ArmorName              = objArmor.ArmorName;
                objCArmor.ArmorProficiencyFeatID = objArmor.ArmorProficiencyFeatID;
                objCArmor.ArmorTypeID            = objArmor.ArmorTypeID;
                objCArmor.BookID              = objArmor.BookID;
                objCArmor.Cost                = objArmor.Cost;
                objCArmor.EmplacementPoints   = objArmor.EmplacementPoints;
                objCArmor.FortitudeAdjustment = objArmor.FortitudeAdjustment;
                objCArmor.MaxDefBonus         = objArmor.MaxDefBonus;
                objCArmor.ReflexAdjustment    = objArmor.ReflexAdjustment;
                objCArmor.Weight              = objArmor.Weight;

                objCArmor.lstArmorAvailability = ItemAvailabilityType.Clone(objArmor.lstArmorAvailability);
                Feat objFeat = new Feat(objArmor.objArmorProfFeat.FeatID);
                objCArmor.objArmorProfFeat = objFeat;

                ArmorType objArmorType = new ArmorType(objArmor.objArmorType.ArmorTypeID);
                objCArmor.objArmorType = objArmorType;

                Book objBook = new Book(objArmor.objBook.BookID);
                objCArmor.objBook = objBook;
            }
            return(objCArmor);
        }
Exemplo n.º 3
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);
            }
        }
        /// <summary>
        /// Clones the specified List of ItemAvailabilityType objects.
        /// </summary>
        /// <param name="lstItemAvailabilityType">The list of ItemAvailabilityType.</param>
        /// <returns>List of ItemAvailabilityType objects</returns>
        static public List <ItemAvailabilityType> Clone(List <ItemAvailabilityType> lstItemAvailabilityType)
        {
            List <ItemAvailabilityType> lstCItemAvailabilityType = new List <ItemAvailabilityType>();

            foreach (ItemAvailabilityType objItemAvailabilityType in lstItemAvailabilityType)
            {
                lstCItemAvailabilityType.Add(ItemAvailabilityType.Clone(objItemAvailabilityType));
            }

            return(lstCItemAvailabilityType);
        }
 private void SetReaderToObject(ref ItemAvailabilityType objItemAvailabilityType, ref SqlDataReader result)
 {
     if (result.HasRows)
     {
         objItemAvailabilityType.ItemAvailabilityTypeID          = (int)result.GetValue(result.GetOrdinal("ItemAvailabilityTypeID"));
         objItemAvailabilityType.ItemAvailabilityTypeName        = result.GetValue(result.GetOrdinal("ItemAvailabilityTypeName")).ToString();
         objItemAvailabilityType.ItemAvailabilityTypeDescription = result.GetValue(result.GetOrdinal("ItemAvailabilityTypeDescription")).ToString();
         objItemAvailabilityType.ArmorType     = (bool)result.GetValue(result.GetOrdinal("ArmorType"));
         objItemAvailabilityType.EquipmentType = (bool)result.GetValue(result.GetOrdinal("EquipmentType"));
         objItemAvailabilityType.WeaponType    = (bool)result.GetValue(result.GetOrdinal("WeaponType"));
     }
 }
        static public ItemAvailabilityType Clone(ItemAvailabilityType objItemAvailabilityType)
        {
            ItemAvailabilityType objCItemAvailabilityType = new ItemAvailabilityType();

            if (objItemAvailabilityType.ItemAvailabilityTypeID != 0)
            {
                objCItemAvailabilityType.GetItemAvailabilityType(objItemAvailabilityType.ItemAvailabilityTypeID);
            }
            else
            {
                objCItemAvailabilityType.ItemAvailabilityTypeID          = 0;
                objCItemAvailabilityType.ItemAvailabilityTypeName        = objItemAvailabilityType.ItemAvailabilityTypeName;
                objCItemAvailabilityType.ItemAvailabilityTypeDescription = objItemAvailabilityType.ItemAvailabilityTypeDescription;
                objCItemAvailabilityType.ArmorType     = objItemAvailabilityType.ArmorType;
                objCItemAvailabilityType.EquipmentType = objItemAvailabilityType.EquipmentType;
                objCItemAvailabilityType.WeaponType    = objItemAvailabilityType.WeaponType;
            }
            return(objCItemAvailabilityType);
        }
        private List <ItemAvailabilityType> GetItemAvailabilityTypeList(string strSprocName, string strWhere, string strOrderBy)
        {
            List <ItemAvailabilityType> ItemAvailabilityTypes = new List <ItemAvailabilityType>();

            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())
                {
                    ItemAvailabilityType objItemAvailabilityType = new ItemAvailabilityType();
                    SetReaderToObject(ref objItemAvailabilityType, ref result);
                    ItemAvailabilityTypes.Add(objItemAvailabilityType);
                }
            }
            catch
            {
                Exception e = new Exception();
                throw e;
            }
            finally
            {
                command.Dispose();
                connection.Close();
            }
            return(ItemAvailabilityTypes);
        }
Exemplo n.º 8
0
        /// <summary>
        /// Sets the reader to object.
        /// </summary>
        /// <param name="objEquipment">The object equipment.</param>
        /// <param name="result">The result.</param>
        private void SetReaderToObject(ref Equipment objEquipment, ref SqlDataReader result)
        {
            if (result.HasRows)
            {
                objEquipment.EquipmentID          = (int)result.GetValue(result.GetOrdinal("EquipmentId"));
                objEquipment.EquipmentName        = result.GetValue(result.GetOrdinal("EquipmentName")).ToString();
                objEquipment.EquipmentDescription = result.GetValue(result.GetOrdinal("EquipmentDescription")).ToString();
                objEquipment.EquipmentWeight      = (decimal)result.GetValue(result.GetOrdinal("EquipmentWeight"));
                objEquipment.EmplacementPoints    = (int)result.GetValue(result.GetOrdinal("EmplacementPoints"));
                objEquipment.EquipmentCost        = (int)result.GetValue(result.GetOrdinal("EquipmentCost"));
                objEquipment.Upgradable           = (bool)result.GetValue(result.GetOrdinal("Upgradable"));
                objEquipment.BookID = (int)result.GetValue(result.GetOrdinal("BookID"));

                objEquipment._objComboBoxData.Add(objEquipment.EquipmentID, objEquipment.EquipmentName);

                objEquipment.objBook = new Book(objEquipment.BookID);

                objEquipment.objEquipmentType = new EquipmentType(objEquipment.EquipmentTypeID);

                ItemAvailabilityType objIAT = new ItemAvailabilityType();
                objEquipment.lstEquipmentAvailability = objIAT.GetEquipmentAvailabilityTypes(objEquipment.EquipmentID);
            }
        }