/// <summary> /// 获取数据列表 /// </summary> /// <param name="pagination">分页,排序参数</param> /// <param name="keyword">检索关键字</param> /// <param name="projectId">关联项目Id</param> /// <returns></returns> public List <ProfileAmenitiesParkEntity> GetList(Pagination pagination, string keyword, string projectId, string streetId) { var expression = ExtLinq.True <ProfileAmenitiesParkEntity>(); if (!string.IsNullOrEmpty(keyword)) { expression = expression.And(t => t.F_EnCode.Contains(keyword)); expression = expression.Or(t => t.ParkName.Contains(keyword)); expression = expression.Or(t => t.Address.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)); }
public ActionResult GetGridJson(Pagination pagination, string keyword) { var expression = ExtLinq.True <MessageEntity>(); if (!string.IsNullOrEmpty(keyword)) { expression = expression.And(d => d.F_Title.Contains(keyword)); expression = expression.Or(d => d.F_Content.Contains(keyword)); } var data = new { rows = customerApp.GetList(pagination, expression), total = pagination.total, page = pagination.page, records = pagination.records }; return(Content(data.ToJson())); }
public bool UpdateNoticeCategoryState(int systemId, string companyId, string categoryId, bool state) { try { var expression = ExtLinq.True <Ld_Info_NoticeCategory>(); expression = expression.And(m => m.SystemID == systemId && m.CompanyID == companyId && m.CategoryID == categoryId); if (!IsExists(expression)) { throw new Exception("类别ID无效!"); } var entity = Find(expression); entity.State = state; return(Update(entity)); } catch (Exception ex) { throw new Exception(ex.Message); } }
private const string appcode = ""; //阿里云账号里的key #region 列表 /// <summary> /// 列表 /// </summary> public List <Models.SysExpressSearch> GetList(Pagination pagination, string queryJson) { var expression = ExtLinq.True <Models.SysExpressSearch>(); var queryParam = queryJson.ToJObject(); DateTime dateTime = DateTime.Now; if (!queryParam["mailNo"].IsEmpty()) { string mailNo = queryParam["mailNo"].ToString(); expression = expression.And(t => t.MailNo == mailNo); } if (!queryParam["expSpellName"].IsEmpty()) { string expSpellName = queryParam["expSpellName"].ToString(); expression = expression.And(t => t.ExpSpellName == expSpellName); } return(service.FindList(expression, pagination)); }
public List <CustomerTransactionEntity> GetList(DateTime?beginTime, DateTime?endTime, bool?tranStatus) { var expression = ExtLinq.True <CustomerTransactionEntity>(); if (beginTime != null) { expression = expression.And(t => t.BillDate >= beginTime); } if (endTime != null) { DateTime?e = endTime.Value.AddDays(1); expression = expression.And(t => t.BillDate < endTime); } if (tranStatus != null) { expression = expression.And(t => t.TradStatus.Equals(tranStatus)); } return(service.IQueryable(expression).OrderByDescending(t => t.CreatorTime).ToList()); }
public Task <List <LabItemEntity> > GetList(Pagination pagination, string queryJson) { var expression = ExtLinq.True <LabItemEntity>(); var queryParam = queryJson.ToJObject(); if (!queryParam["keyword"].IsEmpty()) { var keyword = queryParam["keyword"]?.ToString(); expression = expression.And(t => t.F_Code.Contains(keyword) || t.F_Name.Contains(keyword) || t.F_EnName.Contains(keyword) || t.F_ShortName.Contains(keyword)); } if (!queryParam["timeType"].IsEmpty()) { var timeType = queryParam["timeType"]?.ToString(); expression = expression.And(t => t.F_Type == timeType); } expression = expression.And(t => t.F_DeleteMark != true); return(_service.FindListAsync(expression, pagination)); }
public List <PayOrderViewModel> GetList(DateTime begintime, DateTime endtime, string companyId = "") { var expression = ExtLinq.True <PayOrderViewModel>(); if (begintime != null) { expression = expression.And(t => t.F_PaymentTime >= begintime); } if (endtime != null) { endtime = endtime.AddDays(1); expression = expression.And(t => t.F_PaymentTime < endtime); } if (!string.IsNullOrEmpty(companyId)) { expression = expression.And(t => t.F_OwnerId == companyId); } return(_viewService.IQueryable(expression).ToList()); }
public bool UpdateLinkState(int systemId, string companyId, string linkId, bool state) { try { var expression = ExtLinq.True <Extend_Link>(); expression = expression.And(m => m.SystemID == systemId && m.CompanyID == companyId && m.LinkID == linkId); var entity = Find(expression); if (entity == null) { throw new Exception("主建ID无效!"); } entity.State = state; return(Update(entity)); } catch (Exception ex) { throw new Exception(ex.Message); } }
public List <LogEntity> GetList(Pagination pagination, string queryJson, string account) { var expression = ExtLinq.True <LogEntity>(); var queryParam = queryJson.ToJObject(); if (string.IsNullOrEmpty(account) || !account.Equals("admin")) { expression = expression.And(t => !t.F_Account.Equals("admin")); } if (!queryParam["keyword"].IsEmpty()) { string keyword = queryParam["keyword"].ToString(); expression = expression.And(t => t.F_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.F_Date >= startTime && t.F_Date <= endTime); } return(service.FindList(expression, pagination)); }
public long CountAdvertisement(int systemId, string companyId, string startTime, string endTime, string state, string keyword) { try { DateTime dateStartTime = Utility.ToStartTime(startTime); DateTime dateEndTime = Utility.ToEndTime(endTime); bool blnState = state.ToBool(); var expression = ExtLinq.True <Extend_Advertisement>(); expression = expression.And(m => m.SystemID == systemId && m.CompanyID == companyId && m.CreateDate.Value.Date >= dateStartTime.Date && m.CreateDate.Value.Date <= dateEndTime.Date && (string.IsNullOrWhiteSpace(state) ? true : m.State.Value == blnState) && (m.Name.Contains(keyword) || m.Remark.Contains(keyword))); return(Count(expression)); } catch (Exception ex) { throw new Exception(ex.Message); } }
public List <RoleEntity> GetList(string keyword = "") { cacheKey = cacheKey + "0_" + keyword;//拼接有参key值 var cacheList = cache.GetCache <List <RoleEntity> >(cacheKey); if (cacheList == null) { var expression = ExtLinq.True <RoleEntity>(); if (!string.IsNullOrEmpty(keyword)) { expression = expression.And(t => t.F_FullName.Contains(keyword)); expression = expression.Or(t => t.F_EnCode.Contains(keyword)); } expression = expression.And(t => t.F_Category == 1); cacheList = service.IQueryable(expression).OrderBy(t => t.F_SortCode).ToList(); cache.WriteCache <List <RoleEntity> >(cacheList, cacheKey, "UserCacheDependency", "Sys_Role"); } return(cacheList); }
public bool UpdateLinkGroupSort(int systemId, string companyId, string groupId, int sort) { try { var expression = ExtLinq.True <Extend_LinkGroup>(); expression = expression.And(m => m.SystemID == systemId && m.CompanyID == companyId && m.GroupID == groupId); if (!IsExists(expression)) { throw new Exception("类别ID无效!"); } var entity = Find(expression); entity.Sort = sort; return(Update(entity)); } catch (Exception ex) { throw new Exception(ex.Message); } }
public List <Info_Notice> GetNoticePaging(int systemId, string companyId, string classId, string state, int pageId, int pageSize) { try { bool noticeState = state.ToBool(); var expression = ExtLinq.True <Info_Notice>(); expression = expression.And(m => m.SystemID == systemId && m.CompanyID == companyId && (string.IsNullOrWhiteSpace(classId) ? true : m.ClassID == classId) && (string.IsNullOrWhiteSpace(state) ? true : m.State.Value == noticeState)); var expressionScalarLambda = GetExpressionScalarLambda(); int pageIndex = Utility.ToPageIndex(pageId); int pageCount = Utility.ToPageCount(pageSize); return(FindListPaging(expression, expressionScalarLambda, m => m.CreateDate, false, pageIndex, pageCount).ToList()); } catch (Exception ex) { throw new Exception(ex.Message); } }
//private UserLogOnApp userLogOnApp = new UserLogOnApp(); public List <CustomerEntity> GetList(Pagination pagination, string keyword, int area) { var expression = ExtLinq.True <CustomerEntity>(); if (!string.IsNullOrEmpty(keyword)) { expression = expression.And(t => t.F_Name.Contains(keyword)); expression = expression.Or(d => d.F_Tel.Contains(keyword)); //expression = expression.Or(t => t.F_RealName.Contains(keyword)); //expression = expression.Or(t => t.F_MobilePhone.Contains(keyword)); } if (area != 0) { expression = expression.And(d => d.F_Area == area); } //expression = expression.And(t => t.F_Account != "admin"); return(service.FindList(expression, pagination)); }
public bool DeleteAdvertisement(int systemId, string companyId, string advertisementId) { try { var expressionAdvertisement = ExtLinq.True <Extend_Advertisement>(); expressionAdvertisement = expressionAdvertisement.And(m => m.SystemID == systemId && m.CompanyID == companyId && m.AdvertisementID == advertisementId); var expressionAdvertisementDetails = ExtLinq.True <Extend_AdvertisementDetails>(); expressionAdvertisementDetails = expressionAdvertisementDetails.And(m => m.SystemID == systemId && m.CompanyID == companyId && m.AdvertisementID == advertisementId); int intnum = 0; var dbContext = new DAL.BaseDAL(CTMSContext); using (var db = dbContext.DbEntities()) { //using (var trans = db.Database.BeginTransaction()) //{ // try // { // dbContext.Delete(expressionAdvertisement); // dbContext.Delete(expressionAdvertisementDetails); // intnum = db.SaveChanges(); // trans.Commit(); // } // catch (Exception) // { // trans.Rollback(); // } // return intnum > 0; //} db.Orm.Transaction(() => { dbContext.Delete(expressionAdvertisement); dbContext.Delete(expressionAdvertisementDetails); intnum = db.SaveChanges(); }); return(intnum > 0); } } catch (Exception ex) { throw new Exception(ex.Message); } }
public List <Extend_Link> GetLinkTop(int systemId, string companyId, string groupId, string typeId, string state, int count) { try { byte byteTypeId = typeId.ToByte(); bool blnState = state.ToBool(); var expression = ExtLinq.True <Extend_Link>(); expression = expression.And(m => m.SystemID == systemId && m.CompanyID == companyId && (string.IsNullOrWhiteSpace(groupId) ? true : m.GroupID == groupId) && (string.IsNullOrWhiteSpace(typeId) ? true : m.TypeID.Value == byteTypeId) && (string.IsNullOrWhiteSpace(state) ? true : m.State.Value == blnState)); int total = Utility.ToTopTotal(count); return(FindListTop(expression, m => m.Sort, true, total).ToList()); } catch (Exception ex) { throw new Exception(ex.Message); } }
/// <summary> /// 获得用户信息列表信息 /// </summary> /// <param name="pagination"></param> /// <param name="keyword"></param> /// <returns></returns> public List <UserEntity> GetList(Pagination pagination, string keyword) { var expression = ExtLinq.True <UserEntity>(); expression = expression.And(t => t.F_Account != "admin"); 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)); } ResultClass <List <UserEntity> > _ret = service.FindList(expression, pagination); if (_ret.Result) { return(_ret.ResultData.OrderBy(t => t.F_SortCode).ToList()); } return(new List <UserEntity>()); }
/// <summary> /// 分类列表(按需加载) /// </summary> /// <param name="currentId"></param> /// <param name="parentId"></param> /// <param name="containsChild"></param> /// <returns></returns> public List <ListItem> GetTopicCateList(string currentId, string parentId, bool containsChild = false) { var expression = ExtLinq.True <ArticleTopic>(); if (!parentId.IsEmpty()) { expression = expression.And(t => t.ParentId == parentId); } else if (!containsChild) { expression = expression.And(t => t.ParentId == null); } else { expression = expression.And(t => t.TopicStatus == (int)TopicStatus.Audited); } //todo 编辑时已选择 var curparentId = ""; if (!currentId.IsEmpty()) { curparentId = _Respository.Get(w => w.Id == currentId).Select(u => u.ParentId).FirstOrDefault(); } var data = _Respository.GetFeilds(u => new ListItem { Code = u.Id, Text = u.Title, ParentId = u.ParentId, Selected = (u.Id == currentId || u.Id == curparentId) }, expression, o => o.OrderBy(t => t.SortCode)).ToList(); //var ids = new string[]{curparentId,currentId }; //var any = data.Any(w => ids.Contains(w.Code)); if (containsChild && data.Any()) { var pclist = data.Where(w => w.ParentId == null).ToList(); foreach (var item in pclist) { item.Childs = data.Where(w => w.ParentId == item.Code).ToList(); } return(pclist); } return(data); }
public int DeleteAccountAll(int systemId, string companyId, string memberId) { try { var entity = GetAccount(systemId, companyId, memberId); if (entity == null) { throw new Exception("会员ID不存在!"); } var expressionAddress = ExtLinq.True <Ld_Member_Address>(); expressionAddress = expressionAddress.And(m => m.SystemID == systemId && m.CompanyID == companyId && m.MemberID == memberId); var expressionInvoice = ExtLinq.True <Ld_Member_Invoice>(); expressionInvoice = expressionInvoice.And(m => m.SystemID == systemId && m.CompanyID == companyId && m.MemberID == memberId); int intnum = 0; var dbContext = new DAL.BaseDAL(LdCmsDbEntitiesContext); using (var db = dbContext.DbEntities()) { using (var trans = db.Database.BeginTransaction()) { try { dbContext.Delete(expressionAddress); dbContext.Delete(expressionInvoice); db.Set <Ld_Member_Account>().Remove(entity); intnum = db.SaveChanges(); trans.Commit(); } catch (Exception) { trans.Rollback(); } return(intnum); } } } catch (Exception ex) { throw new Exception(ex.Message); } }
//根据学生ID获取晚归记录 public List <LateReturnReport> GetLateListByStuId(string studentId, string startTime, string endTime) { var expression = ExtLinq.True <LateReturnReport>(); if (!string.IsNullOrEmpty(studentId)) { expression = expression.And(p => p.StudentId.Equals(studentId)); } 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()); }
public List <C_ContentEntity> GetList(Pagination pagination, string keyword) { List <C_ContentEntity> models = new List <C_ContentEntity>(); var expression = ExtLinq.True <C_ContentEntity>(); if (!string.IsNullOrEmpty(keyword)) { expression = expression.And(t => t.F_FullName.Contains(keyword)); } models = service.FindList(expression, pagination); 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); }
/// <summary> /// 根据userid分页获取数据 /// </summary> /// <param name="keyword"></param> /// <param name="pagination"></param> /// <returns></returns> public List <DailyEntity> GetListByCondition(string queryJson, Pagination pagination, string userID) { var expression = ExtLinq.True <DailyEntity>(); var queryParam = queryJson.ToJObject(); if (!queryParam["keyword"].IsEmpty()) { string keyword = queryParam["keyword"].ToString(); expression = expression.And(t => t.Title.Contains(keyword)); } if (!queryParam["timeType"].IsEmpty()) { DateTime endTime = DateTime.Now.ToString("yyyy-MM-dd").ToDate().AddDays(1); DateTime startTime = TimeHelper.HandStartTime(queryParam["timeType"].ToString()); expression = expression.And(t => t.F_CreatorTime >= startTime && t.F_CreatorTime <= endTime); } return(service.FindList(expression, pagination).ToList()); }
public List <Service_MessageBoard> SearchMessageBoard(int systemId, string companyId, string startTime, string endTime, 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 <Service_MessageBoard>(); expression = expression.And(m => m.SystemID == systemId && m.CompanyID == companyId && m.CreateDate.Value.Date >= dateStartTime.Date && m.CreateDate.Value.Date <= dateEndTime.Date && (string.IsNullOrWhiteSpace(state) ? true : m.State.Value == blnState) && (m.Name.Contains(keyword) || m.Content.Contains(keyword))); return(FindListTop(expression, m => m.CreateDate, false, total).ToList()); } catch (Exception ex) { throw new Exception(ex.Message); } }
public List <Log_LoginRecord> SearchLoginRecord(int systemId, string companyId, string startTime, string endTime, string clientId, string keyword, int count) { try { DateTime dateStartTime = Utility.ToStartTime(startTime); DateTime dateEndTime = Utility.ToEndTime(endTime); byte btClientId = clientId.ToByte(); int total = Utility.ToTopTotal(count); var expression = ExtLinq.True <Log_LoginRecord>(); expression = expression.And(m => m.SystemID == systemId && m.CompanyID == companyId && m.CreateDate.Value.Date >= dateStartTime.Date && m.CreateDate.Value.Date <= dateEndTime.Date && (string.IsNullOrWhiteSpace(clientId) ? true : m.ClientID.Value == btClientId) && (m.Account.Contains(keyword) || m.NickName.Contains(keyword) || m.IpAddress.Contains(keyword))); return(FindListTop(expression, m => m.ID, false, total).ToList()); } catch (Exception ex) { throw new Exception(ex.Message); } }
/// <summary> /// 超管之外的人查询公告 /// </summary> /// <param name="pagination"></param> /// <param name="title"></param> /// <param name="d1"></param> /// <param name="d2"></param> /// <returns></returns> public object GetListBySearch(Pagination pagination, string title, string d1, string d2) { var exp = _repository.IQueryableAsNoTracking <Sys_Notice>(p => p.IsUse && p.AuditStatus == 1); if (!string.IsNullOrEmpty(title)) { exp = exp.Where(p => p.Title.Contains(title)); } if (!string.IsNullOrEmpty(d1)) { DateTime _d1 = DateTime.Parse(d1); exp = exp.Where(p => p.JoinTime >= _d1); } if (!string.IsNullOrEmpty(d2)) { DateTime _d2 = DateTime.Parse(d2); exp = exp.Where(p => p.JoinTime <= _d2); } return(ExtLinq.QueryPaging(exp, pagination)); }
public JsonResult FindInitList(HR_report_list model) { TestDBContext testContext = new TestDBContext(); var expression = ExtLinq.True <HR_report_list>(); if (!string.IsNullOrEmpty(model.CodeOrName)) { expression = expression.And(t => t.t_name.Contains(model.CodeOrName)); } var list = testContext.HR_report_list.Where(expression).ToList(); List <HR_report_list> rows = new List <HR_report_list>(); rows = list.Skip(model.pagesize * (model.pagenumber - 1)).Take(model.pagesize).ToList();// Skip(每个页面显示个数 * 页数).Take(每个页面显示个数) var obj = new { rows = rows, pagenumber = model.pagenumber, pagesize = model.pagesize, total = list.Count() }; return(Json(obj)); }
public virtual IQueryable <T> LoadPageEntitiesOrderByField( Expression <Func <T, bool> > whereLambda, string field, int pageSize, int pageIndex, out int totalCount, bool isASC, E_DbClassify dbClassify = E_DbClassify.Write ) { field = field.IsEmpty() ? "Unix" : field; WisdomScenicDbContext _db = GetDbContext(dbClassify); IQueryable <T> _tIQueryable = _db.Set <T>().AsNoTracking().Where(whereLambda); totalCount = _tIQueryable.Count(); _tIQueryable = ExtLinq.ApplyOrder(_tIQueryable, field, isASC); _tIQueryable = _tIQueryable.Skip((pageIndex - 1) * pageSize).Take(pageSize); return(_tIQueryable); }
public List <WorkEntity> GetAllList(string keyword = "") { var expression = ExtLinq.True <WorkEntity>(); if (!string.IsNullOrEmpty(keyword)) { expression = expression.And(t => t.FullName.Contains(keyword)); } List <WorkEntity> models = service.IQueryable(expression).OrderByDescending(t => t.CreatorTime).ToList(); if (models != null && models.Count > 0) { models.ForEach(delegate(WorkEntity model) { string desc = Code.EnumHelp.enumHelp.GetDescription(typeof(WorkStatus), model.FlowStatus); model.FlowStatusName = desc; }); } return(models); }
public BillCodeRuleEntity FindEntity(string FTableName, bool FROB) { var expression = ExtLinq.True <BillCodeRuleEntity>(); expression = expression.And(t => t.FTableName.Equals(FTableName)); if (!FROB) { expression = expression.And(t => t.FROB.Equals(false)); } else { expression = expression.And(t => t.FROB.Equals(true)); } BillCodeRuleEntity entity = new BillCodeRuleEntity(); entity = service.FindEntity(expression); return(entity); }
public List <Extend_Link> GetLinkPaging(int systemId, string companyId, string groupId, string typeId, string state, int pageId, int pageSize) { try { byte byteTypeId = typeId.ToByte(); bool blnState = state.ToBool(); var expression = ExtLinq.True <Extend_Link>(); expression = expression.And(m => m.SystemID == systemId && m.CompanyID == companyId && (string.IsNullOrWhiteSpace(groupId) ? true : m.GroupID == groupId) && (string.IsNullOrWhiteSpace(typeId) ? true : m.TypeID.Value == byteTypeId) && (string.IsNullOrWhiteSpace(state) ? true : m.State.Value == blnState)); int pageIndex = Utility.ToPageIndex(pageId); int pageCount = Utility.ToPageCount(pageSize); return(FindListPaging(expression, m => m.CreateDate, false, pageIndex, pageCount).ToList()); } catch (Exception ex) { throw new Exception(ex.Message); } }