-
Notifications
You must be signed in to change notification settings - Fork 11
/
ItemTag.cs
115 lines (98 loc) · 3.95 KB
/
ItemTag.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
// <copyright file="ItemTag.cs" company="Engage Software">
// Engage: Publish
// Copyright (c) 2004-2013
// by Engage Software ( http://www.engagesoftware.com )
// </copyright>
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
// TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
// CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
namespace Engage.Dnn.Publish
{
using System;
using System.Collections;
using System.Data;
using System.Diagnostics;
using System.Globalization;
using DotNetNuke.Common.Utilities;
using Engage.Dnn.Publish.Data;
using Engage.Dnn.Publish.Util;
/// <summary>
/// Summary description for ItemRelationship.
/// </summary>
public class ItemTag
{
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
private int _itemVersionId = -1;
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
private int _tagId = -1;
public int ItemVersionId
{
[DebuggerStepThrough]
get { return this._itemVersionId; }
[DebuggerStepThrough]
set { this._itemVersionId = value; }
}
public int TagId
{
[DebuggerStepThrough]
get { return this._tagId; }
[DebuggerStepThrough]
set { this._tagId = value; }
}
public static void AddItemTag(int itemVersionId, int tagId)
{
DataProvider.Instance().AddItemTag(itemVersionId, tagId);
}
public static void AddItemTag(IDbTransaction trans, int itemVersionId, int tagId)
{
DataProvider.Instance().AddItemTag(trans, itemVersionId, tagId);
}
public static bool CheckItemTag(IDbTransaction trans, int itemId, int tagId)
{
return DataProvider.Instance().CheckItemTag(trans, itemId, tagId) > 0;
}
public static bool CheckItemTag(int itemId, int tagId)
{
return DataProvider.Instance().CheckItemTag(itemId, tagId) > 0;
}
public static ItemTag Create()
{
return new ItemTag();
}
public static ArrayList GetItemTags(int itemVersionId)
{
return CBO.FillCollection(DataProvider.Instance().GetItemTags(itemVersionId), typeof(ItemTag));
}
public static ArrayList GetItemTags(int itemVersionId, int portalId)
{
string cacheKey = Utility.CacheKeyPublishArticleTags + itemVersionId.ToString(CultureInfo.InvariantCulture) + "_" +
portalId.ToString(CultureInfo.InvariantCulture);
ArrayList al;
if (ModuleBase.UseCachePortal(portalId))
{
var o = DataCache.GetCache(cacheKey);
if (o != null)
{
al = (ArrayList)o;
}
else
{
al = CBO.FillCollection(DataProvider.Instance().GetItemTags(itemVersionId), typeof(ItemTag));
}
if (al != null)
{
DataCache.SetCache(cacheKey, al, DateTime.Now.AddMinutes(ModuleBase.CacheTimePortal(portalId)));
Utility.AddCacheKey(cacheKey, portalId);
}
}
else
{
al = CBO.FillCollection(DataProvider.Instance().GetItemTags(itemVersionId), typeof(ItemTag));
}
return al;
// return CBO.FillCollection(DataProvider.Instance().GetItemTags(_itemVersionId), typeof(ItemTag));
}
}
}