/// <summary> /// 查询一个时间点上的,所有满足StationIds条件的雨量值 /// </summary> /// <param name="timing"></param> /// <param name="stationIds"></param> /// <returns></returns> public IList <Rainfall> GetByStationIdsWithTiming(DateTime timing, string stationIds = null) { if (timing == null) { throw new Exception("不存在这样的时间点参数"); } List <String> stationIdList = null; if (!String.IsNullOrEmpty(stationIds)) { string[] ids = stationIds.Split(','); } Expression <Func <Rainfall, Boolean> > funcStationIds = LinqEntityHelper.GetExpressionForSingle <Rainfall, List <String> >(stationIdList, r => stationIds.Contains(r.RainfallStation.StationId)); Expression <Func <Rainfall, Boolean> > funcTiming = r => r.CollectTime == timing; var eps = DynamicLinqExpressions.True <Rainfall>() .And(funcStationIds) .And(funcTiming); IQueryable <Rainfall> rains = this._rainfallStationService.GetByCondition(eps); return(rains.ToList()); }
/// <summary> /// 根据雨量站点,查询一段时间内每个时间点的雨量值,并且按照雨量站点分类返回 /// </summary> /// <param name="stime"></param> /// <param name="etime"></param> /// <param name="stationIds"></param> /// <returns></returns> public IList <RainfallGroupedByStation> GetGroupByStation( DateTime stime, DateTime etime, string stationIds = null) { if (stime == null || etime == null) { throw new Exception("输入的时间段值有误"); } List <String> stationIdList = null; if (!String.IsNullOrEmpty(stationIds)) { string[] ids = stationIds.Split(','); stationIdList = ids.ToList(); } Expression <Func <Rainfall, Boolean> > funcStationIds = LinqEntityHelper.GetExpressionForSingle <Rainfall, List <String> >(stationIdList, r => stationIds.Contains(r.RainfallStation.StationId)); Expression <Func <Rainfall, Boolean> > funcTimeline = r => r.CollectTime >= stime && r.CollectTime <= etime; var eps = DynamicLinqExpressions.True <Rainfall>() .And(funcStationIds) .And(funcTimeline); IQueryable <RainfallGroupedByStation> rains = this._rainfallStationService.GetStaionIdGroupByCondition(eps); return(rains.ToList()); }
/// <summary> /// 统一编号条件 /// </summary> /// <param name="uid"></param> /// <returns></returns> public Expression <Func <MineArchive, Boolean> > GetExpressionByUnifiedId(string uid) { var eps = DynamicLinqExpressions.True <MineArchive>(); if (!String.IsNullOrEmpty(uid)) { eps = eps.And(m => m.编号 == uid); } return(eps); }
public Expression <Func <Comprehensive, Boolean> > GetExpressionByLocation(string keyword) { var eps = DynamicLinqExpressions.True <Comprehensive>(); if (!String.IsNullOrEmpty(keyword)) { eps = eps.And(c => c.地理位置.Contains(keyword)); } return(eps); }
/// <summary> /// 所属区域条件 /// </summary> /// <param name="gbCode"></param> /// <returns></returns> public Expression <Func <MineArchive, Boolean> > GetExpressionByGBCode(string gbCode) { var eps = DynamicLinqExpressions.True <MineArchive>(); if (!String.IsNullOrEmpty(gbCode)) { eps = eps.And(m => m.编号.StartsWith(gbCode)); } return(eps); }
public Expression <Func <MineEnvironmentSurvey, Boolean> > GetExpressionByUnifiedId(string uid) { var eps = DynamicLinqExpressions.True <MineEnvironmentSurvey>(); if (!String.IsNullOrEmpty(uid)) { eps = eps.And(m => m.统一编号 == uid); } return(eps); }
/// <summary> /// 开采方式条件 /// </summary> /// <param name="solution"></param> /// <returns></returns> public Expression <Func <MineArchive, Boolean> > GetExpressionByExploitSolution(string solution) { var eps = DynamicLinqExpressions.True <MineArchive>(); if (!String.IsNullOrEmpty(solution)) { eps = eps.And(m => m.开采方式 == solution); } return(eps); }
/// <summary> /// 统一编号查询表达式树 /// </summary> /// <param name="uid"></param> /// <returns></returns> public Expression <Func <Comprehensive, Boolean> > GetExpressionByUnifiedId(string uid) { var eps = DynamicLinqExpressions.True <Comprehensive>(); if (!String.IsNullOrEmpty(uid)) { eps = eps.And(c => c.统一编号.Contains(uid)); } return(eps); }
/// <summary> /// 生产现状条件 /// </summary> /// <param name="productStatus"></param> /// <returns></returns> public Expression <Func <MineArchive, Boolean> > GetExpressionByProductStatus(string productStatus) { var eps = DynamicLinqExpressions.True <MineArchive>(); if (!String.IsNullOrEmpty(productStatus)) { eps = eps.And(m => m.生产现状 == productStatus); } return(eps); }
public Expression <Func <PhyGeoDisaster, Boolean> > GetExpressionByName(string name) { var eps = DynamicLinqExpressions.True <PhyGeoDisaster>(); if (!String.IsNullOrEmpty(name)) { eps = eps.And(p => p.Name.Contains(name)); } return(eps); }
/// <summary> /// 名称查询表达式树 /// </summary> /// <param name="name"></param> /// <returns></returns> public Expression <Func <Comprehensive, Boolean> > GetExpressionByName(string name) { var eps = DynamicLinqExpressions.True <Comprehensive>(); if (!String.IsNullOrEmpty(name)) { eps = eps.And(c => c.称.Contains(name)); } return(eps); }
/// <summary> /// 矿山规模条件 /// </summary> /// <param name="mineSize"></param> /// <returns></returns> public Expression <Func <MineArchive, Boolean> > GetExpressionByMineSize(string mineSize) { var eps = DynamicLinqExpressions.True <MineArchive>(); if (!String.IsNullOrEmpty(mineSize)) { eps = eps.And(m => m.矿山规模 == mineSize); } return(eps); }
public IQueryable <PhyGeoDisaster> GetByConditions(List <string> gbcodes, List <EnumGeoDisasterType?> type) { var eps = DynamicLinqExpressions.True <PhyGeoDisaster>(); eps = eps.And(this.GetExpressionByGBCode(gbcodes)) .And(this.GetExpressionByDisasterType(type)); IQueryable <PhyGeoDisaster> phys = this.ExecuteConditions(eps); return(phys); }
public Expression <Func <Comprehensive, Boolean> > GetExpressionByCircle(double x, double y, double radius) { var eps = DynamicLinqExpressions.True <Comprehensive>(); eps = eps.And(a => LonLatHelper.DistanceBetTwoPoints( x, y, a.经度, a.纬度 ) <= radius); return(eps); }
public IQueryable <Comprehensive> GetByConditions(List <string> gbCodes, List <string> situationLevs, List <string> dangerousLevs, List <EnumGeoDisasterType?> types) { var eps = DynamicLinqExpressions.True <Comprehensive>(); eps = eps.And(this.GetExpressionByGBCode(gbCodes)) .And(this.GetExpressionBySituationLev(situationLevs)) .And(this.GetExpressionByDisasterType(types)) .And(this.GetExpressionByDangerousLev(dangerousLevs)); IQueryable <Comprehensive> comprehensives = this.ExecuteConditions(eps); return(comprehensives); }
public Expression <Func <PhyGeoDisaster, Boolean> > GetExpressionByLocation(string keyword) { var eps = DynamicLinqExpressions.True <PhyGeoDisaster>(); if (!String.IsNullOrEmpty(keyword)) { eps = eps.And(p => p.Location.Contains(keyword)); } return(eps); // Expression<Func<PhyGeoDisaster,Boolean>> condtion = p=>p.Location.Contains(keyword); //// LinqEntityHelper.GetExpressionForSingle<PhyGeoDisaster, EnumGeoDisasterType>(null, condtion); // return LinqEntityHelper.GetExpressionForSingle<PhyGeoDisaster, String>(keyword, condtion); }
public IQueryable <MineArchive> GetByConditions(string gbCode, string mineSize, string productStatus, string keyWord, string exploitSolution) { var eps = DynamicLinqExpressions.True <MineArchive>(); eps = eps.And(this.GetExpressionByGBCode(gbCode)) .And(this.GetExpressionByMineSize(mineSize)) .And(this.GetExpressionByProductStatus(productStatus)) .And(this.GetExpressionByKeyWord(keyWord)) .And(this.GetExpressionByExploitSolution(exploitSolution)); IQueryable <MineArchive> query = this.ExecuteConditions(eps); return(query); }
/// <summary> /// 关键字条件(关键字将查询统一编号和矿山名称) /// </summary> /// <param name="keyWord"></param> /// <returns></returns> public Expression <Func <MineArchive, Boolean> > GetExpressionByKeyWord(string keyWord) { var eps = DynamicLinqExpressions.False <MineArchive>(); if (!String.IsNullOrEmpty(keyWord)) { eps = eps.Or(this.GetExpressionByUnifiedId(keyWord)) .Or(this.GetExpressionByName(keyWord)); } else { eps = DynamicLinqExpressions.True <MineArchive>(); } return(eps); }
public async Task <IEnumerable <Books> > GetBooks(int pageIndex, int pageSize, string bookName, string authorName, string bookType, int orderBy, bool isAsc) { return(await Task.Run(() => { var predicate = DynamicLinqExpressions.True <Books>().And(p => p.BookState == true); if (!string.IsNullOrEmpty(bookType)) { predicate = predicate.And(p => p.BookType == bookType); } if (!string.IsNullOrEmpty(bookName)) { predicate = predicate.And(p => p.BookName.Contains(bookName)); } if (!string.IsNullOrEmpty(authorName)) { predicate = predicate.And(p => p.AuthorsName.Contains(authorName)); } List <Qian.Models.OrderModelField> orderModelField = new List <Qian.Models.OrderModelField>(); switch (orderBy) { case 0: orderModelField.Add(new Qian.Models.OrderModelField { propertyName = "AddTime", isAsc = false }); break; case 1: orderModelField.AddRange ( new List <Qian.Models.OrderModelField> { new Qian.Models.OrderModelField { propertyName = "MarketPrice", isAsc = isAsc }, new Qian.Models.OrderModelField { propertyName = "AddTime", isAsc = false } } ); break; default: break; } var model = LoadEntites(predicate).ExpressionOrderBy(orderModelField.ToArray()).Skip((pageIndex - 1) * pageSize).Take(pageSize); return model.AsEnumerable(); })); }
public Expression <Func <PhyGeoDisaster, Boolean> > GetExpressionByDisasterType( List <EnumGeoDisasterType?> types) { var eps = DynamicLinqExpressions.True <PhyGeoDisaster>(); if (types != null && types.Count != 0) { //如果不为null,则初始条件为False,多个gbcodes间为“OR”关系,有一个满足则,此条件成立 eps = DynamicLinqExpressions.False <PhyGeoDisaster>(); foreach (var type in types) { eps = eps.Or(p => p.DisasterType == type); } } return(eps); }
public Expression <Func <Comprehensive, Boolean> > GetExpressionByDangerousLev( List <String> dangerLevs) { var eps = DynamicLinqExpressions.True <Comprehensive>(); if (dangerLevs != null && dangerLevs.Count != 0) { //如果不为null,则初始条件为False,多个dangerLevs间为“OR”关系,有一个满足则,此条件成立 eps = DynamicLinqExpressions.False <Comprehensive>(); foreach (var lev in dangerLevs) { eps = eps.Or(p => p.险情等级 == lev); } } return(eps); }
public Expression <Func <Comprehensive, Boolean> > GetExpressionBySituationLev(List <string> situationLevs) { var eps = DynamicLinqExpressions.True <Comprehensive>(); if (situationLevs != null && situationLevs.Count != 0) { //如果不为null,则初始条件为False,多个situationLevs间为“OR”关系,有一个满足则,此条件成立 eps = DynamicLinqExpressions.False <Comprehensive>(); foreach (var lev in situationLevs) { eps = eps.Or(p => p.灾情等级 == lev); } } return(eps); }
public Expression <Func <PhyGeoDisaster, Boolean> > GetExpressionByGBCode(List <string> gbcodes) { //如果为null,表示忽略此条件 var eps = DynamicLinqExpressions.True <PhyGeoDisaster>(); if (gbcodes != null && gbcodes.Count != 0) { //如果不为null,则初始条件为False,多个gbcodes间为“OR”关系,有一个满足则,此条件成立 eps = DynamicLinqExpressions.False <PhyGeoDisaster>(); foreach (var regionCode in gbcodes) { if (!String.IsNullOrEmpty(regionCode)) { eps = eps.Or(p => p.GBCodeId == regionCode); } } } return(eps); }
public Expression <Func <Comprehensive, Boolean> > GetExpressionByGBCode(List <string> gbcodes) { //如果为null,表示忽略此条件 var eps = DynamicLinqExpressions.True <Comprehensive>(); if (gbcodes != null && gbcodes.Count != 0) { //如果不为null,则初始条件为False,多个gbcodes间为“OR”关系,有一个满足则,此条件成立 eps = DynamicLinqExpressions.False <Comprehensive>(); foreach (var regionCode in gbcodes) { if (!String.IsNullOrEmpty(regionCode)) { string tempGbCode = regionCode; eps = eps.Or(p => p.GBCodeId.StartsWith(tempGbCode)); } } } return(eps); }
public Expression <Func <Comprehensive, Boolean> > GetExpressionByRect( double x1, double x2, double y1, double y2) { //var eps = DynamicLinqExpressions.True<Comprehensive>(); //eps = eps.And(a => // LonLatHelper.ConvertToDegreeStyleFromString(a.经度) > y1 && // LonLatHelper.ConvertToDegreeStyleFromString(a.经度) < y2 && // LonLatHelper.ConvertToDegreeStyleFromString(a.纬度) > x1 && // LonLatHelper.ConvertToDegreeStyleFromString(a.纬度) < x2); //return eps; var eps = DynamicLinqExpressions.True <Comprehensive>(); eps = eps.And( c => LonLatHelper.GetLonLatIsInRect( x1, x2, y1, y2 , c.经度 , c.纬度 ) ); return(eps); }