Пример #1
0
        public object GetCategoryList([FromBody] ProductRequest requestParams)
        {
            var seconds  = ProductCategoryService.FindList(o => o.CompanyId == requestParams.CID && o.CategoryPSN == requestParams.FirstSN && o.State == 1);
            var secondsn = seconds.Select(o => o.CategorySN).ToList();
            var threes   = ProductCategoryService.FindList(o => o.CompanyId == requestParams.CID && secondsn.Contains(o.CategoryPSN) && o.State == 1);
            var list     = seconds.Union(threes);

            return(list.Select(o => new { o.CategorySN, o.CategoryPSN, o.Title }));
        }
        public ActionResult Delete(int[] ids)
        {
            var list = ProductCategoryService.FindList(o => ids.Contains(o.Id));
            var re   = ProductCategoryService.Delete(list);

            #region 操作日志
            foreach (var item in list)
            {
                var msg = LogEngine.CompareModelToLog <ProductCategory>(LogModule.种类管理, null, item);
                new LogEngine().WriteDelete(msg, LogModule.种类管理);
            }
            #endregion
            return(new JsonNetResult(re));
        }
Пример #3
0
        public ActionResult SetState(string ids, short state)
        {
            var sid  = ids.Split(',').Select(o => Int64.Parse(o));
            var list = ProductCategoryService.FindList(o => sid.Contains(o.Id));

            list.ForEach(o => { o.State = state; });
            var re = ProductCategoryService.Update(list);

            if (re.Successed)
            {
                var stores = string.Join(",", WarehouseService.GetList().Select(o => o.StoreId));
                // Pharos.Infrastructure.Data.Redis.RedisManager.Publish("SyncDatabase", new Pharos.ObjectModels.DTOs.DatabaseChanged() { CompanyId = CommonService.CompanyId, StoreId = stores, Target = "ProductCategory" });
            }
            return(new JsonNetResult(re));
        }
Пример #4
0
        public object GetFirstCategory([FromBody] BaseApiParams requestParams)
        {
            var list = ProductCategoryService.FindList(o => o.CompanyId == requestParams.CID && o.State == 1 && o.CategoryPSN == 0);

            return(list.OrderBy(o => o.OrderNum).Select(o => new { o.CategorySN, o.Title }));
        }