forked from ChrisHammond/EngagePublish
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRating.cs
More file actions
66 lines (59 loc) · 2.79 KB
/
Rating.cs
File metadata and controls
66 lines (59 loc) · 2.79 KB
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
//Engage: Publish - http://www.engagesoftware.com
//Copyright (c) 2004-2010
//by Engage Software ( http://www.engagesoftware.com )
//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 Data;
public class Rating : UserFeedback.Rating
{
#region .ctor
/// <summary>
/// Initializes a new instance of the <see cref="Rating"/> class.
/// </summary>
public Rating()
{
}
/// <summary>
/// Initializes a new instance of the <see cref="Rating"/> class.
/// </summary>
/// <param name="ratingUserId">The user id, or <c>null</c> if the user is unauthenticated.</param>
/// <param name="ratingItemVersionId">The item version id.</param>
/// <param name="ratingValue">The rating.</param>
public Rating(int? ratingUserId, int ratingItemVersionId, int ratingValue)
: base(ratingUserId, ratingItemVersionId, ratingValue)
{
}
#endregion
#region Static Data Methods
/// <summary>
/// Gets a user's rating for a specific item.
/// </summary>
/// <param name="itemId">The item id.</param>
/// <param name="userId">The user id.</param>
/// <param name="portalId">The portal id.</param>
/// <param name="itemTypeId">The item type id.</param>
/// <returns>The rating.</returns>
public static UserFeedback.Rating GetRating(int itemId, int userId, int portalId, int itemTypeId)
{
return GetRating(Item.GetItem(itemId, portalId, itemTypeId, true).ItemVersionId, userId, DataProvider.ModuleQualifier);
}
/// <summary>
/// Updates an existing rating.
/// </summary>
/// <param name="itemId">The id of the rated item.</param>
/// <param name="userId">The user id of the rater.</param>
/// <param name="rating">The rating.</param>
/// <param name="portalId">The portal id.</param>
/// <param name="itemTypeId">The item type id.</param>
public static void UpdateRating(int itemId, int userId, int rating, int portalId, int itemTypeId)
{
UpdateRating(Item.GetItem(itemId, portalId, itemTypeId, true).ItemVersionId, userId, rating, DataProvider.ModuleQualifier);
}
#endregion
}
}