Пример #1
0
 public ResultEntity <List <ShigongDTO> > GetShigongList([FromQuery] Request_Shigong dto)
 {
     if (ModelState.IsValid)
     {
         LogUtil.log.Info(ModelState);
     }
     else
     {
         LogUtil.log.Info(ModelState);
     }
     return(new ResultEntityUtil <List <ShigongDTO> >().Success(dm.GetShigongList(dto, out int count), count));
 }
Пример #2
0
        public List <ShigongDTO> GetShigongList(Request_Shigong dto, out int count)
        {
            List <ShigongDTO> dtoli = new List <ShigongDTO>();

            Expression <Func <Shigong, bool> > expr = AutoAssemble.Splice <Shigong, Request_Shigong>(dto);

            if (dto.BShiyongTime2 != null)
            {
                expr = expr.And2(w => w.ShiyongTime2 >= dto.BShiyongTime2);
            }
            if (dto.EShiyongTime2 != null)
            {
                expr = expr.And2(w => w.ShiyongTime2 <= dto.EShiyongTime2);
            }
            //throw new  Exception("11111111111");
            count = c.Shigong.Where(expr).Count();
            //List<Shigong> li = c.Shigong.Where(expr).OrderBy(px => px.Code).Skip((dto.PageIndex - 1) * dto.PageSize).Take(dto.PageSize).ToList();

            dtoli = c.Shigong.Where(expr).OrderBy(px => px.Code).Skip((dto.PageIndex - 1) * dto.PageSize).Take(dto.PageSize)
                    .Select(x => new ShigongDTO
            {
                BiaoduanId     = x.BiaoduanId,
                BiaoduanName   = x.Biaoduan.BiaoduanName,
                Code           = x.Code,
                Id             = x.Id,
                Money          = x.Money,
                PayDuixiang    = x.PayDuixiang,
                RegisterPeople = x.RegisterPeople,
                Remarks        = x.Remarks,
                ShenhePeople   = x.ShenhePeople,
                ShiyongTime    = x.ShiyongTime,
                ShiyongTime2   = x.ShiyongTime2,
                Yongtu         = x.Yongtu
            }).ToList();
            //GetMapperDTO.GetDTOList<Shigong, ShigongDTO>(li);
            return(dtoli);
        }