示例#1
0
        public virtual IList <BrandInfo> GetProductBrands(int ProductTypeID)
        {
            BrandInfo         entity        = null;
            SqlDataReader     RdrList       = null;
            IList <BrandInfo> entitys       = null;
            string            brand_arrystr = "";

            try
            {
                string SqlList;

                SqlList = "SELECT * FROM ProductType_Brand WHERE ProductType_Brand_ProductTypeID = " + ProductTypeID;
                RdrList = DBHelper.ExecuteReader(SqlList);
                if (RdrList.HasRows)
                {
                    while (RdrList.Read())
                    {
                        brand_arrystr = brand_arrystr + Tools.NullInt(RdrList["ProductType_Brand_BrandID"]) + ",";
                    }
                }
                RdrList.Close();
                RdrList = null;

                if (brand_arrystr != "")
                {
                    entitys = new List <BrandInfo>();
                    foreach (string i in brand_arrystr.Split(','))
                    {
                        if (Tools.CheckInt(i) > 0)
                        {
                            entity = new BrandInfo();
                            entity = MyBrand.GetBrandByID(Tools.CheckInt(i));
                            if (entity != null)
                            {
                                entitys.Add(entity);
                            }
                            entity = null;
                        }
                    }
                }

                return(entitys);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (RdrList != null)
                {
                    RdrList.Close();
                    RdrList = null;
                }
            }
        }
示例#2
0
 //根据ID获取品牌信息
 public BrandInfo GetBrandByID(int Brand_ID)
 {
     return(brand.GetBrandByID(Brand_ID, Public.GetUserPrivilege()));
 }