public static List <IOrderPrint> GetAllOrderPrintTemplate()
        {
            var types = Assembly.GetExecutingAssembly().GetTypes();
            List <IOrderPrint> processors = new List <IOrderPrint>();

            foreach (var t in types)
            {
                bool flag = typeof(IOrderPrint).IsAssignableFrom(t);
                if (flag)
                {
                    IOrderPrint obj = CreateObject(t.FullName) as IOrderPrint;
                    if (obj != null)
                    {
                        processors.Add(obj);
                    }
                }
            }
            return(processors.OrderBy(a => a.DisplayOrderId).ToList());
        }
Exemplo n.º 2
0
        /// <summary>
        /// 获取订单打印内容
        /// </summary>
        /// <param name="orderNo"></param>
        /// <param name="templateId"></param>
        /// <returns></returns>
        public ActionResult GetOrderPrintContent(string orderNo, string templateId)
        {
            PrintService printService = new PrintService();
            var          order        = _orderBll.GetOrderViewModel(orderNo);
            var          orderItems   = _orderBll.GetOrderItemViewModel(orderNo);

            if (order != null && orderItems.Count > 0)
            {
            }
            IOrderPrint template        = printService.GetOrderPrintTemplate(templateId);
            string      templateContent = "";

            if (template != null)
            {
                templateContent = template.GetTemplateContent(order, orderItems);
            }
            var jsonData = new
            {
                TemplateContent = templateContent
            };

            return(Content(jsonData.ToJson()));
        }