| | |
| | | return all.Where(x => x.ObjectType == ObjectType).OrderBy(x => x.ParentIds.Count).ThenBy(x => x.SortCode).ToList(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 通过 ID 获取子项及自身 |
| | | /// </summary> |
| | | public List<Model.Catalog> GetChildAndSelfByID(long CorpID, long ID) |
| | | { |
| | | var all = GetByCorpID(CorpID); |
| | | return all.Where(x => x.ID == ID || x.ParentIds.Contains(ID)).OrderBy(x => x.ParentIds.Count).ThenBy(x => x.SortCode).ToList(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 通过 ID 获取子项 |
| | | /// </summary> |
| | | public List<Model.Catalog> GetChildrenByID(long CorpID, long ID) |
| | | { |
| | | var all = GetByCorpID(CorpID); |
| | | return all.Where(x => x.ParentIds.Contains(ID)).OrderBy(x => x.ParentIds.Count).ThenBy(x => x.SortCode).ToList(); |
| | | } |
| | | |
| | | |
| | | #endregion |
| | | |
| | |
| | | return all.Exists(x => x.ID == ID); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 判断 Identifier 是否存在 |
| | | /// </summary> |
| | | public bool IsExistIdentifier(long CorpID, string Identifier) |
| | | { |
| | | if (string.IsNullOrEmpty(Identifier)) |
| | | return false; |
| | | var all = GetByCorpID(CorpID); |
| | | return all.Exists(x=>x.Identifier==Identifier); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 判断 Identifier 排除ID是否存在 |
| | | /// </summary> |
| | | public bool IsExistIdentifierExceptID(long CorpID, string Identifier, long ID) |
| | | { |
| | | if (string.IsNullOrEmpty(Identifier)) |
| | | return false; |
| | | var all = GetByCorpID(CorpID); |
| | | return all.Exists(x => x.Identifier == Identifier&&x.ID!=ID); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Delete |