public List <LogEntity> GetList(Pagination pagination, string queryJson) { var expression = ExtLinq.True <LogEntity>(); var queryParam = queryJson.ToJObject(); if (!queryParam["keyword"].IsEmpty()) { string keyword = queryParam["keyword"].ToString(); expression = expression.And(t => t.Account.Contains(keyword)); } if (!queryParam["timeType"].IsEmpty()) { string timeType = queryParam["timeType"].ToString(); DateTime startTime = DateTime.Now.ToString("yyyy-MM-dd").ToDate(); DateTime endTime = DateTime.Now.ToString("yyyy-MM-dd").ToDate().AddDays(1); switch (timeType) { case "1": break; case "2": startTime = DateTime.Now.AddDays(-7); break; case "3": startTime = DateTime.Now.AddMonths(-1); break; case "4": startTime = DateTime.Now.AddMonths(-3); break; default: break; } expression = expression.And(t => t.Date >= startTime && t.Date <= endTime); } return(service.FindList(expression, pagination)); }
public List <DbBackupEntity> GetList(string queryJson) { var expression = ExtLinq.True <DbBackupEntity>(); var queryParam = queryJson.ToJObject(); if (!queryParam["condition"].IsEmpty() && !queryParam["keyword"].IsEmpty()) { string condition = queryParam["condition"].ToString(); string keyword = queryParam["keyword"].ToString(); switch (condition) { case "DbName": expression = expression.And(t => t.F_DbName.Contains(keyword)); break; case "FileName": expression = expression.And(t => t.F_FileName.Contains(keyword)); break; } } return(service.IQueryable(expression).OrderByDescending(t => t.F_BackupTime).ToList()); }
/// <summary> /// 根据用户Id或者角色Id查询用户 /// </summary> /// <param name="list"></param> /// <param name="type"></param> /// <returns></returns> public List <UserEntity> GetUserList(List <string> list, string type = "Users") { var expression = ExtLinq.True <UserEntity>(); expression = expression.And(t => t.F_EnabledMark == true); List <UserEntity> data = service.IQueryable(expression).ToList(); List <UserEntity> users = new List <UserEntity>(); try { if (data != null && list != null) { if (type == "Roles") { foreach (string iGrowID in list) { users.AddRange(data.FindAll(delegate(UserEntity p) { return(p.F_RoleId == iGrowID); })); } } else { foreach (string iGrowID in list) { users.Add(data.Find(delegate(UserEntity p) { return(p.IGrowID == iGrowID); })); } } return(users); } else { return(null); } } catch (Exception ex) { return(null); } }
public Task <IEnumerable <QualityItemSelectOptions> > GetList(string keyword = "") { if (_memoryCache.TryGetValue("qualityitem_select_options", out List <QualityItemSelectOptions> cacheData)) { return(string.IsNullOrEmpty(keyword) ? Task.FromResult(cacheData.AsEnumerable()) : Task.FromResult(cacheData.Where(t => t.HisItemCode.Contains(keyword) || t.ItemCode.Contains(keyword) || t.ItemName.Contains(keyword)))); } { var expression = ExtLinq.True <QualityItemEntity>(); expression = expression.And(t => t.F_EnabledMark == true); expression = expression.And(t => t.F_DeleteMark != true); cacheData = _service.IQueryable(expression).OrderBy(t => t.F_ItemCode).Select(r => new QualityItemSelectOptions { Id = r.F_Id, ItemType = r.F_ItemType, OrderNo = r.F_OrderNo, ItemCode = r.F_ItemCode, ItemName = r.F_ItemName, HisItemCode = r.F_HisItemCode, Unit = r.F_Unit, Result = r.F_Result, LowerValue = r.F_LowerValue, UpperValue = r.F_UpperValue, LowerCriticalValue = r.F_LowerCriticalValue, UpperCriticalValue = r.F_UpperCriticalValue, ResultType = r.F_ResultType, Memo = r.F_Memo }).ToList(); _memoryCache.Set("qualityitem_select_options", cacheData, TimeSpan.FromMinutes(5)); } return(string.IsNullOrEmpty(keyword) ? Task.FromResult(cacheData.AsEnumerable()) : Task.FromResult(cacheData.Where(t => t.HisItemCode.Contains(keyword) || t.ItemCode.Contains(keyword) || t.ItemName.Contains(keyword)))); }
//获取当前用户所有短信日志 public List <SMSLogEntity> GetList() { List <SMSLogEntity> list = new List <SMSLogEntity>(); try { var LoginInfo = OperatorProvider.Provider.GetCurrent(); var expression = ExtLinq.True <SMSLogEntity>(); if (null != LoginInfo) { if (LoginInfo.RoleId.StartsWith("A_")) { } else if (LoginInfo.RoleId.StartsWith("C_")) { expression = expression.And(u => u.F_CreatorUserId.Contains(LoginInfo.CompanyId)); } else if (LoginInfo.RoleId.StartsWith("S_")) { expression = expression.And(u => u.F_CreatorUserId.Contains(LoginInfo.StationId)); } else { expression = expression.And(u => u.F_CreatorUserId.Contains(LoginInfo.UserId)); } list = _serviceSMSLog.IQueryable(expression).ToList(); return(list); } else { return(list); } } catch { return(list); } }
public List <TempletEntity> GetListByWebSiteId(Pagination pagination, string keyword, string WebSiteId) { var expression = ExtLinq.True <TempletEntity>(); if (!string.IsNullOrEmpty(keyword)) { expression = expression.And(t => t.FullName.Contains(keyword)); } if (!string.IsNullOrEmpty(WebSiteId)) { expression = expression.And(t => t.WebSiteId == WebSiteId); } expression = expression.And(t => t.DeleteMark != true); if (new WebSiteApp().IsSearch(WebSiteId) && new WebSiteApp().IsMSearch(WebSiteId)) { expression = expression.And(t => t.TempletType == (int)Code.Enums.TempletType.Common || t.TempletType == (int)Code.Enums.TempletType.Search || t.TempletType == (int)Code.Enums.TempletType.MSearch); } else { if (new WebSiteApp().IsSearch(WebSiteId)) { expression = expression.And(t => t.TempletType == (int)Code.Enums.TempletType.Common || t.TempletType == (int)Code.Enums.TempletType.Search); } else if (new WebSiteApp().IsMSearch(WebSiteId)) { expression = expression.And(t => t.TempletType == (int)Code.Enums.TempletType.Common || t.TempletType == (int)Code.Enums.TempletType.MSearch); } else { expression = expression.And(t => t.TempletType == (int)Code.Enums.TempletType.Common); } } return(service.FindList(expression, pagination).Distinct().ToList()); }
public bool BatchDelUser(string keyValue, string userId) { string[] IdArray = keyValue.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); var expression = ExtLinq.True <UserInfo>(); IUnitOfWork db = new EFUnitOfWork(Context).BeginTransaction(); for (var i = 0; i < IdArray.Length; i++) { if (i == 0) { expression = expression.And(a => a.F_Id == IdArray[i]); } else { expression = expression.Or(a => a.F_Id == IdArray[i]); } } try { using (db) { List <UserInfo> userList = Context.Users.Where(expression).ToList(); foreach (UserInfo user in userList) { user.F_DeleteMark = true; user.F_DeleteUserId = userId; user.F_DeleteTime = DateTime.Now; Update(user); } } } catch (Exception ex) { db.RollbackTransaction(); return(false); } return(true); }
public List <DbBackupEntity> GetList(Pagination pagination, string queryJson) { var expression = ExtLinq.True <DbBackupEntity>(); var queryParam = queryJson.ToJObject(); if (!queryParam["condition"].IsEmpty() && !queryParam["keyword"].IsEmpty()) { string condition = queryParam["condition"].ToString(); string keyword = queryParam["keyword"].ToString(); switch (condition) { case "DbName": expression = expression.And(t => t.DbName.Contains(keyword)); break; case "FileName": expression = expression.And(t => t.FileName.Contains(keyword)); break; } } expression = expression.And(t => t.DeleteMark != true); return(service.FindList(expression, pagination)); }
/// <summary> /// 根据时间段 ,项目ID ,查询最新的一条数据 /// </summary> /// <param name="startDate"></param> /// <param name="endDate"></param> /// <param name="itemCode"></param> /// <returns></returns> public Task <List <QualityResultEntity> > GetListByItemCode(DateTime startDate, DateTime endDate, string itemCode) { var expression = ExtLinq.True <QualityResultEntity>(); //过滤条件 expression = expression.And(t => t.F_ReportTime >= startDate && t.F_ReportTime <= endDate); expression = expression.And(t => t.F_ItemId == itemCode); expression = expression.And(t => t.F_EnabledMark == true); expression = expression.And(t => t.F_DeleteMark != true); var query = _service.IQueryable(expression); ////排序 //query = query.OrderBy(t => t.F_Pid).ThenByDescending(t => t.F_ReportTime); //分组 ,取第一条 var groups = query.GroupBy(t => t.F_Pid); var result = new List <QualityResultEntity>(); foreach (var item in groups) { //取时间最近的一条数据 result.Add(item.OrderByDescending(t => t.F_ReportTime).FirstOrDefault()); } return(Task.FromResult(result)); }
public List <ProfileSanitationAlongLitterBinEntity> GetList(Pagination pagination, string keyword, string projectId, string streetId, ProfileAlongLitterBinTypeEnum type) { int typeInt = type.GetIntValue(); var expression = ExtLinq.True <ProfileSanitationAlongLitterBinEntity>(); if (!string.IsNullOrEmpty(keyword)) { expression = expression.And(t => t.F_EnCode.Contains(keyword)); } if (!string.IsNullOrEmpty(streetId)) { expression = expression.And(t => t.StreetId == streetId); } expression = expression.And(t => t.Type == typeInt); expression = expression.And(t => t.ProjectId == projectId); return(service.FindList(expression, pagination)); }
/// <summary> /// 返回统计集合 类别、数量、金额 /// </summary> /// <param name="cateIds"></param> /// <param name="isTopic"></param> /// <returns></returns> public Dictionary <string, int> GetStaticsCount(List <string> cateIds, bool isTopic = false) { var expression = ExtLinq.True <Article>(); expression = expression.And(w => w.EnabledMark == true); if (!isTopic) { expression = expression.And(w => cateIds.Contains(w.CategoryId)); } else { expression = expression.And(w => cateIds.Contains(w.SpecialTopicId)); } var data = this.GetFeilds(u => new { u.Id, u.CategoryId, u.SpecialTopicId, u.RequireAmount }, expression, o => o.OrderBy(b => b.SortCode)); if (!isTopic) { return(data.GroupBy(g => g.CategoryId).Select(u => new { u.Key, Count = u.Count() }) .ToDictionary(k => k.Key, v => v.Count)); } return(data.GroupBy(g => g.SpecialTopicId).Select(u => new { u.Key, Count = u.Count() }) .ToDictionary(k => k.Key, v => v.Count)); }
public async Task <List <UserRole> > GetRoleList(string fType = "") { var expression = ExtLinq.True <UserRole>(); if (fType != "") { string[] fTypeArray = fType.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < fTypeArray.Length; i++) { string currentType = fTypeArray[i]; if (i == 0) { expression = expression.And(a => a.F_Category.ToString() == currentType); } else { expression = expression.Or(a => a.F_Category.ToString() == currentType); } } } //var roleList = from a in Context.UserRole select a; return(await Context.Set <UserRole>().Where(expression).ToListAsync()); }
public List <ContentEntity> GetList(string itemId, string keyword, Pagination pagination) { List <ContentEntity> models = new List <ContentEntity>(); var expression = ExtLinq.True <ContentEntity>(); expression = expression.And(t => t.ColumnId == itemId); if (!string.IsNullOrEmpty(keyword)) { expression = expression.And(t => t.FullName.Contains(keyword)); } expression = expression.And(m => m.DeleteMark != true); models = service.FindList(expression, pagination); models.ForEach(delegate(ContentEntity model) { if (model != null && model.UrlAddress != null) { model.UrlPage = model.UrlAddress; model.UrlPage = model.UrlPage.Replace(@"\", "/"); } }); return(models); }
public List <CheckMethodEntity> GetItemList(string check_method_name, string check_method_define, int?check_method_statue, Pagination p) { if (p.rows == 0 || p == null) { //分页rows=0 获取全部 return(GetCheckMethodByStatue(check_method_statue)); } var expression = ExtLinq.True <CheckMethodEntity>(); if (!string.IsNullOrEmpty(check_method_name)) { expression = expression.And(r => r.check_method_name.Contains(check_method_name)); } if (!string.IsNullOrEmpty(check_method_define)) { expression = expression.And(r => r.check_method_define.Contains(check_method_define)); } if (check_method_statue != null) { expression = expression.And(r => r.check_method_statue == check_method_statue); } return(service.FindList(expression, p)); }
public string GetChapterFile(string chapterID, string typeID) { string fileID = ""; var e = ExtLinq.True <ChapterContent>(); e = e.And(x => (x.DeleteMark == null ? false : x.DeleteMark) != true); e = e.And(x => x.ChapterID == chapterID); e = e.And(x => x.TypeID == typeID); var file = chapterContentApp.IQueryable(e).OrderByDescending(x => x.CreatorTime).FirstOrDefault(); if (file != null) { if (typeID == "文档") { fileID = adminurl + file.FileID; } else { fileID = file.FileID; } } return(fileID); }
public List <ItemsDetailEntity> GetList(string itemId = "", string keyword = "") { //cacheKey = cacheKey + "0_" + itemId + "_" + keyword;//拼接有参key值 //var cacheList = cache.GetCache<List<ItemsDetailEntity>>(cacheKey); //if (cacheList == null) //{ var expression = ExtLinq.True <ItemsDetailEntity>(); if (!string.IsNullOrEmpty(itemId)) { expression = expression.And(t => t.F_ItemId == itemId); } if (!string.IsNullOrEmpty(keyword)) { expression = expression.And(t => t.F_ItemName.Contains(keyword)); expression = expression.Or(t => t.F_ItemCode.Contains(keyword)); } var cacheList = service.IQueryable(expression).OrderBy(t => t.F_SortCode).ToList(); // cache.WriteCache<List<ItemsDetailEntity>>(cacheList, cacheKey, "UserCacheDependency", "Sys_ItemsDetail"); //} return(cacheList); }
/// <summary> /// 获取数据列表 /// </summary> /// <param name="pagination">分页,排序参数</param> /// <param name="keyword">检索关键字</param> /// <param name="projectId">关联项目Id</param> /// <returns></returns> public List <ProfileSanitationGreeningEntity> GetList(Pagination pagination, string keyword, string projectId, string streetId) { var expression = ExtLinq.True <ProfileSanitationGreeningEntity>(); if (!string.IsNullOrEmpty(keyword)) { int intF_Code = 0; int.TryParse(keyword, out intF_Code); expression = expression.And(t => t.Address.Contains(keyword)); expression = expression.Or(t => t.F_EnCode == intF_Code); expression = expression.Or(t => t.Origin.Contains(keyword)); expression = expression.Or(t => t.Destination.Contains(keyword)); } if (!string.IsNullOrEmpty(streetId)) { expression = expression.And(t => t.StreetId == streetId); } expression = expression.And(t => t.ProjectId == projectId); return(service.FindList(expression, pagination)); }
/// <summary> /// 根据 透析号/病历号/姓名/拼音 查询 /// </summary> /// <param name="keyValue"></param> /// <returns></returns> public Task <List <PatientEntity> > GetListFilter(string keyValue = "") { var expression = ExtLinq.True <PatientEntity>(); if (!string.IsNullOrEmpty(keyValue)) { if (int.TryParse(keyValue, out int dialysisNo)) { expression = expression.And(t => t.F_Name.Contains(keyValue)) .Or(t => t.F_RecordNo.Contains(keyValue)) .Or(t => t.F_DialysisNo == dialysisNo) .Or(t => t.F_PY.Contains(keyValue.ToUpper())); } else { expression = expression.And(t => t.F_Name.Contains(keyValue)) .Or(t => t.F_RecordNo.Contains(keyValue)) .Or(t => t.F_PY.Contains(keyValue.ToUpper())); } } expression = expression.And(t => t.F_EnabledMark != false); expression = expression.And(t => t.F_DeleteMark != true); return(_service.IQueryable(expression).ToListAsync()); }
public ActionResult GetADItems(Pagination pagination, long?lAid, string keyword) { var exp = ExtLinq.True <ADItemModel>(); if (lAid > 0) { exp.And(t => t.AID == lAid); } if (!string.IsNullOrEmpty(keyword)) { exp.And(t => t.IName.Contains(keyword)); } var data = new { rows = ADItem.IQueryable(exp).OrderBy(t => t.AID).ToList(), total = pagination.total, page = pagination.page, records = pagination.records }; return(Content(data.ToJson())); }
public List <UserEntity> GetList(Pagination pagination, string keyword, string DepartmentId, List <string> list = null) { var expression = ExtLinq.True <UserEntity>(); if (!string.IsNullOrEmpty(keyword)) { expression = expression.And(t => t.F_Account.Contains(keyword)); expression = expression.Or(t => t.F_RealName.Contains(keyword)); expression = expression.Or(t => t.F_MobilePhone.Contains(keyword)); if (list != null) { expression = expression.Or(t => list.Contains(t.F_DepartmentId)); } } if (!string.IsNullOrEmpty(DepartmentId)) { expression = expression.And(t => t.F_DepartmentId == DepartmentId); } expression = expression.And(t => t.F_Account != "admin"); var query = service.IQueryable(expression); pagination.records = query.Count(); return(query.ToList()); }
public List <C_ContentEntity> GetList(string itemId = "", string keyword = "") { List <C_ContentEntity> models = new List <C_ContentEntity>(); var expression = ExtLinq.True <C_ContentEntity>(); if (!string.IsNullOrEmpty(itemId)) { expression = expression.And(t => t.F_ModuleId == itemId); } if (!string.IsNullOrEmpty(keyword)) { expression = expression.And(t => t.F_FullName.Contains(keyword)); } models = service.IQueryable(expression).OrderBy(t => t.F_SortCode).ToList(); models.ForEach(delegate(C_ContentEntity model) { if (model != null && model.F_UrlAddress != null) { model.F_UrlPage = model.F_UrlAddress; model.F_UrlPage = model.F_UrlPage.Replace(@"\", "/"); } }); return(models); }
public List <Info_Page> SearchPage(int systemId, string companyId, string startTime, string endTime, string classId, string state, string keyword, int count) { try { DateTime dateStartTime = Utility.ToStartTime(startTime); DateTime dateEndTime = Utility.ToEndTime(endTime); bool blnState = state.ToBool(); int total = Utility.ToTopTotal(count); //条件 var expression = ExtLinq.True <Info_Page>(); expression = expression.And(m => m.SystemID == systemId && m.CompanyID == companyId && m.CreateDate.Value.Date >= dateStartTime.Date && m.CreateDate.Value.Date <= dateEndTime.Date && (string.IsNullOrWhiteSpace(classId) ? true : m.ClassID == classId) && (string.IsNullOrWhiteSpace(state) ? true : m.State.Value == blnState) && m.Title.Contains(keyword)); //执行 var expressionScalarLambda = GetExpressionScalarLambda(); return(FindListTop(expression, expressionScalarLambda, m => m.CreateDate, false, total).ToList()); } catch (Exception ex) { throw new Exception(ex.Message); } }
public Task <IEnumerable <DrugsSelectOptions> > GetList(string keyword = "") { if (_memoryCache.TryGetValue("drugs_select_options", out List <DrugsSelectOptions> cacheData)) { return(string.IsNullOrEmpty(keyword) ? Task.FromResult(cacheData.AsEnumerable()) : Task.FromResult(cacheData.Where(t => t.F_DrugCode.Contains(keyword) || t.F_DrugName.Contains(keyword) || t.F_DrugSpell.Contains(keyword)))); } { var expression = ExtLinq.True <DrugsEntity>(); expression = expression.And(t => t.F_EnabledMark == true); expression = expression.And(t => t.F_DeleteMark != true); cacheData = _service.IQueryable(expression).OrderBy(t => t.F_DrugName).Select(r => new DrugsSelectOptions { F_DrugAdministration = r.F_DrugAdministration, F_DrugCode = r.F_DrugCode, F_DrugMiniAmount = r.F_DrugMiniAmount, F_DrugMiniPackage = r.F_DrugMiniPackage, F_DrugMiniSpec = r.F_DrugMiniSpec, F_DrugName = r.F_DrugName, F_DrugSpec = r.F_DrugSpec, F_DrugSpell = r.F_DrugSpell, F_DrugSupplier = r.F_DrugSupplier, F_DrugUnit = r.F_DrugUnit, F_Charges = r.F_Charges, F_IsHeparin = r.F_IsHeparin, F_Id = r.F_Id }).ToList(); _memoryCache.Set("drugs_select_options", cacheData, TimeSpan.FromMinutes(5)); } return(string.IsNullOrEmpty(keyword)? Task.FromResult(cacheData.AsEnumerable()) : Task.FromResult(cacheData.Where(t => t.F_DrugCode.Contains(keyword) || t.F_DrugName.Contains(keyword) || t.F_DrugSpell.Contains(keyword)))); }
public List <WorkEntity> GetMyWorkList(string keyword = "") { var expression = ExtLinq.True <WorkEntity>(); if (!string.IsNullOrEmpty(keyword)) { expression = expression.And(t => t.FullName.Contains(keyword)); } var loguser = OperatorProvider.Provider.GetCurrent(); if (loguser != null) { expression = expression.And(t => t.ApplyUserId == loguser.UserId); } expression = expression.And(t => t.DeleteMark != true); List <WorkEntity> models = service.IQueryable(expression).OrderByDescending(t => t.CreatorTime).ToList(); models?.ForEach(delegate(WorkEntity model) { string desc = Code.EnumHelp.enumHelp.GetDescription(typeof(WorkStatus), model.FlowStatus); model.FlowStatusName = desc; }); return(models); }
public List <TaskDistributionEntity> GetItemList(string task_name, int?task_statue, int?task_type, string user_id, Pagination pagination) { var expression = ExtLinq.True <TaskDistributionEntity>(); expression = expression.And(r => r.statue == 0); if (!string.IsNullOrEmpty(task_name)) { expression = expression.And(r => r.task_name.Contains(task_name)); } if (task_statue != null) { expression = expression.And(r => r.task_distribute_statue == task_statue); } if (task_type != null) { expression = expression.And(r => r.task_type == task_type); } if (!string.IsNullOrEmpty(user_id)) { expression = expression.And(r => r.creator_user_id.Equals(user_id)); } return(service.FindList(expression, pagination)); }
public List <DbBackupEntity> GetList(Pagination pagination, string queryJson) { var expression = ExtLinq.True <DbBackupEntity>(); var queryParam = queryJson.ToJObject(); if (!queryParam["keyword"].IsEmpty()) { string keyword = queryParam["keyword"].ToString(); string condition = string.Empty; if (queryParam["condition"] != null) { condition = queryParam["condition"].ToString().Trim(); } if (condition == "DbName") { expression = expression.And(t => t.F_DbName.Contains(keyword)); } else { expression = expression.And(t => t.F_FileName.Contains(keyword)); } } return(service.FindList(expression, pagination)); }
public List <LateReturnReport> GetListByClass(string classId, string startTime, string endTime) { var expression = ExtLinq.True <LateReturnReport>(); if (!string.IsNullOrEmpty(classId)) { var OrgList = new List <string> { classId }; this.GetChildOrg(classId, OrgList); expression = expression.And(p => OrgList.Contains(p.Class)); } if (!string.IsNullOrEmpty(startTime)) { var start = Convert.ToDateTime(startTime + " 00:00:00"); expression = expression.And(p => p.CreatedTime >= start); } if (!string.IsNullOrEmpty(endTime)) { var end = Convert.ToDateTime(endTime + " 23:59:59"); expression = expression.And(p => p.CreatedTime <= end); } return(Read(expression).ToList()); }
/// <summary> /// 获取详情列表 /// </summary> /// <param name="pagination"></param> /// <param name="lAid"></param> /// <param name="keyword"></param> /// <returns></returns> public ActionResult GetItems(Pagination pagination, long?Cid, string keyword) { var exp = ExtLinq.True <GameModel>(); if (Cid > 0) { exp.And(t => t.GCategory == Cid); } if (!string.IsNullOrEmpty(keyword)) { exp.And(t => t.GName.Contains(keyword)); } var data = new { rows = wgR.IQueryable(exp).OrderBy(t => t.GSorce).ToList(), total = pagination.total, page = pagination.page, records = pagination.records }; return(Content(data.ToJson())); }
public List <Ld_Extend_SearchKeyword> SearchSearchKeyword(int systemId, string companyId, string startTime, string endTime, string keyword, int count) { try { DateTime dateStartTime = ToStartTime(startTime); DateTime dateEndTime = ToEndTime(endTime); if (dateStartTime == DateTime.MinValue) { return(null); } int total = GetTopTotal(count); //条件 var expression = ExtLinq.True <Ld_Extend_SearchKeyword>(); expression = expression.And(m => m.SystemID == systemId && m.CompanyID == companyId && m.CreateDate.Value.Date >= dateStartTime.Date && m.CreateDate.Value.Date <= dateEndTime.Date && (m.Keyword.Contains(keyword))); //执行 return(FindListTop(expression, m => m.ID, false, total).ToList()); } catch (Exception ex) { throw new Exception(ex.Message); } }
public PagedList <SysLog> GetList(LogSearchView search, int pageIndex, int pageSize) { var expression = ExtLinq.True <SysLog>(); if (!string.IsNullOrWhiteSpace(search.Keyword)) { string keyword = search.Keyword; expression = expression.And(t => t.Account.Contains(keyword) || t.Description.Contains(keyword) || t.ModuleName.Contains(keyword) || t.NickName.Contains(keyword) || t.Type.Contains(keyword)); } if (!string.IsNullOrWhiteSpace(search.Admin)) { string admin = search.Admin; expression = expression.And(t => t.Account.Contains(admin)); } if (search.StartTime.HasValue) { expression = expression.And(t => t.Date >= search.StartTime && t.Date <= search.EndTime); } return(_Respository.GetPagedList(expression, pageIndex, pageSize, w => w.OrderByDescending(d => d.Date))); }