/// <summary>
        /// Sets the reader to object.
        /// </summary>
        /// <param name="objPrestigeRequirement">The object prestige requirement.</param>
        /// <param name="result">The result.</param>
        private void SetReaderToObject(ref PrestigeRequirement objPrestigeRequirement, ref SqlDataReader result)
        {
            if (result.HasRows)
            {
                objPrestigeRequirement.PrestigeRequirementID          = (int)result.GetValue(result.GetOrdinal("PrestigeRequirementID"));
                objPrestigeRequirement.PrestigeRequirementDescription = result.GetValue(result.GetOrdinal("PrestigeRequirementDescription")).ToString();

                objPrestigeRequirement._objComboBoxData.Add(objPrestigeRequirement.PrestigeRequirementID, objPrestigeRequirement.PrestigeRequirementDescription);
            }
        }
        /// <summary>
        /// Clones the specified LST PrestigeRequirement.
        /// </summary>
        /// <param name="lstPrestigeRequirement">The LST PrestigeRequirement.</param>
        /// <returns>List<PrestigeRequirement></returns>
        static public List <PrestigeRequirement> Clone(List <PrestigeRequirement> lstPrestigeRequirement)
        {
            List <PrestigeRequirement> lstCPrestigeRequirement = new List <PrestigeRequirement>();

            foreach (PrestigeRequirement objPrestigeRequirement in lstPrestigeRequirement)
            {
                lstCPrestigeRequirement.Add(PrestigeRequirement.Clone(objPrestigeRequirement));
            }

            return(lstCPrestigeRequirement);
        }
        /// <summary>
        /// Saves a List of Feats to a Character.
        /// </summary>
        /// <param name="lstCharFeat">A <List> of Feats .</param>
        /// <param name="intCharacterID">The Character identifier.</param>
        /// <returns></returns>
        public void SaveCharacterPrestigeRequirements(List <PrestigeRequirement> lstCharactePrestigeRequirement, int intCharacterID)
        {
            //Once a PrestigeRequirement is added it can be removed, added or updated, so reset the list
            PrestigeRequirement objDelPrestigeRequirement = new PrestigeRequirement();

            objDelPrestigeRequirement.DeleteCharacterPrestigeRequirement(0, intCharacterID);

            foreach (PrestigeRequirement objCharPrestigeRequirement in lstCharactePrestigeRequirement)
            {
                objCharPrestigeRequirement.SaveCharacterPrestigeRequirement(objCharPrestigeRequirement.PrestigeRequirementID, intCharacterID);
            }
        }
        /// <summary>
        /// Gets the prestige requirement list.
        /// </summary>
        /// <param name="strSprocName">Name of the string sproc.</param>
        /// <param name="strWhere">The string where.</param>
        /// <param name="strOrderBy">The string order by.</param>
        /// <returns>List of PrestigeRequirement objects</returns>
        private List <PrestigeRequirement> GetPrestigeRequirementList(string strSprocName, string strWhere, string strOrderBy)
        {
            List <PrestigeRequirement> PrestigeRequirements = new List <PrestigeRequirement>();

            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())
                {
                    PrestigeRequirement objPrestigeRequirement = new PrestigeRequirement();
                    SetReaderToObject(ref objPrestigeRequirement, ref result);
                    PrestigeRequirements.Add(objPrestigeRequirement);
                }
            }
            catch
            {
                Exception e = new Exception();
                throw e;
            }
            finally
            {
                command.Dispose();
                connection.Close();
            }
            return(PrestigeRequirements);
        }
        /// <summary>
        /// Clones the specified object PrestigeRequirement.
        /// </summary>
        /// <param name="objPrestigeRequirement">The object PrestigeRequirement.</param>
        /// <returns>PrestigeRequirement</returns>
        static public PrestigeRequirement Clone(PrestigeRequirement objPrestigeRequirement)
        {
            PrestigeRequirement objCPrestigeRequirement = new PrestigeRequirement(objPrestigeRequirement.PrestigeRequirementID);

            return(objCPrestigeRequirement);
        }
Example #6
0
        /// <summary>
        /// Sets the reader to object.
        /// </summary>
        /// <param name="objClass">The object class.</param>
        /// <param name="result">The result.</param>
        private void SetReaderToObject(ref Class objClass, ref SqlDataReader result)
        {
            if (result.HasRows)
            {
                objClass.ClassID             = (int)result.GetValue(result.GetOrdinal("ClassID"));
                objClass.IsPrestige          = (bool)result.GetValue(result.GetOrdinal("IsPrestige"));
                objClass.ClassName           = result.GetValue(result.GetOrdinal("ClassName")).ToString();
                objClass.HitDieType          = (int)result.GetValue(result.GetOrdinal("HitDieType"));
                objClass.StartingSkillNumber = (int)result.GetValue(result.GetOrdinal("StartingSkillNumber"));

                if (!string.IsNullOrEmpty(result.GetValue(result.GetOrdinal("StartingSkills")).ToString()))
                {
                    objClass.StartingSkills = (int)result.GetValue(result.GetOrdinal("StartingSkills"));
                }

                if (!string.IsNullOrEmpty(result.GetValue(result.GetOrdinal("StartCreditDie")).ToString()))
                {
                    objClass.StartCreditDie = (int)result.GetValue(result.GetOrdinal("StartCreditDie"));
                }

                if (!string.IsNullOrEmpty(result.GetValue(result.GetOrdinal("StartCreditDieNumber")).ToString()))
                {
                    objClass.StartCreditDieNumber = (int)result.GetValue(result.GetOrdinal("StartCreditDieNumber"));
                }

                if (!string.IsNullOrEmpty(result.GetValue(result.GetOrdinal("StartCreditDieModifier")).ToString()))
                {
                    objClass.StartCreditDieModifier = (int)result.GetValue(result.GetOrdinal("StartCreditDieModifier"));
                }

                if (!string.IsNullOrEmpty(result.GetValue(result.GetOrdinal("PrestigeRequiredTalents")).ToString()))
                {
                    objClass.PrestigeRequiredTalents = (int)result.GetValue(result.GetOrdinal("PrestigeRequiredTalents"));
                }

                if (!string.IsNullOrEmpty(result.GetValue(result.GetOrdinal("PrestigeRequiredForceTech")).ToString()))
                {
                    objClass.PrestigeRequiredForceTech = (bool)result.GetValue(result.GetOrdinal("PrestigeRequiredForceTech"));
                }

                if (!string.IsNullOrEmpty(result.GetValue(result.GetOrdinal("PrestigeRequiredDarkside")).ToString()))
                {
                    objClass.PrestigeRequiredDarkside = (bool)result.GetValue(result.GetOrdinal("PrestigeRequiredDarkside"));
                }

                if (!string.IsNullOrEmpty(result.GetValue(result.GetOrdinal("PrestigeRequiredFeats")).ToString()))
                {
                    objClass.PrestigeRequiredFeats = (int)result.GetValue(result.GetOrdinal("PrestigeRequiredFeats"));
                }

                if (!string.IsNullOrEmpty(result.GetValue(result.GetOrdinal("PrestigeRequiredBaseAttack")).ToString()))
                {
                    objClass.PrestigeRequiredBaseAttack = (int)result.GetValue(result.GetOrdinal("PrestigeRequiredBaseAttack"));
                }

                if (!string.IsNullOrEmpty(result.GetValue(result.GetOrdinal("PrestigeRequiredLevel")).ToString()))
                {
                    objClass.PrestigeRequiredLevel = (int)result.GetValue(result.GetOrdinal("PrestigeRequiredLevel"));
                }
                objClass._objComboBoxData.Clear();
                objClass._objComboBoxData.Add(objClass.ClassID, objClass.ClassName);
            }
            if (objClass.IsPrestige)
            {
                Feat                objFeat = new Feat();;
                ClassDefenseType    objClassDefenseTypes   = new ClassDefenseType();
                PrestigeRequirement objPrestigeRequirement = new PrestigeRequirement();
                TalentTree          objTalentTree          = new TalentTree();
                Talent              objTalent     = new Talent();
                ForcePower          objForcePower = new ForcePower();
                Skill               objSkill      = new Skill();
                Race                objRace       = new Race();

                objClass.StartingFeats = objFeat.GetStartingFeats(" ClassID=" + objClass.ClassID.ToString(), "FeatName");

                objClass.objClassDefenseTypes = objClassDefenseTypes.GetClassDefenseTypes(" ClassID=" + objClass.ClassID.ToString(), "");

                objClass.objPrestigeRequirement = objPrestigeRequirement.GetPrestigeRequirementPrestigeClass(" ClassID=" + objClass.ClassID.ToString(), "PrestigeRequirementDescription");

                objClass.objPrestigeRequiredTalentTree = objTalentTree.GetTalentTreesPrestigeClass("ClassID=" + objClass.ClassID.ToString(), "TalentTreeName");

                objClass.objPrestigeRequiredTalents = objTalent.GetPrestigeRequiredTalents("ClassID=" + objClass.ClassID.ToString(), "TalentName");

                objClass.objPrestigeRequiredFeats = objFeat.GetPrestigeRequiredFeats(" ClassID=" + objClass.ClassID.ToString(), "FeatName");

                objClass.objPrestigeRequiredFeatGroup = objFeat.GetPrestigeRequiredFeatGroups(" ClassID=" + objClass.ClassID.ToString(), "FeatName");

                objClass.objPrestigeRequiredForcePowers = objForcePower.GetPrestigeRequiredForcePowers(" ClassID=" + objClass.ClassID.ToString(), "ForcePowerName");

                objClass.objPrestigeRequiredSkills = objSkill.GetPrestigeRequiredSkills(" ClassID=" + objClass.ClassID.ToString(), "SkillName");

                objClass.objPrestigeRequiredRaces = objRace.GetRaceRequirementForClass(" mtmPrestigeRequirementClassRace.ClassID=" + objClass.ClassID.ToString(), "RaceName");
            }
        }