mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2026-02-27 16:50:33 +08:00
Update Utils.ToInt
This commit is contained in:
@@ -10,6 +10,10 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
int reval = 0;
|
int reval = 0;
|
||||||
if (thisValue == null) return 0;
|
if (thisValue == null) return 0;
|
||||||
|
if (thisValue is Enum)
|
||||||
|
{
|
||||||
|
return (int)thisValue;
|
||||||
|
}
|
||||||
if (thisValue != null && thisValue != DBNull.Value && int.TryParse(thisValue.ToString(), out reval))
|
if (thisValue != null && thisValue != DBNull.Value && int.TryParse(thisValue.ToString(), out reval))
|
||||||
{
|
{
|
||||||
return reval;
|
return reval;
|
||||||
@@ -20,6 +24,10 @@ namespace SqlSugar
|
|||||||
public static int ObjToInt(this object thisValue, int errorValue)
|
public static int ObjToInt(this object thisValue, int errorValue)
|
||||||
{
|
{
|
||||||
int reval = 0;
|
int reval = 0;
|
||||||
|
if (thisValue is Enum)
|
||||||
|
{
|
||||||
|
return (int)thisValue;
|
||||||
|
}
|
||||||
if (thisValue != null && thisValue != DBNull.Value && int.TryParse(thisValue.ToString(), out reval))
|
if (thisValue != null && thisValue != DBNull.Value && int.TryParse(thisValue.ToString(), out reval))
|
||||||
{
|
{
|
||||||
return reval;
|
return reval;
|
||||||
|
|||||||
Reference in New Issue
Block a user