Exemple #1
0
        public override string GetSqlCondition(string fieldName)
        {
            if (string.IsNullOrEmpty(ParamName))
            {
                return(SearchCondition);
            }
            if (!string.IsNullOrEmpty(SearchCondition))
            {
                return(SearchCondition);
            }

            string       sqlSubcomand;
            const string template = @"SELECT [ProductID] FROM [Catalog].Offer";

            string categoryCondishion = GetSubCategoryes ? " WHERE [CategoryID] IN (SELECT id FROM [Settings].[GetChildCategoryByParent](" + ParamName + "_CatId" + ")) " : " WHERE [CategoryID]=" + ParamName + "_CatId ";

            if (ListFilter.Any())
            {
                sqlSubcomand = string.Format("{0}{1} AND [ColorID] in ({2}) and offer.amount > 0", template, categoryCondishion, ListFilter.AggregateString(','));
            }
            else
            {
                sqlSubcomand = template + categoryCondishion + ")";
            }

            return(SearchCondition = fieldName + " in (" + sqlSubcomand + ")");
        }
Exemple #2
0
        public override string GetSqlCondition(string fieldName)
        {
            if (string.IsNullOrEmpty(ParamName))
            {
                return(SearchCondition);
            }
            if (!string.IsNullOrEmpty(SearchCondition))
            {
                return(SearchCondition);
            }

            string       sqlSubcomand;
            const string template = @"SELECT Offer.[ProductID] FROM [Catalog].Offer inner join Catalog.Product on Offer.ProductID=Product.ProductID inner join catalog.ProductCategories on Product.ProductID=ProductCategories.ProductID";

            var categoryCondishion = GetSubCategoryes
                                            ? string.Format(
                "WHERE [CategoryID] IN (SELECT id FROM [Settings].[GetChildCategoryByParent]({0}_CatId)) ", ParamName)
                                            : string.Format("WHERE [CategoryID]={0}_CatId ", ParamName);

            if (ListFilter.Any())
            {
                sqlSubcomand = string.Format("{0} {1} AND [SizeID] in ({2}) and offer.amount > 0", template, categoryCondishion, ListFilter.AggregateString(','));
            }
            else
            {
                sqlSubcomand = template + categoryCondishion + ")";
            }

            return(SearchCondition = string.Format("{0} in ({1})", fieldName, sqlSubcomand));
        }