Пример #1
0
        public ActionResult Query(RegisterSearchDTO dto)
        {
            UserLoginDTO lng = Session["UserLoginInfo"] as UserLoginDTO;

            dto.UserInfo = lng.UserInfo();
            var result = _RegisterService.Query(dto);

            return(new JsonResult(result));
        }
Пример #2
0
        /// <summary>
        /// 查询列表
        /// </summary>
        public PageableDTO <RegisterResultDTO> Query(RegisterSearchDTO q)
        {
            if (q.PublishDateTo.HasValue)
            {
                q.PublishDateTo = new DateTime(q.PublishDateTo.Value.Year, q.PublishDateTo.Value.Month, q.PublishDateTo.Value.Day, 23, 59, 59);
            }
            var token = q.UserInfo as UserInfoDTO;

            q.InitQuery("PublishDate", false);
            return(document.Document_Register
                   .Where(p => string.IsNullOrEmpty(q.Search) ? true : (p.ProductNo.Contains(q.Search) || p.Title.Contains(q.Search) || p.Publisher.Contains(q.Search)))//货号、标题、发布人
                   .Where(p => q.PublishDateFrom.HasValue ? p.PublishDate >= q.PublishDateFrom : true)
                   .Where(p => q.PublishDateTo.HasValue ? p.PublishDate <= q.PublishDateTo : true)
                   .Where(p => q.ProductTypeID > 0 ? p.ProductTypeID == q.ProductTypeID : true)
                   .Where(p => q.ProductLineID > 0 ? p.ProductLineID == q.ProductLineID : true)
                   .Where(p => token.UserType != 2 ? true : token.ProductLineIDs.Contains(p.ProductLineID.Value))
                   .Select(p => new RegisterResultDTO
            {
                RegisterID = p.RegisterID,
                ProductLineID = p.ProductLineID,
                ProductTypeID = p.ProductTypeID,
                ProductTypeName = p.ProductTypeName,
                ProductLineName = p.ProductLineName,
                ProductNo = p.ProductNo,
                Title = p.Title,
                ValidDate = p.ValidDate,
                Publisher = p.Publisher,
                PublishDate = p.PublishDate,
                UpdateDate = p.UpdateDate,
                IsDownload = p.Document_RegisterAttachment.All(att => att.Document_RegisterAttachmentDownload.Count > 0 && att.Document_RegisterAttachmentDownload.All(down => down.IsDownload == true && down.UserID == token.UserID)),
                Attachments = p.Document_RegisterAttachment.Select(att => new RegisterAttachmentDTO
                {
                    AttachmentID = att.AttachmentID,
                    AttachmentName = att.AttachmentName,
                    AttachmentSize = att.AttachmentSize
                })
            }).ToPageable(q));
        }
Пример #3
0
 public PageableDTO <RegisterResultDTO> Query(RegisterSearchDTO q)
 {
     q.UserInfo.ProductLineIDs = _UserService.GetProductLines(q.UserInfo.UserID);
     return(_RegisterService.Query(q));
 }