Пример #1
0
        //根据业态,楼层,特约商户,查询品牌列表
        public List <t_brand> GetBrandListByBusinessFormatAndFloor(String businessFormatText, String floorText, bool VipFlag)
        {
            List <t_brand> brandList = new List <t_brand>();
            //品牌列表
            List <String> code_list = new List <String>();
            //楼层
            String floor_code = String.Empty;

            //判断业态是否为空
            if (!String.IsNullOrWhiteSpace(businessFormatText))
            {
                t_word bf_word = getWordBySynonym(businessFormatText);
                //判断业态是否可以查询到
                if (null != bf_word)
                {
                    //查询到则获得bb列表
                    List <t_brand_businessformat> bb_list = bbDao.getBusinessformatByBrandAndBf(null, bf_word.code);
                    //t_brand_businessformat有把brand_code存起来
                    if (bb_list.Count > 0)
                    {
                        foreach (t_brand_businessformat brand_businessformat in bb_list)
                        {
                            code_list.Add(brand_businessformat.brand_code);
                        }
                    }
                    //t_brand_businessformat没有就返回空列表
                    else
                    {
                        return(brandList);
                    }
                }
                //业态查询不到就返回空列表
                else
                {
                    return(brandList);
                }
            }

            //判断楼层是否为空
            if (!String.IsNullOrWhiteSpace(floorText))
            {
                t_word f_word = getWordBySynonym(floorText);
                //判断楼层是否可以查询到
                if (null != f_word)
                {
                    floor_code = f_word.code;
                }
                //楼层查询不到就返回空列表
                else
                {
                    return(brandList);
                }
            }

            brandList = brandDao.getBrandByCondition(code_list.ToArray(), floor_code, VipFlag);

            //t_brand tmp = new t_brand();

            //String a = "";
            //foreach (String s in code_list)
            //{
            //    a += s + "、";
            //}

            //tmp.code = " code_list = " + a + " floor = " + floor_code + " vipflag = " + VipFlag;

            //brandList.Add(tmp);

            //取前5条
            if (brandList.Count >= 5)
            {
                brandList = brandList.Take(5).ToList();
            }
            return(brandList);
        }