/// <summary> /// 保存附件信息 /// </summary> /// <param name="delIDs">需要删除的附件ids</param> /// <param name="infos">附件信息</param> /// <returns>是否保存成功</returns> public virtual bool Save(string delIDs, params SYSAttach[] infos) { var result = false; delIDs = (delIDs ?? string.Empty).Trim(','); if (infos == null || !infos.Any()) goto End; using (var dbContext = BoundedContext.Create()) { var bo = dbContext.Resolve<STDAttachBO>();//dbContext.Repository<STDAttachInfo>(); result = true; var arr = ALConvert.ToList<long>(delIDs); if (arr.Any()) result = bo.Remove(item => arr.Contains(item.ID.Value)); if (result) { foreach (var info in infos) { if (info == null || !(info.ID > 0 ? bo.Modify(info) : bo.Add(info))) { result = false; break; } SaveFile(dbContext, info); } } if (result) dbContext.Commit(); } End: return result; }
public virtual bool Remove(string ids) { ids = (ids ?? string.Empty).Trim(); var arr = ALConvert.ToList<long>(ids); if (arr.Count==0) return false; return base.Remove(item => arr.Contains(item.ID.Value)); }
/// <summary> /// /// </summary> /// <param name="ids"></param> /// <returns></returns> public virtual List<SYSAttach> GetInfos(string ids) { ids = (ids ?? string.Empty).Trim(','); var arr = ALConvert.ToList<long>(ids); if (arr.Count==0) return null; return this.GetAll(item => arr.Contains(item.ID.Value)).ToList(); }
/// <summary> /// 解析被授权的标签 /// </summary> /// <param name="dto"></param> /// <returns></returns> private SYSTagNodeDTO[] getNodes(SYSTagConferAuthorityDTO dto) { ITag tag = TagService.GetInstance(); tag.DependOn(this.Context); List <SYSTagNodeDTO> dtos = new List <SYSTagNodeDTO>(); if (dto.TagNode.NodeType == EnumSYSTagNodeType.Tag) { //新增标签项权限 if ((dto.AuthorityRange | EnumSYSTagRange.Parents) == dto.AuthorityRange) { var tagInfo = tag.GetTag(dto.TagNode.ID.Value); var tagclassInfo = tag.GetTagClass(tagInfo.TagClassID.Value); var taggroupInfo = tag.GetTagGroup(tagclassInfo.AppID.Value); dtos.Add(SYSTagNodeDTO.Parse(taggroupInfo)); dtos.Add(SYSTagNodeDTO.Parse(tagclassInfo)); //返回当前标签项的父级节点 ALConvert.ToList <int>(tagInfo.Path) .FindAll(d => d != 0 && d != tagInfo.ID) .ForEach(d => dtos.Add(SYSTagNodeDTO.Parse(tag.GetTag(d)))); } if ((dto.AuthorityRange | EnumSYSTagRange.Current) == dto.AuthorityRange) { dtos.Add(SYSTagNodeDTO.Parse(tag.GetTag(dto.TagNode.ID.Value))); } if ((dto.AuthorityRange | EnumSYSTagRange.Children) == dto.AuthorityRange) { tag.GetTagsByParentID(dto.TagNode.ID.Value) .ForEach(d => dtos.Add(SYSTagNodeDTO.Parse(d))); } } else if (dto.TagNode.NodeType == EnumSYSTagNodeType.TagClass) { //新增标签权限 if ((dto.AuthorityRange | EnumSYSTagRange.Parents) == dto.AuthorityRange) { dtos.Add(SYSTagNodeDTO.Parse(tag.GetTagGroup(dto.TagNode.ParentID.Value))); } if ((dto.AuthorityRange | EnumSYSTagRange.Current) == dto.AuthorityRange) { dtos.Add(SYSTagNodeDTO.Parse(tag.GetTagClass(dto.TagNode.ID.Value))); } if ((dto.AuthorityRange | EnumSYSTagRange.Children) == dto.AuthorityRange) { tag.GetTagsByClassID(dto.TagNode.ID.Value) .ForEach(d => dtos.Add(SYSTagNodeDTO.Parse(d))); } } else if (dto.TagNode.NodeType == EnumSYSTagNodeType.TagGroup) { //新增标签组权限 if ((dto.AuthorityRange | EnumSYSTagRange.Current) == dto.AuthorityRange) { dtos.Add(SYSTagNodeDTO.Parse(tag.GetTagGroup(dto.TagNode.ID.Value))); } if ((dto.AuthorityRange | EnumSYSTagRange.Children) == dto.AuthorityRange) { tag.GetTagClassesByGroupCode(dto.TagNode.Code, (int?)dto.TagDisplayLevel) .ForEach(d => dtos.Add(SYSTagNodeDTO.Parse(d))); tag.GetTagsByGroupCode(dto.TagNode.Code, (int?)dto.TagDisplayLevel) .ForEach(d => dtos.Add(SYSTagNodeDTO.Parse(d))); } } return(dtos.ToArray()); }
public IDSpec(string ids) : base("ID", ALConvert.ToList <long>(ids)) { }