Exemple #1
0
        /// <summary>
        /// 查询用户管理员分页
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="pageInfo"></param>
        /// <returns></returns>
        public List <AdminEntity> GetList(AdminEntity entity, ref PageInfo pageInfo)
        {
            entity.IncludeAll();
            entity.OrderBy(a => a.ID, EOrderBy.DESC);
            entity.Where(a => a.IsDelete == (int)EIsDelete.NotDelete);
            SysRoleEntity roleEntity = new SysRoleEntity();

            roleEntity.Include("RoleName", "RoleName");
            entity.Left <SysRoleEntity>(roleEntity, new Params <string, string>()
            {
                Item1 = "RoleNum", Item2 = "RoleNum"
            });
            SysDepartEntity departEntity = new SysDepartEntity();

            departEntity.Include("DepartName", "DepartName");
            entity.Left <SysDepartEntity>(departEntity, new Params <string, string>()
            {
                Item1 = "DepartNum", Item2 = "DepartNum"
            });
            int rowCount = 0;
            List <AdminEntity> listResult = this.Admin.GetList(entity, pageInfo.PageSize, pageInfo.PageIndex, out rowCount);

            pageInfo.RowCount = rowCount;
            return(listResult);
        }
        /// <summary>
        /// 查询所有的仓库数据信息
        /// </summary>
        /// <returns></returns>
        public List <StorageEntity> GetList()
        {
            string Key = string.Format(CacheKey.JOOSHOW_STORAGE_CACHE, this.CompanyID);
            List <StorageEntity> listResult = CacheHelper.Get <List <StorageEntity> >(Key);

            if (!listResult.IsNullOrEmpty())
            {
                return(listResult);
            }
            StorageEntity entity = new StorageEntity();

            entity.IncludeAll();
            entity.OrderBy(a => a.ID, EOrderBy.DESC);

            entity.Where(a => a.IsDelete == (int)EIsDelete.NotDelete)
            .And(a => a.CompanyID == this.CompanyID);

            SysDepartEntity depart = new SysDepartEntity();

            depart.Include(item => new { DepartName = item.DepartName });
            entity.Left <SysDepartEntity>(depart, new Params <string, string>()
            {
                Item1 = "DepartNum", Item2 = "SnNum"
            });

            listResult = this.Storage.GetList(entity);
            if (!listResult.IsNullOrEmpty())
            {
                CacheHelper.Add(Key, listResult);
            }
            return(listResult);
        }
Exemple #3
0
        /// <summary>
        /// 修改部门信息
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public int Update(SysDepartEntity entity)
        {
            string key = string.Format(CacheKey.JOOSHOW_SYSDEPART_CACHE, this.CompanyID);

            entity.Include(a => new { a.DepartName });

            int line = 0;

            entity.Where(a => a.SnNum == entity.SnNum)
            .And(item => item.CompanyID == this.CompanyID);
            line = this.SysDepart.Update(entity);
            if (line > 0)
            {
                CacheHelper.Remove(key);
            }
            return(line);
        }