Exemple #1
0
 public static void PopulateProductTypeItemList(IDataReader dr, ProductTypeItem _productTypeItem)
 {
     _productTypeItem.ProductTypeID          = (int)dr["producttypeid"];
     _productTypeItem.ProductTypeCode        = dr["producttypecode"] as string;
     _productTypeItem.ProductTypeDescription = dr["producttypedescription"] as string;
     _productTypeItem.IsDisplayed            = (bool)dr["isdisplayed"];
 }
        public override List <ProductTypeItem> GetProductTypeItemList()
        {
            List <ProductTypeItem> list = new List <ProductTypeItem>();

            using (SqlConnection connection = this.GetSqlConnection())
            {
                string     cmdText = "select * from SuCommerce_ProductTypes where IsDisplayed = 1";
                SqlCommand command = new SqlCommand(cmdText, connection)
                {
                    CommandType = CommandType.Text
                };
                connection.Open();
                using (SqlDataReader reader = command.ExecuteReader(CommandBehavior.CloseConnection))
                {
                    ProductTypeItem item = null;
                    while (reader.Read())
                    {
                        item = new ProductTypeItem();
                        CommerceDataProvider.PopulateProductTypeItemList(reader, item);
                        list.Add(item);
                    }
                    reader.Close();
                    connection.Close();
                }
            }
            return(list);
        }