/// <summary> /// Sets the reader to object. /// </summary> /// <param name="objSkill">The object skill.</param> /// <param name="result">The result.</param> private void SetReaderToObject(ref Skill objSkill, ref SqlDataReader result) { if (result.HasRows) { objSkill.SkillID = (int)result.GetValue(result.GetOrdinal("SkillID")); objSkill.SkillName = result.GetValue(result.GetOrdinal("SkillName")).ToString(); objSkill.SkillDescription = result.GetValue(result.GetOrdinal("SkillDescription")).ToString(); objSkill.AbilityID = (int)result.GetValue(result.GetOrdinal("AbilityID")); objSkill.TrainedSkill = (bool)result.GetValue(result.GetOrdinal("TrainedSkill")); objSkill.SkillTrainingFeatID = (int)result.GetValue(result.GetOrdinal("SkillTrainingFeatID")); objSkill.AmorProfAffected = (bool)result.GetValue(result.GetOrdinal("AmorProfAffected")); List <SubSkill> subSkills = new List <SubSkill>(); SubSkill objSubKill = new SubSkill(); if (!(objSkill.SkillID == 0)) { subSkills = objSubKill.GetSubSkills("SkillID=" + objSkill.SkillID.ToString(), ""); } objSkill.SubSkills = subSkills; Ability objAbility = new Ability(); if (!(objSkill.AbilityID == 0)) { objAbility.GetAbility(objSkill.AbilityID); } objSkill.objAbility = objAbility; objSkill._objComboBoxData.Add(objSkill.SkillID, objSkill.SkillName); } }
/// <summary> /// Clones the specified LST SubSkill. /// </summary> /// <param name="lstSubSkill">The LST SubSkill.</param> /// <returns>List<SubSkill></returns> static public List <SubSkill> Clone(List <SubSkill> lstSubSkill) { List <SubSkill> lstCSubSkill = new List <SubSkill>(); foreach (SubSkill objSubSkill in lstSubSkill) { lstCSubSkill.Add(SubSkill.Clone(objSubSkill)); } return(lstCSubSkill); }
/// <summary> /// Sets the reader to object. /// </summary> /// <param name="objSubSkill">The object sub skill.</param> /// <param name="result">The result.</param> private void SetReaderToObject(ref SubSkill objSubSkill, ref SqlDataReader result) { if (result.HasRows) { objSubSkill.SubSkillID = (int)result.GetValue(result.GetOrdinal("SubSkillID")); objSubSkill.SubSkillName = result.GetValue(result.GetOrdinal("SubSkillName")).ToString(); objSubSkill.SubSkillDescription = result.GetValue(result.GetOrdinal("SubSkillDescription")).ToString(); objSubSkill.SkillID = (int)result.GetValue(result.GetOrdinal("SkillID")); objSubSkill.Trained = (bool)result.GetValue(result.GetOrdinal("Trained")); objSubSkill._objComboBoxData.Add(objSubSkill.SubSkillID, objSubSkill.SubSkillName); } }
/// <summary> /// Gets the sub skill 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 SubSkill objects</returns> private List <SubSkill> GetSubSkillList(string strSprocName, string strWhere, string strOrderBy) { List <SubSkill> subSkills = new List <SubSkill>(); 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()) { SubSkill objSubSkill = new SubSkill(); SetReaderToObject(ref objSubSkill, ref result); subSkills.Add(objSubSkill); } } catch { Exception e = new Exception(); throw e; } finally { command.Dispose(); connection.Close(); } return(subSkills); }
/// <summary> /// Clones the specified object SubSkill. /// </summary> /// <param name="objSubSkill">The object SubSkill.</param> /// <returns>SubSkill</returns> static public SubSkill Clone(SubSkill objSubSkill) { SubSkill objCSubSkill = new SubSkill(objSubSkill.SubSkillID); return(objCSubSkill); }