// 我的申请 public List <Approval> MyApprovals(string userNo, int pageIndex, out int total) { pageIndex = pageIndex <= 0 ? 1 : pageIndex; var list = _db.Query <Approval>() .Where(a => a.ApplicantNo == userNo) .OrderBy(a => a.CreateAt, MyDbOrderBy.Desc) .ToPageList(pageIndex, 20, out var count); total = count; return(list); }
public async Task <ActionResult> Index() { var expr = LinqExtensions.True <AppUser>(); expr = expr.And(u => !u.IsDelete); var data = await _db.Query <AppUser>() .Where(expr) .Select <AppUserListDto>(u => new AppUserListDto { Id = u.Id, No = u.No, Name = u.Name, DepartmentName = u.Department.Name }).ToListAsync(); return(View(data)); }
public IActionResult Index(int id, ApprovalSearchParameter search) { var pageIndex = id > 0 ? id : 1; var where = LinqExtensions.True <Approval>(); if (search.Department > 0) { where = where.And(a => a.DepartmentId == search.Department); } if (!string.IsNullOrWhiteSpace(search.Creator)) { where = where.And(a => a.ApplicantNo == search.Creator); } if (search.CreateAtStart.HasValue) { where = where.And(a => a.CreateAt >= search.CreateAtStart.Value); } if (search.CreateAtEnd.HasValue) { where = where.And(a => a.CreateAt <= search.CreateAtEnd.Value); } if (search.Step > 0) { where = where.And(a => a.ApproveStep == search.Step); } if (search.Result > 0) { where = where.And(a => a.ApproveResult == search.Result); } if (!string.IsNullOrWhiteSpace(search.Approver)) { where = where.And(a => a.ApproverNo == search.Approver || a.ConfirmNo == search.Approver); } var query = _db.Query <Approval>().Include(a => a.Department); var data = query.Where(where).ToPageList(pageIndex, 20, out var recordCount); var result = _mapper.Map <ApprovalResult>(search); result.PageIndex = pageIndex; result.RecordCount = recordCount; result.PageCount = recordCount / 20 + (recordCount % 20 > 0 ? 1 : 0); result.Data = data; ViewBag.Departments = new SelectList(_db.Fetch <Department>(), "Id", "Name"); return(View(result)); }
// GET: Students public ActionResult Index(int id, StudentSearchDto search) { var expr = LinqExtensions.True <Student>(); expr = expr.And(s => s.IsDel == false); if (!string.IsNullOrWhiteSpace(search.Key)) { expr = expr.And(s => s.StudentName.Contains(search.Key.Trim()) || s.Mobile.Contains(search.Key.Trim())); } if (search.School.HasValue) { expr = expr.And(s => s.FKSchoolId == search.School.Value); } if (search.CreateStart.HasValue) { expr = expr.And(s => s.CreateAt >= search.CreateStart.Value); } if (search.CreateEnd.HasValue) { expr = expr.And(s => s.CreateAt <= search.CreateEnd.Value); } id = id <= 0 ? 1 : id; var data = _db.Query <Student>() .Include(s => s.School) .Where(expr) .OrderByDesc(s => s.UpdateAt) .ToPageList(id, 20, out var recordCount); InitUi(); return(View(data)); }
public ActionResult Index() { var list = _db.Query <School>().Where(s => !s.IsDel).OrderByDesc(s => s.UpdateAt).ToList(); return(View(list)); }
public async Task <ActionResult> Index() { var data = await _db.Query <Department>().ToListAsync(); return(View(data)); }