/// <summary>
        /// 列表查询
        /// </summary>
        /// <param name="PAQuery"></param>
        /// <returns></returns>
        public PageModel <ProductAuthentication> GetProductAuthenticationList(ProductAuthenticationQuery PAQuery)
        {
            int num = 0;

            IQueryable <ProductAuthentication> PA = context.ProductAuthentication.AsQueryable <ProductAuthentication>();

            if (!string.IsNullOrWhiteSpace(PAQuery.ComName))
            {
                PA =
                    from d in PA
                    where d.ComName.Contains(PAQuery.ComName)
                    orderby d.ProductAuthDate descending
                    select d;
            }
            if (!string.IsNullOrWhiteSpace(PAQuery.ProductCode))
            {
                PA =
                    from d in PA
                    where d.ProductCode.Equals(PAQuery.ProductCode)
                    orderby d.ProductAuthDate descending
                    select d;
            }
            if (!string.IsNullOrWhiteSpace(PAQuery.AuthStatus))
            {
                int i;
                if (int.TryParse(PAQuery.AuthStatus, out i))
                {
                    int k = int.Parse(PAQuery.AuthStatus);
                    PA =
                        from d in PA
                        where d.AuthStatus == k
                        orderby d.ProductAuthDate descending
                        select d;
                }
            }
            if (!string.IsNullOrWhiteSpace(PAQuery.ManageId.ToString()) && PAQuery.ManageId != 0)
            {
                PA =
                    from d in PA
                    where d.ManageId == PAQuery.ManageId
                    orderby d.ProductAuthDate descending
                    select d;
            }
            PA = PA.GetPage(out num, PAQuery.PageNo, PAQuery.PageSize, (IQueryable <ProductAuthentication> d) =>
                            from o in d
                            orderby o.ProductAuthDate descending
                            select o);
            return(new PageModel <ProductAuthentication>()
            {
                Models = PA,
                Total = num
            });
        }
Beispiel #2
0
        public JsonResult ListProductAuthentication(int page, int rows, string comname, string productCode, string AuthStatus)
        {
            IProductAuthenticationService IPAS = ServiceHelper.Create <IProductAuthenticationService>();
            ProductAuthenticationQuery    PAQ  = new ProductAuthenticationQuery()
            {
                ComName     = comname,
                ProductCode = productCode,
                AuthStatus  = AuthStatus,
                PageNo      = page,
                PageSize    = rows,
            };
            PageModel <ProductAuthentication>   pm     = IPAS.GetProductAuthenticationList(PAQ);
            IEnumerable <ProductAuthentication> models =
                from item in pm.Models.ToArray()
                select new ProductAuthentication()
            {
                Id              = item.Id,
                ManageId        = item.ManageId,
                ProductCode     = item.ProductCode,
                ProductIMG      = item.ProductIMG,
                ProductDesc     = item.ProductDesc,
                ProductAuthDate = item.ProductAuthDate,
                AuthStatus      = item.AuthStatus,
                AuthAuthor      = item.AuthAuthor,
                AuthTime        = item.AuthTime,
                AuthDesc        = item.AuthDesc,
                ComName         = item.ComName,
                ComAttachment   = item.ComAttachment
            };
            DataGridModel <ProductAuthentication> dataGridModel = new DataGridModel <ProductAuthentication>()
            {
                rows  = models,
                total = pm.Total
            };

            return(Json(dataGridModel));
        }