Update Enum

This commit is contained in:
sunkaixuan 2017-07-15 19:51:13 +08:00
parent 8ee2cf6e81
commit 03a7ef5814
4 changed files with 31 additions and 14 deletions

View File

@ -165,6 +165,10 @@ namespace SqlSugar
} }
return "'" + date.ToString("yyyy-MM-dd HH:mm:ss.fff") + "'"; return "'" + date.ToString("yyyy-MM-dd HH:mm:ss.fff") + "'";
} }
else if (type.GetTypeInfo().IsEnum())
{
return Convert.ToInt64(value);
}
else if (type == PubConst.BoolType) else if (type == PubConst.BoolType)
{ {
return value.ObjToBool() ? "1" : "0"; return value.ObjToBool() ? "1" : "0";

View File

@ -253,11 +253,16 @@ namespace SqlSugar
if (type == PubConst.DateType) if (type == PubConst.DateType)
{ {
var date = value.ObjToDate(); var date = value.ObjToDate();
if (date < Convert.ToDateTime("1900-1-1")) { if (date < Convert.ToDateTime("1900-1-1"))
{
date = Convert.ToDateTime("1900-1-1"); date = Convert.ToDateTime("1900-1-1");
} }
return "'" + date.ToString("yyyy-MM-dd HH:mm:ss.fff") + "'"; return "'" + date.ToString("yyyy-MM-dd HH:mm:ss.fff") + "'";
} }
else if (type.GetTypeInfo().IsEnum())
{
return Convert.ToInt64(value);
}
else if (type == PubConst.BoolType) else if (type == PubConst.BoolType)
{ {
return value.ObjToBool() ? "1" : "0"; return value.ObjToBool() ? "1" : "0";

View File

@ -52,6 +52,10 @@ namespace SqlSugar
} }
return "'" + date.ToString("yyyy-MM-dd HH:mm:ss.fff") + "'"; return "'" + date.ToString("yyyy-MM-dd HH:mm:ss.fff") + "'";
} }
else if (type.GetTypeInfo().IsEnum())
{
return Convert.ToInt64(value);
}
else if (type == PubConst.BoolType) else if (type == PubConst.BoolType)
{ {
return value.ObjToBool() ? "1" : "0"; return value.ObjToBool() ? "1" : "0";

View File

@ -29,6 +29,10 @@ namespace SqlSugar
} }
return "'" + date.ToString("yyyy-MM-dd HH:mm:ss.fff") + "'"; return "'" + date.ToString("yyyy-MM-dd HH:mm:ss.fff") + "'";
} }
else if (type.GetTypeInfo().IsEnum())
{
return Convert.ToInt64(value);
}
else if (type == PubConst.BoolType) else if (type == PubConst.BoolType)
{ {
return value.ObjToBool() ? "1" : "0"; return value.ObjToBool() ? "1" : "0";