Beispiel #1
0
        /*private void OnOrderClosed(IOrder order)
         * {
         *  PluginContext.Log.Info($"Order {order.Number} ({order.Id}) is Close.");
         *  var json = OrderHelper.GetOrderClosePackageJson(order);
         *  HttpSender.AddTask(new HttpSenderTask { Url = HttpSender.PostChequeUrl, Json = json, Method = HttpMethod.Delete });
         * }*/

        /*private void OnOrderBill(IOrder order)
         * {
         *  PluginContext.Log.Info($"Order {order.Number} ({order.Id}) is Bill.");
         *  var json = OrderHelper.GetOrderPackageJson(order);
         *  HttpSender.AddTask(new HttpSenderTask { Url = HttpSender.PostChequeUrl, Json = json, Method = HttpMethod.Post });
         * }*/

        private void OnOrderChange(IOrder order)
        {
            PluginContext.Log.Info($"Order {order.Number} ({order.Id}) is Changed.");
            string json = null;

            try
            {
                json = OrderHelper.GetOrderPackageJson(order);
            }
            catch (Exception e)
            {
                PluginContext.Log.Error($"get order error by {order.Id}", e);
            }

            if (json != null)
            {
                try
                {
                    HttpSender.AddTask(new HttpSenderTask {
                        Url = HttpSender.PostChequeUrl, Json = json, Method = HttpMethod.Post
                    });
                }
                catch (Exception e)
                {
                    PluginContext.Log.Error($"add task to HttpSender error", e);
                }
            }
        }
Beispiel #2
0
        private void OnServiceChequePrinted(IOrder order, IOperationService service, IViewManager manager)
        {
            PluginContext.Log.Info("Printed precheck");
            var json = OrderHelper.GetOrderPackageJson(order);

            HttpSender.AddTask(new HttpSenderTask {
                Url = HttpSender.PostChequeUrl, Json = json
            });
            PluginContext.Log.Info(json);
        }
Beispiel #3
0
        private BillCheque OnBillChequePrinting(Guid orderId)
        {
            PluginContext.Log.Info("Printing precheck");
            var order = PluginContext.Operations.GetOrderById(orderId);
            var json  = OrderHelper.GetOrderPackageJson(order);

            PluginContext.Log.Info(json);
            HttpSender.AddTask(new HttpSenderTask {
                Url = HttpSender.PostChequeUrl, Json = json, Method = HttpMethod.Post
            });
            return(new BillCheque());
        }
Beispiel #4
0
        public CheckBookPlugin()
        {
            PluginContext.Log.Info("Initializing CheckBookPlugin");
            var classesstr   = ConfigurationManager.AppSettings["ListOfPluginClassForLoading"];
            var classesNames = classesstr.Split(',').Select(_ => _.Trim());
            var httpSender   = new HttpSender();

            subscriptions.Push(httpSender);
            httpSender.Run();
            foreach (var className in classesNames)
            {
                subscriptions.Push(Activator.CreateInstance("Resto.Front.Api.CheckBookPlugin", className) as IDisposable);
                PluginContext.Log.Info($"class {className} was added to subsribe");
            }
            PluginContext.Log.Info("CheckBookPlugin started");
        }