public InventoryTransactionController(ICoreOrderService orderService, IPurchaseOrderService purchaseOrderService, IPropertyService propertyService, IAccountServices accountServices, ILookupServices lookupServices, IProductServices productServices, IProductLookupService productLookupService) : base(orderService, propertyService, accountServices, lookupServices)
 {
     _productServices      = productServices;
     _productLookupService = productLookupService;
     _lookupServices       = lookupServices;
     _purchaseOrderService = purchaseOrderService;
 }
Exemplo n.º 2
0
 public ProductsController(IProductServices productServices, IProductLookupService productlookupServices, ICoreOrderService orderService, IPropertyService propertyService, IAccountServices accountServices, ILookupServices lookupServices, IUserService userService, IActivityServices activityServices, ITenantsServices tenantServices)
     : base(orderService, propertyService, accountServices, lookupServices)
 {
     _userService           = userService;
     _activityServices      = activityServices;
     _tenantServices        = tenantServices;
     _productlookupServices = productlookupServices;
     _lookupServices        = lookupServices;
     _productServices       = productServices;
 }
Exemplo n.º 3
0
 public PurchaseOrdersController(ITenantLocationServices tenantLocationServices, ICoreOrderService orderService, IStockTakeApiService stockTakeApiService, IPropertyService propertyService, IAccountServices accountServices,
                                 ILookupServices lookupServices, IAppointmentsService appointmentsService, IProductServices productServices, IProductLookupService productLookupService, IGaneConfigurationsHelper ganeConfigurationHelper,
                                 IEmailServices emailServices, ICommonDbServices commonDbServices, ITenantLocationServices tenantLocationservices, ISalesOrderService salesOrderService, ITenantsServices tenantsServices)
     : base(orderService, propertyService, accountServices, lookupServices, appointmentsService, ganeConfigurationHelper, emailServices, tenantLocationservices, tenantsServices)
 {
     StockTakeApiService     = stockTakeApiService;
     _productServices        = productServices;
     _productLookupService   = productLookupService;
     _orderService           = orderService;
     _tenantLocationServices = tenantLocationServices;
     _salesServices          = salesOrderService;
     _accountServices        = accountServices;
     _commonDbServices       = commonDbServices;
 }
 public PalletTrackingController(ICoreOrderService orderService, IPropertyService propertyService, IAccountServices accountServices, ILookupServices lookupServices, IProductServices productServices, IProductLookupService productLookupService) : base(orderService, propertyService, accountServices, lookupServices)
 {
     _productServices      = productServices;
     _productLookupService = productLookupService;
 }
 public ProductLocationsController(ICoreOrderService orderService, IPropertyService propertyService, IAccountServices accountServices, ILookupServices lookupServices, IProductServices productServices, IProductLookupService productLocationService) : base(orderService, propertyService, accountServices, lookupServices)
 {
     _productServices = productServices;
 }
        public StorefrontGraphQuery(
            IDataLoaderContextAccessor dataLoaderContextAccessor,
            ILanguageProvider languageProvider,
            ICurrencyProvider currencyProvider,
            IContentPageServiceProvider contentPageServiceProvider,
            INavigationServiceProvider navigationServiceProvider,
            ICategoryServiceProvider categoryServiceProvider,
            IProductServiceProvider productServiceProvider,
            IContentPageService contentPageService,
            IContentPageLookupService contentPageLookupService,
            INavigationLookupService navigationLookupService,
            ICategoryService categoryService,
            ICategoryLookupService categoryLookupService,
            IProductService productService,
            IProductLookupService productLookupService)
        {
            Name = "Query";

            #region Languages

            Field <ListGraphType <LanguageGraphType>, IList <string> >()
            .Name("Languages")
            .Description("The languages supported")
            .Resolve(ctx => languageProvider.Languages);

            #endregion Languages

            #region Currencies

            Field <ListGraphType <CurrencyGraphType>, IList <NodaMoney.Currency> >()
            .Name("Currencies")
            .Description("The currencies supported")
            .Resolve(ctx => currencyProvider.Currencies
                     .Select(NodaMoney.Currency.FromCode)
                     .ToList());

            #endregion Currencies

            #region Content Pages

            Field <ContentPageGraphType, ContentPage>()
            .Name("ContentPage")
            .Argument <StringGraphType>("id", "Id of the content page")
            .Argument <StringGraphType>("handle", "Handle of the content page")
            .ResolveAsync(ctx =>
            {
                if (!contentPageServiceProvider.IsEnabled)
                {
                    throw new ExecutionError("Content pages not supported.");
                }

                if (ctx.HasArgument("id"))
                {
                    var loader = dataLoaderContextAccessor.Context
                                 .GetOrAddBatchLoader <string, ContentPage>("ContentPage.LookupByIdAsync", contentPageLookupService.LookupByIdAsync);
                    return(loader.LoadAsync(ctx.GetArgument <string>("id")));
                }

                if (ctx.HasArgument("handle"))
                {
                    var userContext = (StorefrontGraphUserContext)ctx.UserContext;

                    var loader = dataLoaderContextAccessor.Context
                                 .GetOrAddBatchLoader <string, ContentPage>("ContentPage.LookupByHandleAsync", handles =>
                                                                            contentPageLookupService.LookupByHandleAsync(handles, userContext.LanguageCode));
                    return(loader.LoadAsync(ctx.GetArgument <string>("handle")));
                }

                return(null);
            });

            Connection <ContentPageGraphType>()
            .Name("ContentPages")
            .Unidirectional()
            .Argument <StringGraphType>("query", "The search query to filter results by")
            .Argument <ContentPageSortKeyGraphType>("sortKey", "The key to sort the underlying list by")
            .Argument <StringGraphType>("reverse", "Reverse the order of the underlying list")
            .ResolveAsync(async ctx =>
            {
                if (!contentPageServiceProvider.IsEnabled)
                {
                    throw new ExecutionError("Content pages not supported.");
                }

                var userContext = (StorefrontGraphUserContext)ctx.UserContext;

                var result = await contentPageService.GetBySearchAsync(
                    ctx.GetArgument <string>("query"),
                    userContext.LanguageCode,
                    null,
                    ctx.GetArgument <string>("after"),
                    ctx.GetArgument <int>("first", 24),
                    ctx.GetArgument <ContentPageSortKey>("sortKey"),
                    ctx.GetArgument <bool>("reverse"));

                return(result.ToGraphConnection());
            });

            #endregion Content Pages

            #region Navigations

            Field <NavigationGraphType, Navigation>()
            .Name("Navigation")
            .Argument <StringGraphType>("id", "Id of the navigation")
            .Argument <StringGraphType>("handle", "Handle of the navigation")
            .ResolveAsync(ctx =>
            {
                if (!navigationServiceProvider.IsEnabled)
                {
                    throw new ExecutionError("Navigations not supported.");
                }

                if (ctx.HasArgument("id"))
                {
                    var loader = dataLoaderContextAccessor.Context
                                 .GetOrAddBatchLoader <string, Navigation>("Navigation.LookupByIdAsync", navigationLookupService.LookupByIdAsync);
                    return(loader.LoadAsync(ctx.GetArgument <string>("id")));
                }

                if (ctx.HasArgument("handle"))
                {
                    var userContext = (StorefrontGraphUserContext)ctx.UserContext;

                    var loader = dataLoaderContextAccessor.Context
                                 .GetOrAddBatchLoader <string, Navigation>("Navigation.LookupByHandleAsync", handles =>
                                                                           navigationLookupService.LookupByHandleAsync(handles, userContext.LanguageCode));
                    return(loader.LoadAsync(ctx.GetArgument <string>("handle")));
                }

                return(null);
            });

            #endregion Navigations

            #region Categories

            Field <CategoryGraphType, Category>()
            .Name("Category")
            .Argument <StringGraphType>("id", "Id of the category")
            .Argument <StringGraphType>("handle", "Handle of the category")
            .ResolveAsync(ctx =>
            {
                if (!categoryServiceProvider.IsEnabled)
                {
                    throw new ExecutionError("Categories not supported.");
                }

                if (ctx.HasArgument("id"))
                {
                    var loader = dataLoaderContextAccessor.Context
                                 .GetOrAddBatchLoader <string, Category>("Category.LookupByIdAsync", categoryLookupService.LookupByIdAsync);
                    return(loader.LoadAsync(ctx.GetArgument <string>("id")));
                }

                if (ctx.HasArgument("handle"))
                {
                    var userContext = (StorefrontGraphUserContext)ctx.UserContext;

                    var loader = dataLoaderContextAccessor.Context
                                 .GetOrAddBatchLoader <string, Category>("Category.LookupByHandleAsync", handles =>
                                                                         categoryLookupService.LookupByHandleAsync(handles, userContext.LanguageCode));
                    return(loader.LoadAsync(ctx.GetArgument <string>("handle")));
                }

                return(null);
            });

            Connection <CategoryGraphType>()
            .Name("Categories")
            .Unidirectional()
            .Argument <StringGraphType>("query", "The search query to filter results by")
            .Argument <CategorySortKeyGraphType>("sortKey", "The key to sort the underlying list by")
            .Argument <StringGraphType>("reverse", "Reverse the order of the underlying list")
            .ResolveAsync(async ctx =>
            {
                if (!categoryServiceProvider.IsEnabled)
                {
                    throw new ExecutionError("Categories not supported.");
                }

                var userContext = (StorefrontGraphUserContext)ctx.UserContext;

                var result = await categoryService.GetBySearchAsync(
                    ctx.GetArgument <string>("query"),
                    userContext.LanguageCode,
                    null,
                    ctx.GetArgument <string>("after"),
                    ctx.GetArgument <int>("first", 24),
                    ctx.GetArgument <CategorySortKey>("sortKey"),
                    ctx.GetArgument <bool>("reverse"));

                return(result.ToGraphConnection());
            });

            #endregion Categories

            #region Products

            Field <ProductGraphType, Product>()
            .Name("Product")
            .Argument <StringGraphType>("id", "Id of the category")
            .Argument <StringGraphType>("handle", "Handle of the category")
            .ResolveAsync(ctx =>
            {
                if (!productServiceProvider.IsEnabled)
                {
                    throw new ExecutionError("Products not supported.");
                }

                if (ctx.HasArgument("id"))
                {
                    var loader = dataLoaderContextAccessor.Context
                                 .GetOrAddBatchLoader <string, Product>("Product.LookupByIdAsync", productLookupService.LookupByIdAsync);
                    return(loader.LoadAsync(ctx.GetArgument <string>("id")));
                }

                if (ctx.HasArgument("handle"))
                {
                    var userContext = (StorefrontGraphUserContext)ctx.UserContext;

                    var loader = dataLoaderContextAccessor.Context
                                 .GetOrAddBatchLoader <string, Product>("Product.LookupByHandleAsync", handles =>
                                                                        productLookupService.LookupByHandleAsync(handles, userContext.LanguageCode));
                    return(loader.LoadAsync(ctx.GetArgument <string>("handle")));
                }

                return(null);
            });

            Connection <ProductGraphType>()
            .Name("Products")
            .Unidirectional()
            .Argument <StringGraphType>("query", "The search query to filter results by")
            .Argument <ProductSortKeyGraphType>("sortKey", "The key to sort the underlying list by")
            .Argument <StringGraphType>("reverse", "Reverse the order of the underlying list")
            .ResolveAsync(async ctx =>
            {
                if (!productServiceProvider.IsEnabled)
                {
                    throw new ExecutionError("Products not supported.");
                }

                var userContext = (StorefrontGraphUserContext)ctx.UserContext;

                var result = await productService.GetBySearchAsync(
                    ctx.GetArgument <string>("query"),
                    userContext.LanguageCode,
                    null,
                    ctx.GetArgument <string>("after"),
                    ctx.GetArgument <int>("first", 24),
                    ctx.GetArgument <ProductSortKey>("sortKey"),
                    ctx.GetArgument <bool>("reverse"),
                    userContext.CurrencyCode);

                return(result.ToGraphConnection());
            });

            #endregion Products
        }
Exemplo n.º 7
0
 public ProductGroupController(ICoreOrderService orderService, IPropertyService propertyService, IAccountServices accountServices, ILookupServices lookupServices, IProductLookupService productLookupService)
     : base(orderService, propertyService, accountServices, lookupServices)
 {
     _productLookupService = productLookupService;
     _LookupService        = lookupServices;
 }
 public AssetsController(IAssetServices assetServices, ICoreOrderService orderService, IPurchaseOrderService purchaseOrderService, IPropertyService propertyService, IAccountServices accountServices, ILookupServices lookupServices, IProductServices productServices, IProductLookupService productLookupService) : base(orderService, propertyService, accountServices, lookupServices)
 {
     _assetServices = assetServices;
 }
 public TenantDataImportController(ICoreOrderService orderService, IPropertyService propertyService, IAccountServices accountServices, IProductLookupService productLookupService, ILookupServices lookupServices)
     : base(orderService, propertyService, accountServices, lookupServices)
 {
     _importFactory        = new DataImportFactory();
     _productLookupService = productLookupService;
 }