/// <summary>
        /// Clones the specified LST RaceSkillConditionalFeat.
        /// </summary>
        /// <param name="lstRaceSkillConditionalFeat">The LST RaceSkillConditionalFeat.</param>
        /// <returns>List<RaceSkillConditionalFeat></returns>
        static public List <RaceSkillConditionalFeat> Clone(List <RaceSkillConditionalFeat> lstRaceSkillConditionalFeat)
        {
            List <RaceSkillConditionalFeat> lstCRaceSkillConditionalFeat = new List <RaceSkillConditionalFeat>();

            foreach (RaceSkillConditionalFeat objRaceSkillConditionalFeat in lstRaceSkillConditionalFeat)
            {
                lstCRaceSkillConditionalFeat.Add(RaceSkillConditionalFeat.Clone(objRaceSkillConditionalFeat));
            }

            return(lstCRaceSkillConditionalFeat);
        }
        private void SetReaderToObject(ref RaceSkillConditionalFeat objRaceSkillConditionalFeat, ref SqlDataReader result)
        {
            if (result.HasRows)
            {
                objRaceSkillConditionalFeat.RaceID            = (int)result.GetValue(result.GetOrdinal("RaceID"));
                objRaceSkillConditionalFeat.SkillID           = (int)result.GetValue(result.GetOrdinal("SkillID"));
                objRaceSkillConditionalFeat.ConditionalFeatID = (int)result.GetValue(result.GetOrdinal("ConditionalFeatID"));

                Skill objSkill   = new Skill(objRaceSkillConditionalFeat.SkillID);
                Feat  objConFeat = new Feat(objRaceSkillConditionalFeat.ConditionalFeatID);
                objRaceSkillConditionalFeat.objSkill           = objSkill;
                objRaceSkillConditionalFeat.objConditionalFeat = objConFeat;
            }
        }
        private List <RaceSkillConditionalFeat> GetRaceSkillConditionalFeatList(string strSprocName, string strWhere, string strOrderBy)
        {
            List <RaceSkillConditionalFeat> RaceSkillConditionalFeats = new List <RaceSkillConditionalFeat>();

            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())
                {
                    RaceSkillConditionalFeat objRaceSkillConditionalFeat = new RaceSkillConditionalFeat();
                    SetReaderToObject(ref objRaceSkillConditionalFeat, ref result);
                    RaceSkillConditionalFeats.Add(objRaceSkillConditionalFeat);
                }
            }
            catch
            {
                Exception e = new Exception();
                throw e;
            }
            finally
            {
                command.Dispose();
                connection.Close();
            }
            return(RaceSkillConditionalFeats);
        }
        /// <summary>
        /// Clones the specified object RaceSkillConditionalFeat.
        /// </summary>
        /// <param name="objRaceSkillConditionalFeat">The object RaceSkillConditionalFeat.</param>
        /// <returns>RaceSkillConditionalFeat</returns>
        static public RaceSkillConditionalFeat Clone(RaceSkillConditionalFeat objRaceSkillConditionalFeat)
        {
            RaceSkillConditionalFeat objCRaceSkillConditionalFeat = new RaceSkillConditionalFeat(objRaceSkillConditionalFeat.RaceID, objRaceSkillConditionalFeat.SkillID, objRaceSkillConditionalFeat.ConditionalFeatID);

            return(objCRaceSkillConditionalFeat);
        }
Exemple #5
0
        /// <summary>
        /// Sets the reader to object.
        /// </summary>
        /// <param name="objRace">The object race.</param>
        /// <param name="result">The result.</param>
        private void SetReaderToObject(ref Race objRace, ref SqlDataReader result)
        {
            if (result.HasRows)
            {
                try
                {
                    objRace.RaceID           = (int)result.GetValue(result.GetOrdinal("RaceID"));
                    objRace.RaceName         = result.GetValue(result.GetOrdinal("RaceName")).ToString();
                    objRace.RaceDescription  = result.GetValue(result.GetOrdinal("RaceDescription")).ToString();
                    objRace.OtherDescription = result.GetValue(result.GetOrdinal("OtherDescription")).ToString();
                    objRace.Sex               = result.GetValue(result.GetOrdinal("Sex")).ToString();
                    objRace.RageAbility       = (bool)result.GetValue(result.GetOrdinal("RageAbility"));
                    objRace.ShapeShiftAbility = (bool)result.GetValue(result.GetOrdinal("ShapeShiftAbility"));
                    objRace.Primitive         = (bool)result.GetValue(result.GetOrdinal("Primitive"));
                    objRace.BonusFeat         = (bool)result.GetValue(result.GetOrdinal("BonusFeat"));
                    objRace.BonusSkill        = (bool)result.GetValue(result.GetOrdinal("BonusSkill"));
                    objRace.AverageHeight     = (decimal)result.GetValue(result.GetOrdinal("AverageHeight"));
                    objRace.AverageWeight     = (decimal)result.GetValue(result.GetOrdinal("AverageWeight"));
                    objRace.SizeID            = (int)result.GetValue(result.GetOrdinal("SizeID"));
                    objRace.SpeedID           = (int)result.GetValue(result.GetOrdinal("SpeedID"));

                    List <RaceAbilityModifier> objRaceAbilityModifiers = new List <RaceAbilityModifier>();
                    RaceAbilityModifier        objRaceAbilityModifier  = new RaceAbilityModifier();
                    Speed objSpeed = new Speed();

                    if (!(objRace.RaceID == 0))
                    {
                        objRaceAbilityModifiers = objRaceAbilityModifier.GetRaceAbilityModifiers(" RaceID=" + objRace.RaceID.ToString(), "");
                    }
                    objRace.objRaceAbilityModifiers = objRaceAbilityModifiers;

                    List <Skill> objRaceSkills = new List <Skill>();
                    Skill        objSkill      = new Skill();
                    if (!(objRace.RaceID == 0))
                    {
                        objRaceSkills = objSkill.GetSkillsForRace(" RaceID=" + objRace.RaceID.ToString(), "");
                    }
                    objRace.lstRaceSkills = objRaceSkills;


                    List <Speed> objSpeeds = new List <Speed>();
                    if (!(objRace.SpeedID == 0))
                    {
                        objSpeeds = objSpeed.GetRaceSpeeds(objRace.RaceID);
                    }
                    objRace.objSpeeds = objSpeeds;


                    RaceDefenseTypeModifier objRaceDefenseTypeModifier = new RaceDefenseTypeModifier();
                    lstRaceDefenseTypeModifier = objRaceDefenseTypeModifier.GetRaceDefenseTypeModifiersByRace(objRace.RaceID, "");

                    RaceFeatConditionalFeat objRaceFeatConditionalFeat = new RaceFeatConditionalFeat();
                    lstConditionalFeatsByFeat = objRaceFeatConditionalFeat.GetRaceFeatConditionalFeatsByRaceID(objRace.RaceID);

                    RaceSkillConditionalFeat objRaceSkillConditionalFeat = new RaceSkillConditionalFeat();
                    lstConditionalFeatsBySkill = objRaceSkillConditionalFeat.GetRaceSkillConditionalFeatsByRaceID(objRace.RaceID);

                    Language objLanguage = new Language();
                    lstLanguages = objLanguage.GetRaceLanguages(objRace.RaceID, "");

                    RaceLanguage objRaceLang = new RaceLanguage();
                    lstRaceLanguages = objRaceLang.GetRaceLanguages("RaceID=" + objRace.RaceID.ToString(), "");

                    RaceSpecialAbility objRSA = new RaceSpecialAbility();
                    lstRaceSpecialAbilities = objRSA.GetRaceSpecialAbilitysByRace(objRace.RaceID);

                    objRace._objComboBoxData.Add(objRace.RaceID, objRace.RaceName);
                }
                catch
                {
                    Exception e = new Exception();
                    throw e;
                }
            }
        }