Added IntegerDataTypeModel and HtmlStringDataTypeModel to the core and removed the internal integer upcasting code. Model will automatically apply for 'Numeric' data type. use umbraco.MacroEngines.RazorDataTypeModels.IntegerDataTypeModel to apply a staticMapping in umbracoSettings for a given datatype or alias as per previous commit

This commit is contained in:
agrath
2012-01-09 12:58:15 -13:00
parent e6f0c2a17c
commit 7b157c5083
4 changed files with 54 additions and 12 deletions

View File

@@ -29,7 +29,7 @@ namespace umbraco.MacroEngines
private readonly Guid DATATYPE_TINYMCE_GUID = new Guid("5e9b75ae-face-41c8-b47e-5f4b0fd82f83");
private readonly Guid DATATYPE_DATETIMEPICKER_GUID = new Guid("b6fb1622-afa5-4bbf-a3cc-d9672a442222");
private readonly Guid DATATYPE_DATEPICKER_GUID = new Guid("23e93522-3200-44e2-9f29-e61a6fcbb79a");
private readonly Guid DATATYPE_INTEGER_GUID = new Guid("1413afcb-d19a-4173-8e9a-68288d2a73b8");
//private readonly Guid DATATYPE_INTEGER_GUID = new Guid("1413afcb-d19a-4173-8e9a-68288d2a73b8");
#endregion
internal readonly DynamicBackingItem n;
@@ -660,17 +660,17 @@ namespace umbraco.MacroEngines
}
}
//integer
//this will eat csv strings, so only do it if the decimal also includes a decimal seperator (according to the current culture)
if (dataType == DATATYPE_INTEGER_GUID)
{
int iResult = 0;
if (int.TryParse(sResult, System.Globalization.NumberStyles.Number, System.Globalization.CultureInfo.CurrentCulture, out iResult))
{
result = iResult;
return true;
}
}
////integer
////this will eat csv strings, so only do it if the decimal also includes a decimal seperator (according to the current culture)
//if (dataType == DATATYPE_INTEGER_GUID)
//{
// int iResult = 0;
// if (int.TryParse(sResult, System.Globalization.NumberStyles.Number, System.Globalization.CultureInfo.CurrentCulture, out iResult))
// {
// result = iResult;
// return true;
// }
//}
//this will eat csv strings, so only do it if the decimal also includes a decimal seperator (according to the current culture)
if (sResult.Contains(System.Globalization.CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator))