Exemplo n.º 1
0
        public ReturnContext @return()
        {
            ReturnContext _localctx = new ReturnContext(Context, State);

            EnterRule(_localctx, 16, RULE_return);
            try
            {
                EnterOuterAlt(_localctx, 1);
                {
                    State = 72; Match(T__11);
                    State = 73; Match(NUMBER);
                    State = 74; Match(T__8);
                }
            }
            catch (RecognitionException re)
            {
                _localctx.exception = re;
                ErrorHandler.ReportError(this, re);
                ErrorHandler.Recover(this, re);
            }
            finally
            {
                ExitRule();
            }
            return(_localctx);
        }
Exemplo n.º 2
0
 public void BeforeReturn(ReturnContext context)
 {
     if (traceEnabled)
     {
         traceBuffer.AppendLine(context.ToString());
     }
 }
Exemplo n.º 3
0
        private static void CheckReturn(ReturnContext r, string returnType, Action <CompileException, Context> onError, SymbolTable table)
        {
            var expressionType = GetExpressionType(r.Children.First.Value, onError, table);

            if (expressionType != returnType)
            {
                onError(new CompileException($"Return expression does not match return type"), r);
            }
        }
 public dynamic GetValue(ReturnContext context, object data)
 {
     Model.Supplier supplier = data as Model.Supplier;
     if (supplier == null)
     {
         return new Result(ResultStatus.Error, "餐厅不存在");
     }
     return new Result(ResultStatus.Ok);
 }
Exemplo n.º 5
0
 /// <summary>
 /// build the XPTNode of a return statement
 /// </summary>
 /// <param name="ctx"></param>
 /// <returns></returns>
 public bool BuildXPTNode(ReturnContext ctx)
 {
     if (ctx.selectExpression() != null)
     {
         ctx.XPTreeNode = new Return(@return: (IExpression)ctx.selectExpression().XPTreeNode, engine: this.Engine);
         return(true);
     }
     return(false);
 }
        public dynamic GetValue(ReturnContext context, object data)
        {
            PageList<Model.Supplier> page = data as PageList<Model.Supplier>;

            return new ResultWithData<PageList<DetailSupplierModel>>(ResultStatus.Ok, new PageList<DetailSupplierModel>()
            {
                TotalRows = page.TotalRows,
                Collections = page.Collections.Select(m => m.ToDetailSupplierModel()).ToList()
            });
        }
Exemplo n.º 7
0
        public bool IsMapped(ReturnContext context)
        {
            int v = StringHelper.ToInt32(context.Version, 0);

            if (context.SystemId.ToUpper() == "APP" && v >= this.Order)
            {
                return(true);
            }
            return(false);
        }
        public dynamic GetValue(ReturnContext context, object data)
        {
            Model.Supplier supplier = data as Model.Supplier;

            if (supplier == null)
            {
                return new ResultWithData<DetailSupplierModel>(ResultStatus.Error, null, "餐厅不存在");
            }
            return new ResultWithData<DetailSupplierModel>(ResultStatus.Ok, supplier.ToDetailSupplierModel());
        }
Exemplo n.º 9
0
        public override dynamic GetValue(ReturnContext context, object data)
        {
            var supplier = data as M.Supplier;

            if (supplier.GetBrokenRules().Count > 0)
            {
                var borkenRule = supplier.GetBrokenRules()[0];
                return(this.ResultValue(Int32.Parse(borkenRule.Name), false, borkenRule.Description));
            }
            return(this.ResultValue(data: true));
        }
        public dynamic GetValue(ReturnContext context, object data)
        {
            Model.Supplier supplier = data as Model.Supplier;

            if (supplier == null)
            {
                return new Result(ResultStatus.Error, "餐厅不存在");
            }
            if (supplier.GetBrokenRules().Count > 0)
            {
                return new Result(ResultStatus.Error, supplier.GetBrokenRules()[0].Description);
            }
            return new Result(ResultStatus.Ok);
        }
Exemplo n.º 11
0
        public override dynamic GetValue(ReturnContext context, object data)
        {
            DomainModel.Category foodCategory = data as DomainModel.Category;
            if (foodCategory.GetBrokenRules().Count > 0)
            {
                var brokenRule = foodCategory.GetBrokenRules()[0];
                return(this.ResultValue <CategoryModel>(Int32.Parse(brokenRule.Name), null, brokenRule.Description));
            }

            return(this.ResultValue(data: new CategoryModel()
            {
                CategoryName = foodCategory.CategoryName,
                Id = foodCategory.Id,
                Sort = foodCategory.Sort,
                FoodCount = foodCategory.FoodCount
            }));
        }
        public dynamic GetValue(ReturnContext context, object data)
        {
            PageList<Model.Supplier> page = data as PageList<Model.Supplier>;

            return new ResultWithData<PageList<dynamic>>(ResultStatus.Ok, new PageList<dynamic>()
            {
                TotalRows = page.TotalRows,
                Collections = page.Collections.Select(m => new
                {
                    Id = m.Id,
                    Name = m.Name,
                    Tel = m.Tel,
                    Address = m.Address,
                    DeliveryStatus = m.CurrentDeliveryStatus,
                    BusinessStatus = m.CurrentBusinessStatus
                }).ToList<dynamic>()
            });
        }
Exemplo n.º 13
0
        public override dynamic GetValue(ReturnContext context, object data)
        {
            PageList <DomainModel.Category> tempList = data as PageList <DomainModel.Category>;
            int totalRows = tempList.TotalRows;
            IList <DomainModel.Category> list = tempList.Collections;

            List <CategoryModel> result = new List <CategoryModel>();

            foreach (var item in list)
            {
                var temp = new CategoryModel()
                {
                    CategoryName = item.CategoryName,
                    Id           = item.Id,
                    Sort         = item.Sort,
                    FoodCount    = item.FoodCount
                };
                result.Add(temp);
            }

            return(this.ResultValue(data: new PageList <CategoryModel> {
                Collections = result, TotalRows = totalRows
            }));
        }
 public bool IsMapped(ReturnContext context)
 {
     return context.SystemId == "app";
 }
Exemplo n.º 15
0
 internal override void SaveToReturnContext(ReturnContext returnContext)
 {
     returnContext.SerializeType = SerializeTypes.json;
 }
Exemplo n.º 16
0
 public abstract dynamic GetValue(ReturnContext context, object data);
 public dynamic GetValue(ReturnContext context, object data)
 {
     IEnumerable<Model.Delivery> deliverys = data as IEnumerable<Model.Delivery>;
     return new ResultWithData<IEnumerable<DeliveryModel>>(ResultStatus.Ok, deliverys.Select(m => m.ToDeliveryModel()));
 }
Exemplo n.º 18
0
 private LarkResult(HttpResponseMessage httpResponseMessage, ReturnContext returnContext)
 {
     this.httpResponseMessage = httpResponseMessage;
     this.returnContext       = returnContext;
 }
Exemplo n.º 19
0
 internal static LarkResult GetResult(HttpResponseMessage httpResponseMessage, ReturnContext returnContext)
 {
     return(new LarkResult(httpResponseMessage, returnContext));
 }
 public bool IsMapped(ReturnContext context)
 {
     return context.SystemId == "pc" || string.IsNullOrEmpty(context.SystemId);
 }
Exemplo n.º 21
0
 /// <summary>
 /// build the XPTNode of a return statement
 /// </summary>
 /// <param name="ctx"></param>
 /// <returns></returns>
 public bool BuildXPTNode(ReturnContext ctx)
 {
     if (ctx.selectExpression() != null)
     {
         ctx.XPTreeNode = new Return(@return: (IExpression) ctx.selectExpression().XPTreeNode, engine: this.Engine);
         return true;
     }
     return false;
 }
 public bool IsMapped(ReturnContext context)
 {
     return true;
 }
Exemplo n.º 23
0
 internal virtual void SaveToReturnContext(ReturnContext returnContext)
 {
 }
Exemplo n.º 24
0
        public override dynamic GetValue(ReturnContext context, object data)
        {
            string str = data.ToString();

            return(this.ResultValue(data: str));
        }
Exemplo n.º 25
0
 public QueryAstBuilder()
 {
     _selectContext = new SelectContext(this);
     _returnContext = new ReturnContext(this);
 }