示例#1
0
        private void FillParentNatureList()
        {
            string sql = "NatureId NOT IN ('" + this.ProductNatureId.ToString() + "')";

            string[] orderBy = new string[] { "NatureCode" };
            ProductNatureCollection oProductNatureList = ProductNature.LoadCollection(sql, orderBy, true);

            oProductNatureList.Add(new ProductNature());
            cboParentNature.DataSource    = oProductNatureList;
            cboParentNature.DisplayMember = "NatureCode";
            cboParentNature.ValueMember   = "NatureId";

            cboParentNature.SelectedIndex = cboParentNature.Items.Count - 1;
        }
示例#2
0
        /// <summary>
        /// Loads a collection of ProductNature objects from the database.
        /// </summary>
        /// <returns>A collection containing all of the ProductNature objects in the database.</returns>
        public static ProductNatureCollection LoadCollection(string spName, SqlParameter[] parms)
        {
            ProductNatureCollection result = new ProductNatureCollection();

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