/// <summary> /// Sets the reader to the Paramter BaseAttack object. /// </summary> /// <param name="objBaseAttack">The object base attack.</param> /// <param name="result">The result.</param> private void SetReaderToObject(ref BaseAttack objBaseAttack, ref SqlDataReader result) { if (result.HasRows) { objBaseAttack.BaseAttackID = (int)result.GetValue(result.GetOrdinal("BaseAttackID")); objBaseAttack.BaseAttackNumber = (int)result.GetValue(result.GetOrdinal("BaseAttackNumber")); } }
/// <summary> /// Clones the specified List of BaseAttack objectds. /// </summary> /// <param name="lstBaseAttack">The LST BaseAttack.</param> /// <returns>List [BaseAttack]</returns> static public List <BaseAttack> Clone(List <BaseAttack> lstBaseAttack) { List <BaseAttack> lstCBaseAttack = new List <BaseAttack>(); foreach (BaseAttack objBaseAttack in lstBaseAttack) { lstCBaseAttack.Add(BaseAttack.Clone(objBaseAttack)); } return(lstCBaseAttack); }
/// <summary> /// Clones the specified BaseAttack object . /// </summary> /// <param name="objBaseAttack">The object BaseAttack.</param> /// <returns>BaseAttack</returns> static public BaseAttack Clone(BaseAttack objBaseAttack) { BaseAttack objCBaseAttack = new BaseAttack(); if (objBaseAttack.BaseAttackID != 0) { objCBaseAttack.GetBaseAttack(objBaseAttack.BaseAttackID); } else { objCBaseAttack.BaseAttackID = 0; objCBaseAttack.BaseAttackNumber = objBaseAttack.BaseAttackNumber; } return(objCBaseAttack); }
/// <summary> /// Sets the reader to object. /// </summary> /// <param name="result">The result.</param> private void SetReaderToObject(ref SqlDataReader result) { if (result.HasRows) { this.TalentID = (int)result.GetValue(result.GetOrdinal("TalentID")); this.TalentName = result.GetValue(result.GetOrdinal("TalentName")).ToString(); this.TalentDescription = result.GetValue(result.GetOrdinal("TalentDescription")).ToString(); this.TalentTreeID = (int)result.GetValue(result.GetOrdinal("TalentTreeID")); this.MultipleSelection = (int)result.GetValue(result.GetOrdinal("MultipleSelection")); this.BookID = (int)result.GetValue(result.GetOrdinal("BookID")); this.TalentSpecial = result.GetValue(result.GetOrdinal("TalentSpecial")).ToString(); this._objComboBoxData.Add(this.TalentID, this.TalentName); TurnSegment objTurnSegment = new TurnSegment(); if (!(this.TurnSegmentID == 0)) { objTurnSegment.GetTurnSegment(this.TurnSegmentID); } this.objTurnSegment = objTurnSegment; Talent objPreTalent = new Talent(); this.objPrerequsiteTalent = objPreTalent.GetPrerequisteTalents(" otmTalentPrerequisteTalent.TalentID=" + this.TalentID.ToString(), "TalentName"); //List<Ability> objPrerequisteAbility TalentPrerequisteAbility objTalentPrerequisteAbility = new TalentPrerequisteAbility(); this.objTalentPrerequisteAbility = objTalentPrerequisteAbility.GetTalentPrerequisteAbilities("TalentID=" + this.TalentID.ToString(), ""); Skill objSkill = new Skill(); this.objTalentPrerequsiteSkill = objSkill.GetTalentRequiredSkills("TalentID=" + this.TalentID.ToString(), ""); Feat objFeat = new Feat(); this.objTalentPrerequsiteFeat = objFeat.GetTalentPrerequisiteFeats("TalentID=" + this.TalentID.ToString(), ""); ForcePower objPreForcePower = new ForcePower(); this.objTalentPrerequisteForcePower = objPreForcePower.GetTalentPrequisteForcePowers("TalentID=" + this.TalentID.ToString(), ""); BaseAttack objBaseAttack = new BaseAttack(); this.objBaseAttackPrerequisite = objBaseAttack.GetFeatPrequisiteBaseAttackBonus(this.TalentID); } }
/// <summary> /// Sets the reader to object. /// </summary> /// <param name="objFeat">The object feat.</param> /// <param name="result">The result.</param> private void SetReaderToObject(ref Feat objFeat, ref SqlDataReader result) { if (result.HasRows) { objFeat.FeatID = (int)result.GetValue(result.GetOrdinal("FeatID")); objFeat.FeatName = result.GetValue(result.GetOrdinal("FeatName")).ToString(); objFeat.FeatDescription = result.GetValue(result.GetOrdinal("FeatDescription")).ToString(); objFeat.FeatSpecial = result.GetValue(result.GetOrdinal("FeatSpecial")).ToString(); objFeat.RageRequired = (bool)result.GetValue(result.GetOrdinal("RageRequired")); objFeat.ShapeShiftRequired = (bool)result.GetValue(result.GetOrdinal("ShapeShiftRequired")); objFeat.MultipleSelection = (int)result.GetValue(result.GetOrdinal("MultipleSelection")); objFeat.BookID = (int)result.GetValue(result.GetOrdinal("BookID")); objFeat.SkillTrainingFeat = (bool)result.GetValue(result.GetOrdinal("SkillTrainingFeat")); objFeat.SkillFocusFeat = (bool)result.GetValue(result.GetOrdinal("SkillFocusFeat")); objFeat.WeaponProficiencyID = (bool)result.GetValue(result.GetOrdinal("WeaponProficiencyID")); objFeat.ArmorProficiencyID = (bool)result.GetValue(result.GetOrdinal("ArmorProficiencyID")); FeatPrerequisiteAbility objFeatPrerequisiteAbility = new FeatPrerequisiteAbility(); Feat objPreReqFeat = new Feat(); BaseAttack objBaseAttack = new BaseAttack(); Skill objSkill = new Skill(); Race objRace = new Race(); Class objClass = new Class(); Size objSize = new Size(); FeatPrerequisiteDarkSide objFeatPrerequisiteDarkSide = new FeatPrerequisiteDarkSide(); FeatPrereqORCondition objFeatPrereqORCondition = new FeatPrereqORCondition(); objFeat.objFeatPrerequisiteAbilities = objFeatPrerequisiteAbility.GetFeatPrerequisiteAbilites(" FeatID=" + objFeat.FeatID.ToString(), ""); objFeat.objFeatPrerequisiteFeats = objPreReqFeat.GetFeatPrerequisiteFeats(" [otmFeatPrequisiteFeat].FeatID=" + objFeat.FeatID.ToString(), " FeatName"); objFeat.objBaseAttackPrerequisite = objBaseAttack.GetFeatPrequisiteBaseAttackBonus(objFeat.FeatID); objFeat.objSkillPrerequisite = objSkill.GetFeatPrerequisiteSkill(objFeat.FeatID); objFeat.objFeatPrerequisiteClasses = objClass.GetFeatPrerequisiteClass(objFeat.FeatID); objFeat.objRacePrerequisite = objRace.GetFeatPrerequisiteRace(objFeat.FeatID); objFeat.objFeatPrerequisiteSize = objSize.GetFeatPrerequisiteSize(objFeat.FeatID); objFeat.objFeatPrerequisiteDarkSide = objFeatPrerequisiteDarkSide.GetFeatPrerequisiteDarkSide(objFeat.FeatID); objFeat.lstFeatPrereqORConditions = objFeatPrereqORCondition.GetFeatPrereqORConditions(objFeat.FeatID); objFeat._objComboBoxData.Add(objFeat.FeatID, objFeat.FeatName); } }
/// <summary> /// Gets a list of BaseAttack objects from the Database. /// </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 BaseAttack Objects</returns> private List <BaseAttack> GetBaseAttackList(string strSprocName, string strWhere, string strOrderBy) { List <BaseAttack> lstBaseAttacks = new List <BaseAttack>(); 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()) { BaseAttack objBaseAttack = new BaseAttack(); SetReaderToObject(ref objBaseAttack, ref result); lstBaseAttacks.Add(objBaseAttack); } } catch { Exception e = new Exception(); throw e; } finally { command.Dispose(); connection.Close(); } return(lstBaseAttacks); }
/// <summary> /// Saves the ClassLevelInfo. /// </summary> /// <returns>ClassLevelInfo Object</returns> public ClassLevelInfo SaveClassLevelInfo() { 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 = "InsertUpdate_ClassLevel"; command.Parameters.Add(dbconn.GenerateParameterObj("@ClassLevelID", SqlDbType.Int, ClassLevelID.ToString(), 0)); command.Parameters.Add(dbconn.GenerateParameterObj("@ClassID", SqlDbType.Int, ClassID.ToString(), 0)); command.Parameters.Add(dbconn.GenerateParameterObj("@ClassLevel", SqlDbType.Int, ClassLevel.ToString(), 0)); command.Parameters.Add(dbconn.GenerateParameterObj("@BonusFeat", SqlDbType.Int, BonusFeat.ToString(), 0)); command.Parameters.Add(dbconn.GenerateParameterObj("@Talent", SqlDbType.Int, Talent.ToString(), 0)); command.Parameters.Add(dbconn.GenerateParameterObj("@BaseAttack", SqlDbType.Int, BaseAttack.ToString(), 0)); command.Parameters.Add(dbconn.GenerateParameterObj("@ForcePointBase", SqlDbType.Int, ForcePointBase.ToString(), 0)); command.Parameters.Add(dbconn.GenerateParameterObj("@ForceTechnique", SqlDbType.Int, ForceTechnique.ToString(), 0)); command.Parameters.Add(dbconn.GenerateParameterObj("@ForceSecret", SqlDbType.Int, ForceSecret.ToString(), 0)); command.Parameters.Add(dbconn.GenerateParameterObj("@MedicalSecret", SqlDbType.Int, MedicalSecret.ToString(), 0)); result = command.ExecuteReader(); result.Read(); SetReaderToObject(ref result); } catch { Exception e = new Exception(); this._insertUpdateOK = false; this._insertUpdateMessage.Append(e.Message + " Inner Exception= " + e.InnerException); throw e; } finally { command.Dispose(); connection.Close(); } return(this); }