/// <summary> /// 返回指定实体已贴入的标签项 /// </summary> /// <typeparam name="T">实体类型</typeparam> /// <param name="entity">贴入标签的实体,必须指定ID</param> /// <returns>已贴入实体的标签项</returns> public List <SYSTag> GetTagApplyInfos <T>(T entity) where T : Entity, new() { long targetID = this.tagTargetBO[entity.Property.TableAttribute.TableName].ID.Value; long targetObjectID = ALConvert.ToLong0(entity.ID); return(this.FindBySpecification(tagApplyBO.GetTagsByTargetIDAndTargetObjectID(targetID, targetObjectID, null, null, null) .ToList <SYSTag>())); }
/// <summary> /// 返回指定实体已贴入的标签项 /// </summary> /// <typeparam name="T">实体类型</typeparam> /// <param name="entity">贴入标签的实体,需要指定ID属性</param> /// <param name="tagGroupInfo">查询条件,需要指定ID或GroupCode或GroupName属性</param> /// <param name="displayLevel">标签类型</param> /// <returns>已贴入实体的标签项</returns> public List <SYSTag> GetTagApplyInfos <T>(T entity, SYSTagGroup tagGroupInfo, int?displayLevel) where T : Entity, new() { long targetID = this.tagTargetBO[entity.Property.TableAttribute.TableName].ID.Value; long targetObjectID = ALConvert.ToLong0(entity.Property.GetValue(entity.Property.TableAttribute.PrimaryKey)); long?tagGroupID = tagGroupBO.GetIDByTagGroup(tagGroupInfo); return(this.FindBySpecification(tagApplyBO.GetTagsByTargetIDAndTargetObjectID(targetID, targetObjectID, null, tagGroupID, displayLevel) .ToList <SYSTag>())); }
/// <summary> /// 删除已贴入实体的标签 /// </summary> /// <typeparam name="T">实体类型</typeparam> /// <param name="entity">要取消贴入标签的实体,需要指定ID属性</param> /// <param name="tagGroupInfo">查询条件,需要指定ID或GroupCode或GroupName属性</param> /// <returns></returns> public ITag UnApply <T>(T entity, SYSTagGroup tagGroupInfo) where T : Entity, new() { long?tagGroupID = tagGroupBO.GetIDByTagGroup(tagGroupInfo); tagApplyBO.DeleteByCompanyIDAndTagGroupID( tagTargetBO[entity.Property.TableAttribute.TableName].ID.Value, ALConvert.ToLong0(entity.Property.GetValue("ID")), tagGroupID.Value); return(this); }
/// <summary> /// 删除已贴入实体的标签 /// </summary> /// <typeparam name="T">实体类型</typeparam> /// <param name="entity">要取消贴入标签的实体,需要指定ID属性</param> /// <param name="tagClassIDs">标签ID</param> /// <returns></returns> public ITag UnApply <T>(T entity, IEnumerable <long> tagClassIDs) where T : Entity, new() { foreach (long tagClassID in tagClassIDs) { tagApplyBO.DeleteByCompanyIDAndTagClassID( tagTargetBO[entity.Property.TableAttribute.TableName].ID.Value, ALConvert.ToLong0(entity.Property.GetValue("ID")), tagClassID); } return(this); }
/// <summary> /// 返回指定实体已贴入的标签组日志 /// </summary> /// <typeparam name="T">实体类型</typeparam> /// <param name="tagClassInfo">查询条件,需要指定ID或ClassCode或ClassName属性</param> /// <param name="entity">贴入标签的实体,需要指定ID属性</param> /// <returns></returns> public List <SYSTagLogs> GetTagLogs <T>(SYSTagClass tagClassInfo, T entity) where T : Entity, new() { //int targetID = this.tagTargetBO[entity.TableAttribute.TableName].ID.Value; long targetObjectID = ALConvert.ToLong0(entity.Property.GetValue(entity.Property.TableAttribute.PrimaryKey)); long?tagClassID = tagClassBO.GetIDByTagClass(tagClassInfo); return(this.FindBySpecification(tagLogsBO.GetAll(new SYSTagLogs { TagClassID = tagClassID.Value, //标签日志暂时不区分数据表 TargetObject = targetID.ToString(), TargetObjectID = targetObjectID }.AsSpec()).ToList())); }
/// <summary> /// 返回指定实体已贴入的标签项编号 /// </summary> /// <typeparam name="T">实体类型</typeparam> /// <param name="entity">贴入标签的实体,必须指定ID</param> /// <returns>已贴入实体的标签项编号</returns> public List <long> GetTagApplies <T>(T entity) where T : Entity, new() { long targetID = this.tagTargetBO[entity.Property.TableAttribute.TableName].ID.Value; long targetObjectID = ALConvert.ToLong0(entity.Property.GetValue(entity.Property.TableAttribute.PrimaryKey)); if (this.specification == null) { return(tagApplyBO.GetTagIDValuesByTargetIDAndTargetObjectID(targetID, targetObjectID)); } else { return(this.FindBySpecification(tagApplyBO.GetTagsByTargetIDAndTargetObjectID(targetID, targetObjectID, null, null, null) .ToList <SYSTag>()).Select(d => d.ID.Value).ToList()); } }
/// <summary> /// 删除已贴入实体的全部标签项 /// </summary> /// <typeparam name="T">实体类型</typeparam> /// <param name="entity">要取消贴入标签的实体,需要指定ID属性</param> public ITag UnApply <T>(T entity) where T : Entity, new() { tagApplyBO.DeleteByCompanyID(tagTargetBO[entity.Property.TableAttribute.TableName].ID.Value, ALConvert.ToLong0(entity.Property.GetValue("ID"))); return(this); }