public static void SetCatalogQuery(this IResolveFieldContext context, ICatalogQuery query) { context.UserContext["storeId"] = query.StoreId; context.UserContext["userId"] = query.UserId; context.UserContext["currencyCode"] = query.CurrencyCode; context.UserContext["cultureName"] = query.CultureName; }
public IList <CatalogHolder <T> > GetList <T>(ICatalogQuery query) where T : CatalogObjectBase { var catalogType = CatalogObjectExtensions.GetCatalogTypeFromAttribute <T>(); var newQuery = new AndExpression( new EqualsExpression("catalogType", catalogType), query); var whereClause = newQuery.GetExpression(); var parameters = newQuery.GetParameters(); var sql = "SELECT * FROM [catalog] WHERE " + whereClause; var list = _provider.GetObjectsSqlite <CatalogItem>(sql, parameters); if (list == null || list.Count == 0) { return(null); } return(list.Select(i => GetCatalogContent <T>(i)).ToList()); }
public AndExpression(ICatalogQuery first, ICatalogQuery second) { First = first; Second = second; }