fixed some issues here and there.

This commit is contained in:
kay.one 2013-05-10 22:59:42 -07:00
commit 85cd877b0c
12 changed files with 66 additions and 20 deletions

View file

@ -0,0 +1,40 @@
using System;
using System.Globalization;
using Marr.Data.Converters;
using Marr.Data.Mapping;
namespace NzbDrone.Core.Datastore.Converters
{
public class UtcDateTimeConverter : IConverter
{
public Type DbType
{
get
{
return typeof(DateTime);
}
}
public object FromDB(ColumnMap map, object dbValue)
{
if (dbValue != null && dbValue != DBNull.Value)
{
var dateTime = (DateTime)dbValue;
dateTime = new DateTime(dateTime.Ticks, DateTimeKind.Local);
return dateTime.ToUniversalTime();
}
return null;
}
public object ToDB(object clrValue)
{
if (clrValue != null)
{
return ((DateTime)clrValue).ToUniversalTime();
}
return DBNull.Value;
}
}
}