예제 #1
0
        /// <summary>
        /// Loads a collection of ProductDim objects from the database.
        /// </summary>
        /// <returns>A collection containing all of the ProductDim objects in the database.</returns>
        public static ProductDimCollection LoadCollection(string spName, SqlParameter[] parms)
        {
            ProductDimCollection result = new ProductDimCollection();

            using (SqlDataReader reader = SqlHelper.Default.ExecuteReader(spName, parms))
            {
                while (reader.Read())
                {
                    ProductDim tmp = new ProductDim();
                    tmp.LoadFromReader(reader);
                    result.Add(tmp);
                }
            }
            return(result);
        }
        private void FillCombinList()
        {
            cboCombinationNum.DataSource = null;
            //cboCombinationNum.Items.Clear();

            string[]             orderBy  = new string[] { "DimCode" };
            ProductDimCollection oDimList = ProductDim.LoadCollection(orderBy, true);

            // ----------------------------------------------------------------------------------------------------
            // 2008-05-29 Carrie : Bug #337
            // Avoid loading incorrect Combination List for EMPTY Combin#, it changes to insert EMPTY record at the top of list.
            // ----------------------------------------------------------------------------------------------------
            // Inset New EMPTY record
            oDimList.Insert(0, new ProductDim());

            cboCombinationNum.DataSource    = oDimList;
            cboCombinationNum.DisplayMember = "DimCode";
            cboCombinationNum.ValueMember   = "DimensionId";

            // ----------------------------------------------------------------------------------------------------
            // 2008-05-29 Carrie : EMPTY record has been inserted into the top so that the default "SelectedIndex" set to be 0.
            // ----------------------------------------------------------------------------------------------------
            cboCombinationNum.SelectedIndex = 0;
        }