コード例 #1
0
        public ERPQuery(IPlatformServiceFactory platformServiceFactory)
        {
            Field <ListGraphType <OrderType> >("searchOrders",
                                               arguments: new QueryArguments(
                                                   new QueryArgument <NonNullGraphType <SearchOrderInputType> > {
                Name = "searchOrderInput", Description = "Search Order Input"
            }),
                                               resolve: context =>
            {
                SearchOrderInput searchOrderInput = context.GetArgument <SearchOrderInput>("searchOrderInput");
                return(platformServiceFactory.GetOrderService(searchOrderInput.Company).SearchOrders(searchOrderInput.SearchType, searchOrderInput.SearchText));
            }
                                               );

            Field <ListGraphType <OrderSummaryType> >("orderSummary",
                                                      arguments: new QueryArguments(
                                                          new QueryArgument <NonNullGraphType <StringGraphType> > {
                Name = "company", Description = "Company"
            }),
                                                      resolve: context =>
            {
                string company = context.GetArgument <string>("company");
                return(platformServiceFactory.GetOrderService(company).GetOrderSummary());
            });
        }
コード例 #2
0
        private void Sync(Object state)
        {
            DateTime createdBefore;
            DateTime createdAfter;

            if (m_lastSyncTime != null && m_counter % 50 != 0)
            {
                createdAfter = m_lastSyncTime.GetValueOrDefault();
            }
            else
            {
                createdAfter = DateTime.Now.AddDays(-7);
            }
            createdBefore = DateTime.Now.AddMinutes(-2);
            m_logger.Info("Start to sync Amazon orders created after " + createdAfter.ToLongTimeString() + " and created before " + createdBefore.ToLongTimeString());
            List <string> companies = m_platformServiceFactory.GetCompanies();

            foreach (string company in companies)
            {
                IAmazonService amazonService = m_platformServiceFactory.GetAmazonService(company);
                IOrderService  orderService  = m_platformServiceFactory.GetOrderService(company);
                orderService.SyncOrders(amazonService.GetAccountNames(), createdAfter, createdBefore);
            }

            m_lastSyncTime = createdBefore;
            m_counter++;
        }
コード例 #3
0
ファイル: OrderController.cs プロジェクト: sxinxu/erp
        public ActionResult <List <Order> > GetOrdersToShip(string company)
        {
            List <Order>  orders       = null;
            IOrderService orderService = m_platformServiceFactory.GetOrderService(company);

            if (orderService != null)
            {
                orders = orderService.GetOrdersToShip();
            }

            return(orders);
        }
コード例 #4
0
        public IActionResult SearchOrder(string company, string searchType, string searchText)
        {
            List <Order>  orders       = null;
            IOrderService orderService = m_platformServiceFactory.GetOrderService(company);

            if (orderService != null)
            {
                orders = orderService.SearchOrders(searchType, searchText);
            }

            return(Ok(orders));
        }