/// <summary> /// Saves a record to the Cargo table. /// </summary> public void Insert(Cargo cargo) { ValidationUtility.ValidateArgument("cargo", cargo); SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@Cargo", cargo.CargoDescricpion) }; cargo.IdCargo = (int) SqlClientUtility.ExecuteScalar(connectionStringName, CommandType.StoredProcedure, "CargoInsert", parameters); SqlConnection.ClearAllPools(); }
/// <summary> /// Creates a new instance of the Cargo class and populates it with data from the specified SqlDataReader. /// </summary> private Cargo MapDataReader(SqlDataReader dataReader) { Cargo Cargo = new Cargo(); Cargo.IdCargo = dataReader.GetInt32("IdCargo", 0); Cargo.CargoDescricpion = dataReader.GetString("Cargo", null); return Cargo; }
/// <summary> /// Updates a record in the Cargo table. /// </summary> public void Update(Cargo cargo) { ValidationUtility.ValidateArgument("cargo", cargo); SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@IdCargo", cargo.IdCargo), new SqlParameter("@Cargo", cargo.CargoDescricpion) }; SqlClientUtility.ExecuteNonQuery(connectionStringName, CommandType.StoredProcedure, "CargoUpdate", parameters); SqlConnection.ClearAllPools(); }