/// <summary> /// Clones the specified LST RaceAbilityModifier. /// </summary> /// <param name="lstRaceAbilityModifier">The LST RaceAbilityModifier.</param> /// <returns>List<RaceAbilityModifier></returns> static public List <RaceAbilityModifier> Clone(List <RaceAbilityModifier> lstRaceAbilityModifier) { List <RaceAbilityModifier> lstCRaceAbilityModifier = new List <RaceAbilityModifier>(); foreach (RaceAbilityModifier objRaceAbilityModifier in lstRaceAbilityModifier) { lstCRaceAbilityModifier.Add(RaceAbilityModifier.Clone(objRaceAbilityModifier)); } return(lstCRaceAbilityModifier); }
/// <summary> /// Gets the race ability modifier 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 RaceAbilityModifier objects</returns> private List <RaceAbilityModifier> GetRaceAbilityModifierList(string strSprocName, string strWhere, string strOrderBy) { List <RaceAbilityModifier> raceAbilityModifiers = new List <RaceAbilityModifier>(); 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()) { RaceAbilityModifier objRaceAbilityModifier = new RaceAbilityModifier(); SetReaderToObject(ref objRaceAbilityModifier, ref result); raceAbilityModifiers.Add(objRaceAbilityModifier); } } catch { Exception e = new Exception(); throw e; } finally { command.Dispose(); connection.Close(); } return(raceAbilityModifiers); }
/// <summary> /// Sets the reader to object. /// </summary> /// <param name="objRaceAbilityModifier">The object race ability modifier.</param> /// <param name="result">The result.</param> private void SetReaderToObject(ref RaceAbilityModifier objRaceAbilityModifier, ref SqlDataReader result) { if (result.HasRows) { objRaceAbilityModifier.ModifierID = (int)result.GetValue(result.GetOrdinal("ModifierID")); objRaceAbilityModifier.AbilityID = (int)result.GetValue(result.GetOrdinal("AbilityID")); objRaceAbilityModifier.RaceID = (int)result.GetValue(result.GetOrdinal("RaceID")); Modifier objModifier = new Modifier(); if (!(objRaceAbilityModifier.ModifierID == 0)) { objModifier.GetModifier(objRaceAbilityModifier.ModifierID); } objRaceAbilityModifier.objModifier = objModifier; Ability objAbility = new Ability(); if (!(objRaceAbilityModifier.AbilityID == 0)) { objAbility.GetAbility(objRaceAbilityModifier.AbilityID); } objRaceAbilityModifier.objAbility = objAbility; } }
/// <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; } } }
/// <summary> /// Clones the specified object RaceAbilityModifier. /// </summary> /// <param name="objRaceAbilityModifier">The object RaceAbilityModifier.</param> /// <returns>RaceAbilityModifier</returns> static public RaceAbilityModifier Clone(RaceAbilityModifier objRaceAbilityModifier) { RaceAbilityModifier objCRaceAbilityModifier = new RaceAbilityModifier(objRaceAbilityModifier.RaceID, objRaceAbilityModifier.AbilityID, objRaceAbilityModifier.ModifierID); return(objCRaceAbilityModifier); }