Пример #1
0
 private void SetReaderToObject(ref RaceSpecialAbility objRaceSpecialAbility, ref SqlDataReader result)
 {
     if (result.HasRows)
     {
         objRaceSpecialAbility.RaceSpecialAbilityID          = (int)result.GetValue(result.GetOrdinal("RaceSpecialAbilityID"));
         objRaceSpecialAbility.RaceSpecialAbilityName        = result.GetValue(result.GetOrdinal("RaceSpecialAbilityName")).ToString();
         objRaceSpecialAbility.RaceSpecialAbilityDescription = result.GetValue(result.GetOrdinal("RaceSpecialAbilityDescription")).ToString();
     }
 }
Пример #2
0
        /// <summary>
        /// Clones the specified LST RaceSpecialAbility.
        /// </summary>
        /// <param name="lstRaceSpecialAbility">The LST RaceSpecialAbility.</param>
        /// <returns>List<RaceSpecialAbility></returns>
        static public List <RaceSpecialAbility> Clone(List <RaceSpecialAbility> lstRaceSpecialAbility)
        {
            List <RaceSpecialAbility> lstCRaceSpecialAbility = new List <RaceSpecialAbility>();

            foreach (RaceSpecialAbility objRaceSpecialAbility in lstRaceSpecialAbility)
            {
                lstCRaceSpecialAbility.Add(RaceSpecialAbility.Clone(objRaceSpecialAbility));
            }

            return(lstCRaceSpecialAbility);
        }
Пример #3
0
        private List <RaceSpecialAbility> GetRaceSpecialAbilityList(string strSprocName, string strWhere, string strOrderBy)
        {
            List <RaceSpecialAbility> RaceSpecialAbilitys = new List <RaceSpecialAbility>();

            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())
                {
                    RaceSpecialAbility objRaceSpecialAbility = new RaceSpecialAbility();
                    SetReaderToObject(ref objRaceSpecialAbility, ref result);
                    RaceSpecialAbilitys.Add(objRaceSpecialAbility);
                }
            }
            catch
            {
                Exception e = new Exception();
                throw e;
            }
            finally
            {
                command.Dispose();
                connection.Close();
            }
            return(RaceSpecialAbilitys);
        }
Пример #4
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;
                }
            }
        }
Пример #5
0
        /// <summary>
        /// Clones the specified object RaceSpecialAbility.
        /// </summary>
        /// <param name="objRaceSpecialAbility">The object RaceSpecialAbility.</param>
        /// <returns>RaceSpecialAbility</returns>
        static public RaceSpecialAbility Clone(RaceSpecialAbility objRaceSpecialAbility)
        {
            RaceSpecialAbility objCRaceSpecialAbility = new RaceSpecialAbility(objRaceSpecialAbility.RaceSpecialAbilityID);

            return(objCRaceSpecialAbility);
        }