Beispiel #1
0
        /// <summary>
        /// �����Դ
        /// </summary>
        /// <param name="resourceInfo">��Դ</param>
        /// <param name="tags">��Դ�ı�ǩ���ؼ��֣�</param>
        public void Add(LabMS.Model.Resource resourceInfo, params string[] tags)
        {
            resourceInfo.id = base.Add(resourceInfo);

            LabMS.Model.ResourceTag resourceTagInfo = new LabMS.Model.ResourceTag();
            LabMS.Model.Tag tagInfo = new LabMS.Model.Tag();

            LabMS.DAL.ResourceTag resourceTag = new LabMS.DAL.ResourceTag();
            ExtendBLL.Tag tag = new Tag();

            resourceTagInfo.Resource = resourceInfo;

            // �����ؼ��ֵĶ�Ӧ
            foreach (string tagName in tags)
            {
                if (!string.IsNullOrEmpty(tagName))
                {
                    tagInfo = tag.InsertGet(tagName);
                    resourceTagInfo.Tag = tagInfo;

                    resourceTag.AddGet(resourceTagInfo);
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// ������Դ
        /// </summary>
        /// <param name="resourceInfo">��Դ</param>
        /// <param name="tags">��Դ�ı�ǩ���ؼ��֣�</param>
        public void Update(LabMS.Model.Resource resourceInfo, params string[] tags)
        {
            base.Update(resourceInfo);

            if (tags != null && tags.Length > 0)
            {
                LabMS.Model.ResourceTag resourceTagInfo = new LabMS.Model.ResourceTag();
                LabMS.Model.Tag tagInfo = new LabMS.Model.Tag();

                LabMS.DAL.ResourceTag resourceTag = new LabMS.DAL.ResourceTag();
                ExtendBLL.Tag tag = new Tag();

                resourceTagInfo.Resource = resourceInfo;

                resourceTag.Delete(resourceInfo.id, LabMS.DAL.ResourceTag.DeleteType.ByResourceID); // ɾ�����ж�Ӧ��ϵ

                // �����ؼ��ֵĶ�Ӧ
                foreach (string tagName in tags)
                {
                    if (!string.IsNullOrEmpty(tagName))
                    {
                        tagInfo = tag.InsertGet(tagName);
                        resourceTagInfo.Tag = tagInfo;

                        resourceTag.AddGet(resourceTagInfo);
                    }
                }
            }
        }