コード例 #1
0
ファイル: DepartProvider.cs プロジェクト: ZhangHanLong/gitwms
 /// <summary>
 /// 根据主键编号和父类编号获得部门信息
 /// </summary>
 /// <param name="id"></param>
 /// <param name="parentID"></param>
 /// <returns></returns>
 public SysDepartEntity GetDepartEntity(int id, string ParentNum)
 {
     SysDepartEntity entity = new SysDepartEntity() { ID = id, ParentNum = ParentNum };
     entity.IncludeID(true)
         .IncludeDepartNum(true)
         .IncludeDepartName(true)
         .IncludeParentNum(true)
         .IncludeChildCount(true)
         .IncludeCreateTime(true)
         .Where<SysDepartEntity>("ID", ECondition.Eth)
         .And<SysDepartEntity>("ParentNum", ECondition.Eth);
     List<SysDepartEntity> list = this.SysDepart.GetList(entity);
     return list.IsNullOrEmpty() ? null : list[0];
 }
コード例 #2
0
ファイル: DepartProvider.cs プロジェクト: ZhangHanLong/gitwms
 /// <summary>
 /// 获得所有的部门信息
 /// </summary>
 /// <returns></returns>
 public List<SysDepartEntity> GetList()
 {
     List<SysDepartEntity> listResult = CacheHelper.Get(CacheKey.JOOSHOW_SYSDEPART_CACHE) as List<SysDepartEntity>;
     if (!listResult.IsNullOrEmpty())
     {
         return listResult;
     }
     SysDepartEntity temp = new SysDepartEntity();
     temp.IncludeID(true)
         .IncludeChildCount(true)
         .IncludeCreateTime(true)
         .IncludeDepartName(true)
         .IncludeDepartNum(true)
         .IncludeDepth(true)
         .IncludeParentNum(true)
         ;
     temp.Where(a => a.IsDelete == (int)EIsDelete.NotDelete);
     listResult = this.SysDepart.GetList(temp);
     if (!listResult.IsNullOrEmpty())
     {
         foreach (SysDepartEntity entity in listResult.Where(itemParent => !string.IsNullOrEmpty(itemParent.ParentNum)))
         {
             SysDepartEntity tempEntity = listResult.SingleOrDefault(item => item.DepartNum == entity.ParentNum);
             if (!tempEntity.IsNull())
             {
                 entity.ParentName = tempEntity.DepartName;
             }
         }
         CacheHelper.Insert(CacheKey.JOOSHOW_SYSDEPART_CACHE, listResult, null, DateTime.Now.AddHours(5));
     }
     return listResult;
 }
コード例 #3
0
ファイル: DepartProvider.cs プロジェクト: ZhangHanLong/gitwms
 /// <summary>
 /// 根据部门编号获得部门信息
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public SysDepartEntity GetDepartEntity(string DepartNum)
 {
     SysDepartEntity entity = new SysDepartEntity() { DepartNum = DepartNum };
     entity.IncludeID(true)
         .IncludeDepartNum(true)
         .IncludeDepartName(true)
         .IncludeParentNum(true)
         .Where<SysDepartEntity>("DepartNum", ECondition.Eth);
     return this.SysDepart.GetSingle(entity);
 }