private void FillAppendixe_To()
        {
            // Appendixe1
            cboAppendix1_To.Items.Clear();
            string[] orderBy = new string[] { "Appendix1Code" };
            ProductAppendix1Collection oA1ListTo = ProductAppendix1.LoadCollection(orderBy, true);

            oA1ListTo.Insert(0, new ProductAppendix1());
            cboAppendix1_To.DataSource    = oA1ListTo;
            cboAppendix1_To.DisplayMember = "Appendix1Code";
            cboAppendix1_To.ValueMember   = "Appendix1Id";
            cboAppendix1_To.SelectedIndex = oA1ListTo.Count - 1;

            // Appendixe2
            cboAppendix2_To.Items.Clear();
            orderBy = new string[] { "Appendix2Code" };
            ProductAppendix2Collection oA2ListTo = ProductAppendix2.LoadCollection(orderBy, true);

            oA2ListTo.Insert(0, new ProductAppendix2());
            cboAppendix2_To.DataSource    = oA2ListTo;
            cboAppendix2_To.DisplayMember = "Appendix2Code";
            cboAppendix2_To.ValueMember   = "Appendix2Id";
            cboAppendix2_To.SelectedIndex = oA2ListTo.Count - 1;

            // Appendixe3
            cboAppendix3_To.Items.Clear();
            orderBy = new string[] { "Appendix3Code" };
            ProductAppendix3Collection oA3ListTo = ProductAppendix3.LoadCollection(orderBy, true);

            oA3ListTo.Insert(0, new ProductAppendix3());
            cboAppendix3_To.DataSource    = oA3ListTo;
            cboAppendix3_To.DisplayMember = "Appendix3Code";
            cboAppendix3_To.ValueMember   = "Appendix3Id";
            cboAppendix3_To.SelectedIndex = oA3ListTo.Count - 1;
        }
        private void FillAppendixe2()
        {
            cboAppendix2.Items.Clear();

            string[] orderBy = new string[] { "Appendix2Code" };
            ProductAppendix2Collection oA2List = ProductAppendix2.LoadCollection(orderBy, true);

            oA2List.Add(new ProductAppendix2());
            cboAppendix2.DataSource    = oA2List;
            cboAppendix2.DisplayMember = "Appendix2Code";
            cboAppendix2.ValueMember   = "Appendix2Id";
            cboAppendix2.SelectedIndex = cboAppendix2.Items.Count - 1;
        }
Exemplo n.º 3
0
        /// <summary>
        /// Loads a collection of ProductAppendix2 objects from the database.
        /// </summary>
        /// <returns>A collection containing all of the ProductAppendix2 objects in the database.</returns>
        public static ProductAppendix2Collection LoadCollection(string spName, SqlParameter[] parms)
        {
            ProductAppendix2Collection result = new ProductAppendix2Collection();

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