예제 #1
0
        /// <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();
        }
예제 #2
0
        /// <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;
        }
예제 #3
0
        /// <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();
        }