/// <summary> /// Clones the specified object ArmorType. /// </summary> /// <param name="objArmorType">The object ArmorType.</param> /// <returns>ArmorType</returns> static public ArmorType Clone(ArmorType objArmorType) { ArmorType objCArmorType = new ArmorType(); if (objArmorType.ArmorTypeID != 0) { objCArmorType.GetArmorType(objArmorType.ArmorTypeID); } else { objCArmorType.ArmorTypeID = 0; objCArmorType.ArmorTypeName = objArmorType.ArmorTypeName; objCArmorType.ArmorCheckPenalty = objArmorType.ArmorCheckPenalty; objCArmorType.Speed_6 = objArmorType.Speed_6; objCArmorType.Speed_4 = objArmorType.Speed_4; objCArmorType.Speed_8 = objArmorType.Speed_8; } return(objCArmorType); }
/// <summary> /// Gets a list of ArmorTypes 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 ArmorType objects</returns> private List <ArmorType> GetArmorTypeList(string strSprocName, string strWhere, string strOrderBy) { List <ArmorType> armorTypes = new List <ArmorType>(); 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()) { ArmorType objArmorType = new ArmorType(); SetReaderToObject(ref objArmorType, ref result); armorTypes.Add(objArmorType); } } catch { Exception e = new Exception(); throw e; } finally { command.Dispose(); connection.Close(); } return(armorTypes); }
public ItemAvailabilityType SaveItemAvailabilityType() { 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_ItemAvailabilityType"; command.Parameters.Add(dbconn.GenerateParameterObj("@ItemAvailabilityTypeID", SqlDbType.Int, ItemAvailabilityTypeID.ToString(), 0)); command.Parameters.Add(dbconn.GenerateParameterObj("@ItemAvailabilityTypeName", SqlDbType.VarChar, ItemAvailabilityTypeName, 50)); command.Parameters.Add(dbconn.GenerateParameterObj("@ItemAvailabilityTypeDescription", SqlDbType.VarChar, ItemAvailabilityTypeDescription, 100)); command.Parameters.Add(dbconn.GenerateParameterObj("@ArmorType", SqlDbType.Bit, ArmorType.ToString(), 0)); command.Parameters.Add(dbconn.GenerateParameterObj("@EquipmentType", SqlDbType.Bit, EquipmentType.ToString(), 0)); command.Parameters.Add(dbconn.GenerateParameterObj("@WeaponType", SqlDbType.Bit, WeaponType.ToString(), 0)); result = command.ExecuteReader(); result.Read(); SetReaderToObject(ref result); } catch { Exception e = new Exception(); this._insertUpdateOK = false; this._insertUpdateMessage.Append(e.Message.ToString()); throw e; } finally { command.Dispose(); connection.Close(); } return(this); }