public IList<Model.TextBlock> List(int pageindex, int pagesize, out int count) { Peanut.Expression exp = new Peanut.Expression(); count = exp.Count<TextBlock>(); int size = 20; return exp.List<TextBlock>(new Region(pageindex, size)); }
public IList <Model.TextBlock> List(int pageindex, int pagesize, out int count) { Peanut.Expression exp = new Peanut.Expression(); count = exp.Count <TextBlock>(); int size = 20; return(exp.List <TextBlock>(new Region(pageindex, size))); }
public IList<Order> OnOrderSearch(ISession session, OrderSearch e) { Expression exp = new Expression(); if (e.CustomerID != null) exp &= Models.Orders.customerID == e.CustomerID; if (e.EmployeeID > 0) exp &= Models.Orders.employeeID == e.EmployeeID; return exp.List<Models.Orders, Order>(); }
public object Execute(IConnectinContext cc, object value, HandlerValueType type) { string[] orderby = DBContext.CurrentOrderBy; Region curegion = DBContext.CurrentRegion; DBContext.CurrentRegion = null; DBContext.CurrentOrderBy = null; switch (type) { case HandlerValueType.String: string str = (string)value; if (GetValue.IsSelectSQL(str)) { return(new SQL(str).List(Type, cc, curegion)); } else { Expression exp = new Expression(str); return(exp.List(Type, cc, curegion, orderby)); } case HandlerValueType.SQL: return(((SQL)value).List(Type, cc, curegion)); break; case HandlerValueType.PROC: return(cc.ListProc(Type, value)); case HandlerValueType.EXPRESSION: return(((Expression)value).List(Type, cc, curegion, orderby)); default: throw new PeanutException("object is not a [SQL,StoredProcedure,Expression]!"); } }
public IList<Blog> List(string category, int size, int index, out int pages) { Expression exp = new Expression(); if (!string.IsNullOrEmpty(category)) exp &= Blog.iD == BlogLinkCategory.blog[BlogLinkCategory.category == category]; int count = exp.Count<Blog>(); pages = count / size; if (count % size > 0) pages++; IList<Blog> result = exp.List<Blog>(new Region(index, size), Blog.createTime.Desc); foreach (Blog item in result) { item.Categories = ListCategories(item.ID); } return result; }
public IList<BlogCategory> ListCategories(string blog = null) { Expression exp = new Expression(); if (blog != null) exp &= BlogCategory.iD == BlogLinkCategory.category[BlogLinkCategory.blog == blog]; IList<BlogCategory> result = exp.List<BlogCategory>(); foreach (BlogCategory item in result) { item.Blogs = (BlogLinkCategory.category == item.ID).Count<BlogLinkCategory>(); } return result; }