Exemplo n.º 1
0
        public IEnumerable <dynamic> GetPageList(System.Collections.Specialized.NameValueCollection nvl, out int recordCount)
        {
            var query        = ProductDictionaryVerRepository.GetQuery();
            var queryProduct = ProductVerRepository.GetQuery();
            var queryUser    = UserRepository.GetQuery();
            var productId    = nvl["productId"].ToType <int?>();
            var state        = nvl["state"];
            var verstate     = nvl["verstate"];
            var q            = from x in query
                               join y in queryProduct on x.ProductId equals y.ProductId
                               select new
            {
                x.Id,
                x.CreateDT,
                x.ProductId,
                x.Status,
                x.VerStatus,
                x,
                ParenCount = x.ProductDictionaryDatas.Count(o => o.DicPSN <= 0),
                ChildCount = x.ProductDictionaryDatas.Count(o => o.DicPSN > 0),
                y.SysName,
                Updater   = queryUser.Where(o => o.UserId == x.UpdateUID).Select(o => o.FullName).FirstOrDefault(),
                Publisher = queryUser.Where(o => o.UserId == x.PublishUID).Select(o => o.FullName).FirstOrDefault()
            };

            if (productId.HasValue)
            {
                q = q.Where(o => o.ProductId == productId);
            }
            if (!state.IsNullOrEmpty())
            {
                var st = state.Split(',').Select(o => short.Parse(o)).ToList();
                q = q.Where(o => st.Contains(o.Status));
            }
            if (!verstate.IsNullOrEmpty())
            {
                var st = verstate.Split(',').Select(o => short.Parse(o)).ToList();
                q = q.Where(o => st.Contains(o.VerStatus));
            }
            recordCount = q.Count();
            return(q.ToPageList().Select(x => new{
                x.Id,
                x.x.DictId,
                x.ProductId,
                x.SysName,
                x.x.VerCode,
                x.CreateDT,
                x.x.CreateUID,
                x.Status,
                x.VerStatus,
                x.x.UpdateDT,
                x.x.PublishDT,
                x.x.StatusTitle,
                x.x.VerStatusTitle,
                x.ParenCount,
                x.ChildCount,
                x.Updater,
                x.Publisher
            }));
        }
Exemplo n.º 2
0
        public OpResult SetState(string id, short state)
        {
            var ids  = id.Split(',').Select(o => int.Parse(o)).ToList();
            var list = ProductVerRepository.GetQuery(o => ids.Contains(o.Id)).ToList();

            list.ForEach(o => o.Status = state);
            ProductVerRepository.SaveChanges();
            return(OpResult.Success());
        }
Exemplo n.º 3
0
        public List <Entity.ProductVer> GetList(params short[] status)
        {
            var query = ProductVerRepository.GetQuery();

            if (status != null && status.Any())
            {
                query = query.Where(o => status.Contains(o.Status));
            }
            return(query.ToList());
        }
        public List <Entity.ProductVer> GetProductVers()
        {
            var queryProduct = ProductVerRepository.GetQuery();
            var queryModel   = ProductDataVerRepository.GetQuery();
            var query        = from x in queryProduct
                               where !queryModel.Any(o => o.ProductId == x.ProductId) &&
                               x.Status == 1
                               select x;

            return(query.ToList());
        }
Exemplo n.º 5
0
        public List <Entity.ProductVer> GetProductVerEnables()
        {
            var queryProduct = ProductVerRepository.GetQuery();
            var queryModel   = ProductPublishVerRepository.GetQuery();
            var query        = from x in queryProduct
                               where queryModel.Any(o => o.ProductId == x.ProductId && o.VerStatus == 2 && o.Status == 1) &&
                               x.Status == 1
                               select x;

            return(query.ToList());
        }
Exemplo n.º 6
0
        public OpResult Deletes(int[] ids)
        {
            var list = ProductVerRepository.GetQuery(o => ids.Contains(o.Id)).ToList();

            if (list.Any(o => o.Status > 0))
            {
                return(OpResult.Fail("该状态不允许删除!"));
            }
            ProductVerRepository.RemoveRange(list);
            return(OpResult.Success());
        }
Exemplo n.º 7
0
        public IEnumerable <dynamic> GetPageList(System.Collections.Specialized.NameValueCollection nvl, out int recordCount)
        {
            var query    = ProductVerRepository.GetQuery();
            var queryUse = ProductModuleVerRepository.GetQuery().Select(o => o.ProductId)
                           .Union(ProductDictionaryVerRepository.GetQuery().Select(o => o.ProductId))
                           .Union(ProductDataVerRepository.GetQuery().Select(o => o.ProductId))
                           .Union(ProductRoleVerRepository.GetQuery().Select(o => o.ProductId));
            var queryUser = UserRepository.GetQuery();
            var code      = nvl["code"].ToType <int?>();
            var state     = nvl["state"];
            var q         = from x in query
                            select new
            {
                x.Id,
                x.ProductId,
                x.Name,
                x.SysName,
                x.Alias,
                x.CreateDT,
                x.CreateUID,
                x.Status,
                HasUse      = queryUse.Any(o => o == x.ProductId) ? "√" : "--",
                StatusTitle = x.Status == 1 ? "已生效" : x.Status == 2 ? "已失效" : "未生效",
                x.Memo,
                Creater = queryUser.Where(o => o.UserId == x.CreateUID).Select(o => o.FullName).FirstOrDefault()
            };

            if (code.HasValue)
            {
                q = q.Where(o => o.ProductId == code);
            }
            if (!state.IsNullOrEmpty())
            {
                var st = state.Split(',').Select(o => short.Parse(o)).ToList();
                q = q.Where(o => st.Contains(o.Status));
            }
            recordCount = q.Count();
            return(q.ToPageList());
        }
Exemplo n.º 8
0
 public Entity.ProductVer Get(int id)
 {
     return(ProductVerRepository.GetQuery(o => o.Id == id).FirstOrDefault());
 }