Example #1
0
        private void DeleteProductCode(string sql)
        {
            ProductCodeCollection oCodeList = ProductCode.LoadCollection(sql);

            foreach (ProductCode oCode in oCodeList)
            {
                oCode.Delete();
            }
        }
Example #2
0
        /// <summary>
        /// Loads a collection of ProductCode objects from the database.
        /// </summary>
        /// <returns>A collection containing all of the ProductCode objects in the database.</returns>
        public static ProductCodeCollection LoadCollection(string spName, SqlParameter[] parms)
        {
            ProductCodeCollection result = new ProductCodeCollection();

            using (SqlDataReader reader = SqlHelper.Default.ExecuteReader(spName, parms))
            {
                while (reader.Read())
                {
                    ProductCode tmp = new ProductCode();
                    tmp.LoadFromReader(reader);
                    result.Add(tmp);
                }
            }
            return(result);
        }