-
Notifications
You must be signed in to change notification settings - Fork 11
/
Rating.cs
62 lines (57 loc) · 2.76 KB
/
Rating.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
// <copyright file="Rating.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 Engage.Dnn.Publish.Data;
public class Rating : UserFeedback.Rating
{
/// <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)
{
}
/// <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);
}
}
}