/// <summary> /// Clones the specified LST CharacterEquipment. /// </summary> /// <param name="lstCharacterEquipment">The LST CharacterEquipment.</param> /// <returns>List<CharacterEquipment></returns> static public List <CharacterEquipment> Clone(List <CharacterEquipment> lstCharacterEquipment) { List <CharacterEquipment> lstCEquip = new List <CharacterEquipment>(); foreach (CharacterEquipment objCharEquip in lstCharacterEquipment) { lstCEquip.Add(CharacterEquipment.Clone(objCharEquip)); } return(lstCEquip); }
/// <summary> /// Clones the specified object CharacterEquipmen. /// </summary> /// <param name="objCharacterEquipment">The object CharacterEquipmen.</param> /// <returns>CharacterEquipmen</returns> static public CharacterEquipment Clone(CharacterEquipment objCharacterEquipment) { CharacterEquipment objCEquip = new CharacterEquipment(); objCEquip.CharacterEquipmentID = objCharacterEquipment.CharacterEquipmentID; objCEquip.CharacterID = objCharacterEquipment.CharacterID; objCEquip.EquipmentID = objCharacterEquipment.EquipmentID; objCEquip.Notes = objCharacterEquipment.Notes; return(objCEquip); }
private void SetReaderToObject(ref CharacterEquipment objCharacterEquipment, ref SqlDataReader result) { if (result.HasRows) { objCharacterEquipment.CharacterEquipmentID = (int)result.GetValue(result.GetOrdinal("CharacterEquipmentID")); objCharacterEquipment.CharacterID = (int)result.GetValue(result.GetOrdinal("CharacterID")); objCharacterEquipment.EquipmentID = (int)result.GetValue(result.GetOrdinal("EquipmentID")); objCharacterEquipment.Notes = result.GetValue(result.GetOrdinal("Notes")).ToString(); objCharacterEquipment.Quantity = (int)result.GetValue(result.GetOrdinal("Quantity")); objCharacterEquipment.objEquipment = new Equipment(objCharacterEquipment.EquipmentID); Modification objModification = new Modification(); objCharacterEquipment.lstModifications = objModification.GetCharacterEquipmentModifications(objCharacterEquipment.CharacterEquipmentID); } }
private List <CharacterEquipment> GetCharacterEquipmentList(string strSprocName, string strWhere, string strOrderBy) { List <CharacterEquipment> CharacterEquipments = new List <CharacterEquipment>(); 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()) { CharacterEquipment objCharacterEquipment = new CharacterEquipment(); SetReaderToObject(ref objCharacterEquipment, ref result); CharacterEquipments.Add(objCharacterEquipment); } } catch { Exception e = new Exception(); throw e; } finally { command.Dispose(); connection.Close(); } return(CharacterEquipments); }