Example #1
0
        public List <Tuple <int, int, int> > GetProductCateBrandList(int cateId, int searchKeyType, int searchKeyId)
        {
            switch (searchKeyType)
            {
            case (int)ProductKeyEnum.Brand:
            {
                var attrProductList = Searches.GetProductIdListByAttrId(0, 0, 0, searchKeyId);
                if (attrProductList != null && attrProductList.Count > 0)
                {
                    return(attrProductList.Select(p => new Tuple <int, int, int>(p.Pid, p.CateId, p.BrandId)).ToList());
                }
                break;
            }

            case (int)ProductKeyEnum.Special:
            {
                var specialProductList = Searches.GetProductIdListBySpecialId(searchKeyId, 0, 0);
                if (specialProductList != null && specialProductList.Count > 0)
                {
                    return(specialProductList.Select(p => new Tuple <int, int, int>(p.Pid, p.CateId, p.BrandId)).ToList());
                }
                break;
            }

            case (int)ProductKeyEnum.Attribute:
            {
                var attrProductList = Searches.GetProductIdListByAttrId(searchKeyId, 0, 0, 0);
                if (attrProductList != null && attrProductList.Count > 0)
                {
                    return(attrProductList.Select(p => new Tuple <int, int, int>(p.Pid, p.CateId, p.BrandId)).ToList());
                }
                break;
            }

            case (int)ProductKeyEnum.AttributeValue:
            {
                var attrProductList = Searches.GetProductIdListByAttrId(0, searchKeyId, 0, 0);
                if (attrProductList != null && attrProductList.Count > 0)
                {
                    return(attrProductList.Select(p => new Tuple <int, int, int>(p.Pid, p.CateId, p.BrandId)).ToList());
                }
                break;
            }

            case (int)ProductKeyEnum.KeyWord:
            {
                var keywordProductList = Searches.GetProductIdListByKeyId(searchKeyId, 0, 0);
                if (keywordProductList != null && keywordProductList.Count > 0)
                {
                    return(keywordProductList.Select(p => new Tuple <int, int, int>(p.Pid, p.CateId, p.BrandId)).ToList());
                }
                break;
            }

            case (int)ProductKeyEnum.CategorySearch:
            {
                var attrProductList = Searches.GetProductIdListByAttrId(0, 0, searchKeyId, 0);
                if (attrProductList != null && attrProductList.Count > 0)
                {
                    return(attrProductList.Select(p => new Tuple <int, int, int>(p.Pid, p.CateId, p.BrandId)).ToList());
                }
                break;
            }
            }

            return(null);
        }