updated nuget

This commit is contained in:
Luke Pulverenti 2013-07-07 01:41:28 -04:00
parent e3690b2ddd
commit 16b58256c4
5 changed files with 17 additions and 25 deletions

View File

@ -4,7 +4,7 @@ namespace MediaBrowser.Model.Notifications
{ {
public class NotificationQuery public class NotificationQuery
{ {
public Guid? UserId { get; set; } public Guid UserId { get; set; }
public bool? IsRead { get; set; } public bool? IsRead { get; set; }

View File

@ -78,31 +78,23 @@ namespace MediaBrowser.Server.Implementations.Persistence
/// <returns>NotificationResult.</returns> /// <returns>NotificationResult.</returns>
public NotificationResult GetNotifications(NotificationQuery query) public NotificationResult GetNotifications(NotificationQuery query)
{ {
var whereClause = string.Empty;
var result = new NotificationResult(); var result = new NotificationResult();
using (var cmd = _connection.CreateCommand()) using (var cmd = _connection.CreateCommand())
{ {
if (query.IsRead.HasValue || query.UserId.HasValue) var clauses = new List<string>();
if (query.IsRead.HasValue)
{ {
var clauses = new List<string>(); clauses.Add("IsRead=@IsRead");
cmd.Parameters.Add(cmd, "@IsRead", DbType.Boolean).Value = query.IsRead.Value;
if (query.IsRead.HasValue)
{
clauses.Add("IsRead=@IsRead");
cmd.Parameters.Add(cmd, "@IsRead", DbType.Boolean).Value = query.IsRead.Value;
}
if (query.UserId.HasValue)
{
clauses.Add("UserId=@UserId");
cmd.Parameters.Add(cmd, "@UserId", DbType.Guid).Value = query.UserId.Value;
}
whereClause = " where " + string.Join(" And ", clauses.ToArray());
} }
clauses.Add("UserId=@UserId");
cmd.Parameters.Add(cmd, "@UserId", DbType.Guid).Value = query.UserId;
var whereClause = " where " + string.Join(" And ", clauses.ToArray());
cmd.CommandText = string.Format("select count(Id) from Notifications{0};select Id,UserId,Date,Name,Description,Url,Level,IsRead,Category,RelatedId from Notifications{0} order by IsRead asc, Date desc", whereClause); cmd.CommandText = string.Format("select count(Id) from Notifications{0};select Id,UserId,Date,Name,Description,Url,Level,IsRead,Category,RelatedId from Notifications{0} order by IsRead asc, Date desc", whereClause);
using (var reader = cmd.ExecuteReader(CommandBehavior.SequentialAccess)) using (var reader = cmd.ExecuteReader(CommandBehavior.SequentialAccess))
@ -155,7 +147,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
} }
result.UnreadCount = levels.Count; result.UnreadCount = levels.Count;
if (levels.Count > 0) if (levels.Count > 0)
{ {
result.MaxUnreadNotificationLevel = levels.Max(); result.MaxUnreadNotificationLevel = levels.Max();

View File

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd"> <package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata> <metadata>
<id>MediaBrowser.Common.Internal</id> <id>MediaBrowser.Common.Internal</id>
<version>3.0.139</version> <version>3.0.140</version>
<title>MediaBrowser.Common.Internal</title> <title>MediaBrowser.Common.Internal</title>
<authors>Luke</authors> <authors>Luke</authors>
<owners>ebr,Luke,scottisafool</owners> <owners>ebr,Luke,scottisafool</owners>
@ -12,7 +12,7 @@
<description>Contains common components shared by Media Browser Theater and Media Browser Server. Not intended for plugin developer consumption.</description> <description>Contains common components shared by Media Browser Theater and Media Browser Server. Not intended for plugin developer consumption.</description>
<copyright>Copyright © Media Browser 2013</copyright> <copyright>Copyright © Media Browser 2013</copyright>
<dependencies> <dependencies>
<dependency id="MediaBrowser.Common" version="3.0.139" /> <dependency id="MediaBrowser.Common" version="3.0.140" />
<dependency id="NLog" version="2.0.1.2" /> <dependency id="NLog" version="2.0.1.2" />
<dependency id="ServiceStack.Text" version="3.9.45" /> <dependency id="ServiceStack.Text" version="3.9.45" />
<dependency id="SimpleInjector" version="2.2.3" /> <dependency id="SimpleInjector" version="2.2.3" />

View File

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd"> <package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata> <metadata>
<id>MediaBrowser.Common</id> <id>MediaBrowser.Common</id>
<version>3.0.139</version> <version>3.0.140</version>
<title>MediaBrowser.Common</title> <title>MediaBrowser.Common</title>
<authors>Media Browser Team</authors> <authors>Media Browser Team</authors>
<owners>ebr,Luke,scottisafool</owners> <owners>ebr,Luke,scottisafool</owners>

View File

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"> <package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata> <metadata>
<id>MediaBrowser.Server.Core</id> <id>MediaBrowser.Server.Core</id>
<version>3.0.139</version> <version>3.0.140</version>
<title>Media Browser.Server.Core</title> <title>Media Browser.Server.Core</title>
<authors>Media Browser Team</authors> <authors>Media Browser Team</authors>
<owners>ebr,Luke,scottisafool</owners> <owners>ebr,Luke,scottisafool</owners>
@ -12,7 +12,7 @@
<description>Contains core components required to build plugins for Media Browser Server.</description> <description>Contains core components required to build plugins for Media Browser Server.</description>
<copyright>Copyright © Media Browser 2013</copyright> <copyright>Copyright © Media Browser 2013</copyright>
<dependencies> <dependencies>
<dependency id="MediaBrowser.Common" version="3.0.139" /> <dependency id="MediaBrowser.Common" version="3.0.140" />
</dependencies> </dependencies>
</metadata> </metadata>
<files> <files>