Esempio n. 1
0
        /// <summary>
        /// 返回指定实体已贴入的标签项
        /// </summary>
        /// <typeparam name="T">实体类型</typeparam>
        /// <param name="entity">贴入标签的实体,需指定ID属性</param>
        /// <param name="tagClassInfo">查询条件,需要指定ID或ClassCode或ClassName属性</param>
        /// <returns>已贴入实体的标签项</returns>
        public List <SYSTag> GetTagApplyInfos <T>(T entity, SYSTagClass tagClassInfo) 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?tagClassID     = tagClassBO.GetIDByTagClass(tagClassInfo);

            return(this.FindBySpecification(tagApplyBO.GetTagsByTargetIDAndTargetObjectID(targetID, targetObjectID, tagClassID, null, null)
                                            .ToList <SYSTag>()));
        }
Esempio n. 2
0
        /// <summary>
        /// 删除已贴入实体的标签
        /// </summary>
        /// <typeparam name="T">实体类型</typeparam>
        /// <param name="entity">要取消贴入标签的实体,需要指定ID属性</param>
        /// <param name="tagClassInfo">查询条件,需要指定ID或ClassCode或ClassName属性</param>
        /// <returns></returns>
        public ITag UnApply <T>(T entity, SYSTagClass tagClassInfo) where T : Entity, new()
        {
            long?tagClassID = tagClassBO.GetIDByTagClass(tagClassInfo);

            tagApplyBO.DeleteByCompanyIDAndTagClassID(
                tagTargetBO[entity.Property.TableAttribute.TableName].ID.Value,
                ALConvert.ToLong0(entity.Property.GetValue("ID")),
                tagClassID.Value);
            return(this);
        }
Esempio n. 3
0
        /// <summary>
        /// 删除指定的标签,标签选项,标签日志,标签Apply数据
        /// </summary>
        /// <param name="tagClassInfo">查询条件,需要指定ID或ClassCode或ClassName属性</param>
        /// <returns></returns>
        public void Delete(SYSTagClass tagClassInfo)
        {
            long?tagClassID = tagClassBO.GetIDByTagClass(tagClassInfo);

            //删除标签选项
            tagBO.GetTagByTagClassID(tagClassInfo.ID.ToString())
            .ToList <SYSTag>().ForEach(d => this.Delete(d));
            //删除标签
            tagClassBO.Remove(tagClassID.Value);
            tagBO.DeleteTagByTagClass(tagClassID.ToString());
        }
Esempio n. 4
0
        /// <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()));
        }
 public static SYSTagNodeDTO Parse(SYSTagClass tagInfo)
 {
     return(new SYSTagNodeDTO
     {
         ID = tagInfo.ID,
         NodeType = EnumSYSTagNodeType.TagClass,
         ParentID = tagInfo.AppID,
         ParentNodeType = EnumSYSTagNodeType.TagGroup,
         Name = tagInfo.ClassName,
         Code = tagInfo.ClassCode,
         Value = tagInfo.ClassValue,
         IsBuiltIn = tagInfo.IsBuiltIn,
         DisplayLevel = tagInfo.DisplayLevel,
         Sequence = tagInfo.Sequence,
         Remark = tagInfo.Remark,
         DataSource = tagInfo
     });
 }
Esempio n. 6
0
 /// <summary>
 /// 返回指定的标签
 /// </summary>
 /// <param name="tagClassInfo"></param>
 /// <returns></returns>
 public SYSTagClass GetTagClass(SYSTagClass tagClassInfo)
 {
     return(this.FindBySpecification(tagClassBO.Get(tagClassBO.GetIDByTagClass(tagClassInfo) ?? 0)));
 }
Esempio n. 7
0
 /// <summary>
 /// 保存指定的标签
 /// </summary>
 /// <param name="tagClassInfo"></param>
 public void Save(SYSTagClass tagClassInfo)
 {
     tagClassBO.Save(tagClassInfo);
 }