public static DapperSql ParseToDapperSql <T>(this BaseSearch <T> search, ISqlDialect dialect, string tableAlias = null) { if (search == null) { return(null); } tableAlias = string.IsNullOrEmpty(tableAlias) ? "" : tableAlias + "."; List <string> sqls = new List <string>(); Dictionary <string, object> allParameters = new Dictionary <string, object>(); foreach (PropertyInfo p in search.GetType().GetProperties()) { (string sql, Dictionary <string, object> parameters) = ParseProperty(search, p, dialect, tableAlias); if (sql != null) { sqls.Add(sql); allParameters.TryConcat(parameters); } } var allSql = string.Join(" AND ", sqls.ToArray()); return(new DapperSql(allSql, allParameters)); }
public IActionResult BindNews(BaseSearch vmodel) { int code = 200; var list = _currencyService.DbAccess().Queryable <YNK_News>().OrderBy(n => n.CreateTime, SqlSugar.OrderByType.Desc).ToPageList(vmodel.page, vmodel.pagesize); return(Json(new { code = code, msg = "获取成功", data = list })); }
public CommonSearch() { BaseS = new BaseSearch { BeginDate = DateTime.Now.Date.AddMonths(-6), EndDate = DateTime.Now.Date }; }
public ActionResult SearchPerPage([FromQuery] BaseSearch search) { var result = _client.InitIndex("Departement"). Search <Departement>(new Query(search.KeyWord) { HitsPerPage = search.PageSize, Page = search.PageNumber - 1 }); return(Ok(result)); }
protected async Task <EntityCollection <TEntitySubset> > BaseFind(BaseSearch searchSettings) { var request = new SearchRequest <TEntitySubset>() { Resource = Resource, SearchSettings = searchSettings }; return(await SendAsync(request).ConfigureAwait(false)); }
/// <summary> /// 获取产品 /// </summary> /// <param name="condition"></param> /// <returns></returns> public ActionResult LoadProducts(BaseSearch condition) { PageJsonModel <ProductPriceVM> page = new PageJsonModel <ProductPriceVM>(); page.pageIndex = condition.pageIndex; page.pageSize = condition.pageSize; page.strForm = string.Format(" Product left join Product_Lever on Product.ProductID=Product_Lever.ProductID and Product_Lever.UserTypeID={0} ", CurrentUser.C_UserTypeID); page.strSelect = " Product.*,ISNULL(Product_Lever.Price,Product.Price) Price_agent "; page.strWhere = ""; page.strOrder = "Product.ProductID desc"; page.LoadList(); return(Json(page.pageResponse, JsonRequestBehavior.AllowGet)); }
public ActionResult LoadMyAddress(BaseSearch condition) { PageJsonModel <C_UserMail> page = new PageJsonModel <C_UserMail>(); page.pageIndex = condition.pageIndex; page.pageSize = condition.pageSize; page.strForm = " C_UserMail"; page.strSelect = " * "; page.strWhere = string.Format(" and UserName='******' ", CurrentUser.UserName); page.strOrder = "ID desc"; page.LoadList(); return(Json(page.pageResponse, JsonRequestBehavior.AllowGet)); }
public ActionResult get_agents_page(BaseSearch condition) { PageJsonModel <C_UserVM> page = new PageJsonModel <C_UserVM>(); page.pageIndex = condition.pageIndex; page.pageSize = condition.pageSize; page.strForm = " C_User left join [C_UserType] on C_User.C_UserTypeID=[C_UserType].Lever"; page.strSelect = " C_User.*,[C_UserType].Name userTypeName "; page.strWhere = ""; page.strOrder = "C_User.ID desc"; page.LoadList(); return(Json(page.pageResponse, JsonRequestBehavior.AllowGet)); }
/// <summary> /// 读取购物车 /// </summary> /// <param name="condition"></param> /// <returns></returns> public ActionResult LoadCart(BaseSearch condition) { PageJsonModel <C_UserCartVM> page = new PageJsonModel <C_UserCartVM>(); page.pageIndex = condition.pageIndex; page.pageSize = condition.pageSize; page.strForm = string.Format(@" C_UserCart left join Product on C_UserCart.GoodsID=Product.ProductID left join Product_Lever on Product.ProductID=Product_Lever.ProductID and Product_Lever.UserTypeID={0} ", CurrentUser.C_UserTypeID); page.strSelect = @" C_UserCart.*,Product.ProductNumber,Product.ProductName, Product.ProductImg,Product.Price,Product.States,ISNULL(Product_Lever.Price,Product.Price) Price_agent "; page.strWhere = string.Format(" and C_UserName='******' ", CurrentUser.UserName); page.strOrder = "C_UserCart.ID desc"; page.LoadList(); return(Json(page.pageResponse, JsonRequestBehavior.AllowGet)); }
public (IEnumerable <DepartementViewModel>, int) DepartementFilter(BaseSearch search) { var query = Context.Departements.Where(b => String.IsNullOrEmpty(search.keyWord) || b.NameEN.Contains(search.keyWord) || b.NameAR.Contains(search.keyWord)) .Select(t => new DepartementViewModel { Id = t.Id, NameAR = t.NameAR, NameEN = t.NameEN, CreatedyId = t.CreatedBy.Id, CreatedName = t.CreatedBy.UserName }); var count = query.Count(); var data = query.OrderBy(c => c.Id).Skip((search.pageNumber - 1) * search.pageSize).Take(search.pageSize); return(data, count); }
public async Task <List <SystemAggregate> > GetSystemAggregate(BaseSearch search) { var result = new List <SystemAggregate>(); result.Add(new SystemAggregate() { id = await provider.GetMaxAsync(provider.GetQueryable <EntityRelation>(), x => x.id), type = "actionMax" }); result.Add(new SystemAggregate() { id = await provider.GetMaxAsync(provider.GetQueryable <Entity>(), x => x.id), type = "contentMax" }); result.Add(new SystemAggregate() { id = await provider.GetMaxAsync(provider.GetQueryable <EntityValue>(), x => x.id), type = "valueMax" }); return(result); }
private void OnClickDropDown(int op) { cleanMap(); map = new Map(); searchData = new SearchData(); searchData.cmpltCllBck = drawFinalPath; if (op == 0) { //A Star search = new AStarSearch(map); search.SearchCallBack = SearchCallBack; search.PointCallBack = PointCallBack; drawMap(); } else if (op == 1) { search = new JumpPointSearch(map); search.SearchCallBack = SearchCallBack; search.PointCallBack = PointCallBack; drawMap(); } }
/// <summary> /// 根据角色id获取所属的用户列表 /// </summary> /// <param name="Id"></param> /// <param name="model"></param> /// <returns></returns> public ActionResult GetUserListByRoleId(Guid Id, BaseSearch model) { int totalCount = 0; Expression <Func <User, DateTime> > orderLambda = d => d.UpdateTime; var users = new RoleBLL().GetUserByRoleId(Id, orderLambda, model.Order, model.Rows, model.Page, out totalCount); var userList = users.Select(d => new UserListByRoleId { Id = d.Id, Name = d.AccountName, UserName = d.RealName, IsAble = d.IsAble, IsEidtPass = d.IsChangePwd, CreatTime = d.CreateTime }).ToList(); var result = new DataResult <UserListByRoleId> { total = totalCount, rows = userList }; return(Json(result, JsonRequestBehavior.AllowGet)); }
public static Expression <Func <T, bool> > GetExpression <T>(this BaseSearch <T> self) { if (self == null) { return(null); } var parameter = Expression.Parameter(typeof(T)); Expression <Func <T, bool> > expression = null; foreach (PropertyInfo p in self.GetType().GetProperties()) { var exp = GetPropertyExpression(self, p, parameter); if (expression == null) { expression = exp; } else if (exp != null) { expression = Expression.Lambda <Func <T, bool> >(Expression.AndAlso(expression.Body, exp.Body), parameter); } } return(expression); }
/// <summary> /// 我的扫码记录 /// </summary> /// <param name="condition"></param> /// <returns></returns> public ActionResult LoadAuthenticityList(BaseSearch condition) { string where = " and UserName='******' and (ActivityID='1' or ActivityID='3')"; List <LotteryRecord> mode = LotteryRecord.GetEntitysbywhere(where); where = " and l.UserName='******' and (ActivityID='1' or ActivityID='3')"; if (mode.Count > 0) { //where = " and l.IntegralCode='" + mode[0].IntegralCode + "'"; } PageJsonModel <LotteryRecord> page = new PageJsonModel <LotteryRecord>(); page.pageIndex = condition.pageIndex; page.pageSize = condition.pageSize; page.strForm = string.Format(" LotteryRecord l left join C_User c on c.userName=l.UserName "); page.strSelect = " l.* ,PortraitUrl,NickName "; //page.strWhere = " " + where; page.strOrder = " l.ID desc"; page.LoadList(); return(Json(page.pageResponse, JsonRequestBehavior.AllowGet)); }
private static Expression <Func <T, bool> > GetPropertyExpression <T>(BaseSearch <T> self, PropertyInfo p, ParameterExpression parameter) { //取得SearchConditionAttribute特性 var attr = p.GetCustomAttribute <SearchConditionAttribute>(); var ignoreWhenNull = attr != null ? attr.IgnoreWhenNull : true; var value = p.GetValue(self); if (value == null && ignoreWhenNull) { return(null); } if (p.PropertyType == typeof(string) && string.IsNullOrEmpty((string)value) && ignoreWhenNull) { return(null); } //如果有CustomConditionAttribute,则跳过该条件 if (p.GetCustomAttribute <CustomConditionAttribute>() != null) { return(null); } var name = attr != null ? (attr.PropertyName.IsNotNullOrEmpty() ? attr.PropertyName : p.Name) : p.Name; //根据名称取得属性 var property = typeof(T).GetProperty(name); if (property == null) { return(null); } var propertyType = property.PropertyType; ////如果是Nullable类型,只需要取得真实类。 //if (value != null && propertyType.IsNullableType()) //{ // propertyType = propertyType.RealType(); //} SearchConditionOperation operation = attr != null ? attr.Operation : SearchConditionOperation.Equal; Expression body = null; switch (operation) { case SearchConditionOperation.Equal: body = Expression.Equal( Expression.PropertyOrField(parameter, name), Expression.Constant(value, propertyType) ); break; case SearchConditionOperation.NotEqual: body = Expression.NotEqual( Expression.PropertyOrField(parameter, name), Expression.Constant(p.GetValue(self), propertyType) ); break; case SearchConditionOperation.Contains: body = Expression.Call(Expression.PropertyOrField(parameter, name), typeof(string).GetMethod("Contains", new[] { typeof(string) }), Expression.Constant(value, propertyType)); break; case SearchConditionOperation.NotContains: body = Expression.Not(Expression.Call(Expression.PropertyOrField(parameter, name), typeof(string).GetMethod("Contains", new[] { typeof(string) }), Expression.Constant(value, propertyType))); break; default: return(null); } var exp = Expression.Lambda <Func <T, bool> >(body, parameter); return(exp); }
public IResponse GetAll(BaseSearch search) { throw new NotImplementedException(); }
public virtual PagedResult <T> GetPaged(BaseSearch search) { return(new PagedResult <T>()); }
public PagingControl() { this.InitializeComponent(); searchModel = new BaseSearch(); }
public Movies Get([FromQuery] BaseSearch baseSearch) { return(_movieRepository.GetMovies(baseSearch.Page)); }
public ActionResult GetBranches([FromQuery] BaseSearch search) { var response = service.GetAll(search); return(Ok(response)); }