コード例 #1
0
        public object PrintOrder(string orderId, int printonly)
        {
            string sqlOrder  = "SELECT * FROM VM_Order WHERE OrderId = @orderId;";
            string sqlDetail = "SELECT * FROM VM_DetailOrder WHERE OrderId = @orderId;";
            var    result    = XDataHelper.ExcuteMultipleReader <VM_Order, VM_DetailOrder>(sqlOrder + sqlDetail, new { orderId });

            var xres     = new XResult();
            var resPrint = PrintSanLiangDan(printonly, result);

            if (resPrint.ret == 0)
            {
                xres.message = "已将订单发送至打印机!";
            }
            else if (resPrint.ret == 99)
            {
                xres.message = resPrint.msg;
                xres.code    = printonly != 0 ? resPrint.ret : 20000;
            }
            else
            {
                xres.code    = 10000;
                xres.message = $"打印机错误码为:{resPrint.ret},错误信息为:{resPrint.msg}";
            }

            return(xres);
        }
コード例 #2
0
        public object InitializeData()
        {
            string sql = @"SELECT * FROM VM_Menu WHERE IsUsed = 1 ORDER BY Sort;
                           SELECT * FROM MenuType ORDER BY Sort;";

            var x = XDataHelper.ExcuteMultipleReader <Vm_MenuClass, MenuTypeClass>(sql);

            var goodsList = new List <Goods>();

            foreach (var item in x.Item2)
            {
                var good = new Goods();
                good.name = item.Name;
                foreach (var menu in x.Item1)
                {
                    if (menu.MenuTypeName == item.Name)
                    {
                        var food = new Food();
                        food.id          = menu.Id;
                        food.icon        = menu.RootUrl + menu.ICon;
                        food.name        = menu.Name;
                        food.price       = menu.Price;
                        food.pricetype   = menu.PriceType;
                        food.description = menu.Description;

                        good.foods.Add(food);
                    }
                }
                goodsList.Add(good);
            }
            return(new XResult()
            {
                data = goodsList
            });
        }