/// <summary> /// Sets the reader to object. /// </summary> /// <param name="objClassDefenseType">Type of the object class defense.</param> /// <param name="result">The result.</param> private void SetReaderToObject(ref ClassDefenseType objClassDefenseType, ref SqlDataReader result) { if (result.HasRows) { objClassDefenseType.ModifierID = (int)result.GetValue(result.GetOrdinal("ModifierID")); objClassDefenseType.DefenseTypeID = (int)result.GetValue(result.GetOrdinal("DefenseTypeID")); objClassDefenseType.ClassID = (int)result.GetValue(result.GetOrdinal("ClassID")); Modifier objModifier = new Modifier(); if (!(objClassDefenseType.ModifierID == 0)) { objModifier.GetModifier(objClassDefenseType.ModifierID); } objClassDefenseType.objModifier = objModifier; DefenseType objDefenseType = new DefenseType(); if (!(objClassDefenseType.DefenseTypeID == 0)) { objDefenseType.GetDefenseType(objClassDefenseType.DefenseTypeID); } objClassDefenseType.objDefenseType = objDefenseType; //Class objClass = new Class(); //if (!(objClassDefenseType.ClassID == 0)) //{ // objClass.GetClass (objClassDefenseType.ClassID ); //} //objClassDefenseType.objClass = objClass; } }
/// <summary> /// Sets the reader to object. /// </summary> /// <param name="objRaceDefenseTypeModifier">The object race defense type modifier.</param> /// <param name="result">The result.</param> private void SetReaderToObject(ref RaceDefenseTypeModifier objRaceDefenseTypeModifier, ref SqlDataReader result) { if (result.HasRows) { objRaceDefenseTypeModifier.ModifierID = (int)result.GetValue(result.GetOrdinal("ModifierID")); objRaceDefenseTypeModifier.DefenseTypeID = (int)result.GetValue(result.GetOrdinal("DefenseTypeID")); objRaceDefenseTypeModifier.RaceID = (int)result.GetValue(result.GetOrdinal("RaceID")); Modifier objModifier = new Modifier(); if (!(objRaceDefenseTypeModifier.ModifierID == 0)) { objModifier.GetModifier(objRaceDefenseTypeModifier.ModifierID); } objRaceDefenseTypeModifier.objModifier = objModifier; DefenseType objDefenseType = new DefenseType(); //List<DefenseType> DefenseTypes = new List<DefenseType>(); if (!(objRaceDefenseTypeModifier.RaceID == 0)) { objDefenseType.GetRaceDefenseType(" RaceID=" + objRaceDefenseTypeModifier.RaceID.ToString() + " AND [otmRaceDefenseTypeModifier].DefenseTypeID=" + objRaceDefenseTypeModifier.DefenseTypeID.ToString(), ""); } objRaceDefenseTypeModifier.objDefenseType = objDefenseType; } }
/// <summary> /// Sets the reader to object. /// </summary> /// <param name="result">The result.</param> private void SetReaderToObject(ref SqlDataReader result) { if (result.HasRows) { this.ModifierID = (int)result.GetValue(result.GetOrdinal("ModifierID")); this.DefenseTypeID = (int)result.GetValue(result.GetOrdinal("DefenseTypeID")); this.RaceID = (int)result.GetValue(result.GetOrdinal("RaceID")); Modifier objModifier = new Modifier(); if (!(this.ModifierID == 0)) { objModifier.GetModifier(this.ModifierID); } this.objModifier = objModifier; DefenseType objDefenseType = new DefenseType(); //List<DefenseType> DefenseTypes = new List<DefenseType>(); if (!(this.RaceID == 0)) { //DefenseTypes = objDefenseType.GetRaceDefenseTypes(" RaceID=" + this.RaceID.ToString(), ""); } this.objDefenseType = objDefenseType; } }
/// <summary> /// Sets the reader to object. /// </summary> /// <param name="objDefenseType">Type of the object defense.</param> /// <param name="result">The result.</param> private void SetReaderToObject(ref DefenseType objDefenseType, ref SqlDataReader result) { if (result.HasRows) { objDefenseType.DefenseTypeID = (int)result.GetValue(result.GetOrdinal("DefenseTypeID")); objDefenseType.DefenseTypeDescription = result.GetValue(result.GetOrdinal("DefenseTypeDescription")).ToString(); objDefenseType._objComboBoxData.Add(objDefenseType.DefenseTypeID, objDefenseType.DefenseTypeDescription); } }
/// <summary> /// Clones the specified LST DefenseType. /// </summary> /// <param name="lstDefenseType">The LST DefenseType.</param> /// <returns>List<DefenseType></returns> static public List <DefenseType> Clone(List <DefenseType> lstDefenseType) { List <DefenseType> lstCDefenseType = new List <DefenseType>(); foreach (DefenseType objDefenseType in lstDefenseType) { lstCDefenseType.Add(DefenseType.Clone(objDefenseType)); } return(lstCDefenseType); }
/// <summary> /// Gets the race defense type modifiers by race. /// </summary> /// <param name="RaceID">The race identifier.</param> /// <param name="strOrderBy">The string order by.</param> /// <returns>List of RaceDefenseTypeModifier objects</returns> public List <RaceDefenseTypeModifier> GetRaceDefenseTypeModifiersByRace(int RaceID, string strOrderBy) { //string strWhere = ""; //strWhere = " RaceID=" + RaceID.ToString() + " AND [otmRaceDefenseTypeModifier].DefenseTypeID=" + objDefenseType.DefenseTypeID.ToString(); //return GetRaceDefenseTypeModifierList("Select_RaceDefenseTypeModifier", strWhere, strOrderBy); //This one is different!!!! Have to loop through each defense type individually to get the where clause. List <DefenseType> objDefenseTypes = new List <DefenseType>(); DefenseType objDefType = new DefenseType(); objDefenseTypes = objDefType.GetRaceDefenseTypes("", ""); string strWhere = ""; List <RaceDefenseTypeModifier> raceDefenseTypeModifier = new List <RaceDefenseTypeModifier>(); try { foreach (DefenseType objDefenseType in objDefenseTypes) { SqlDataReader result; DatabaseConnection dbconn = new DatabaseConnection(); SqlCommand command = new SqlCommand(); SqlConnection connection = new SqlConnection(dbconn.SQLSEVERConnString); strWhere = " RaceID=" + RaceID.ToString() + " AND [otmRaceDefenseTypeModifier].DefenseTypeID=" + objDefenseType.DefenseTypeID.ToString(); connection.Open(); command.Connection = connection; command.CommandType = CommandType.StoredProcedure; command.CommandText = "Select_RaceDefenseTypeModifier"; 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()) { RaceDefenseTypeModifier objRaceDefenseTypeModifier = new RaceDefenseTypeModifier(); SetReaderToObject(ref objRaceDefenseTypeModifier, ref result); raceDefenseTypeModifier.Add(objRaceDefenseTypeModifier); } command.Dispose(); connection.Close(); } } catch { Exception e = new Exception(); throw e; } return(raceDefenseTypeModifier); }
/// <summary> /// Sets the reader to object. /// </summary> /// <param name="objSizeDefenseModifier">The object size defense modifier.</param> /// <param name="result">The result.</param> private void SetReaderToObject(ref SizeDefenseModifier objSizeDefenseModifier, ref SqlDataReader result) { if (result.HasRows) { objSizeDefenseModifier.SizeID = (int)result.GetValue(result.GetOrdinal("SizeID")); objSizeDefenseModifier.DefenseTypeID = (int)result.GetValue(result.GetOrdinal("DefenseID")); objSizeDefenseModifier.ModifierID = (int)result.GetValue(result.GetOrdinal("ModifierID")); DefenseType objDefenseType = new DefenseType(); Modifier objModifier = new Modifier(); objSizeDefenseModifier.objDefenseType = objDefenseType.GetDefenseType(objSizeDefenseModifier.DefenseTypeID); objSizeDefenseModifier.objModifier = objModifier.GetModifier(objSizeDefenseModifier.ModifierID); } }
/// <summary> /// Sets the reader to object. /// </summary> /// <param name="objDefense">The object defense.</param> /// <param name="result">The result.</param> private void SetReaderToObject(ref CharacterDefense objDefense, ref SqlDataReader result) { if (result.HasRows) { //objDefense.DefenseID = (int)result.GetValue(result.GetOrdinal("DefenseID")); objDefense.DefenseTypeID = (int)result.GetValue(result.GetOrdinal("DefenseTypeID")); objDefense.CharacterLevelArmor = (int)result.GetValue(result.GetOrdinal("CharacterLevelArmor")); objDefense.AbilityMod = (int)result.GetValue(result.GetOrdinal("AbilityMod")); objDefense.ClassMod = (int)result.GetValue(result.GetOrdinal("ClassMod")); objDefense.RaceMod = (int)result.GetValue(result.GetOrdinal("RaceMod")); objDefense.FeatTalentMod = (int)result.GetValue(result.GetOrdinal("FeatTalentMod")); objDefense.MiscellaneousMod = (int)result.GetValue(result.GetOrdinal("MiscellaneousMod")); DefenseType obDefenseType = new DefenseType(); if (!(objDefense.DefenseTypeID == 0)) { obDefenseType.GetDefenseType(objDefense.DefenseTypeID); } objDefense.DefenseType = obDefenseType; } }
/// <summary> /// Gets the defense type 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 DefenseType Objects</returns> private List <DefenseType> GetDefenseTypeList(string strSprocName, string strWhere, string strOrderBy) { List <DefenseType> defenseTypes = new List <DefenseType>(); 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()) { DefenseType objDefenseType = new DefenseType(); SetReaderToObject(ref objDefenseType, ref result); defenseTypes.Add(objDefenseType); } } catch { Exception e = new Exception(); throw e; } finally { command.Dispose(); connection.Close(); } return(defenseTypes); }
/// <summary> /// Clones the specified object DefenseType. /// </summary> /// <param name="objDefenseType">The object DefenseType.</param> /// <returns>DefenseType</returns> static public DefenseType Clone(DefenseType objDefenseType) { DefenseType objCDefenseType = new DefenseType(objDefenseType.DefenseTypeID); return(objCDefenseType); }