private static string FormatNumber(Money value, NumberFormatInfo format) { if (value != null) { return(NumberEx.Format(value.Value, format)); } else { return(String.Empty); } }
// Formatter to format number public static string Formatter(int row, int cell, object value, Column columnDef, object dataContext) { if (value != null) { Number numeric = (Number)value; return(NumberEx.Format(numeric, (NumberFormatInfo)columnDef.Options)); } else { return(""); } }
public override void LoadValue(Dictionary <string, object> item) { defaultValue = NumberEx.Format((Number)item[_args.Column.Field], numberFormatInfo); if (defaultValue == null) { defaultValue = ""; } input.Value(defaultValue); input[0].SetAttribute("defaultValue", defaultValue); input.Select(); }
// Formatter to format number public static string Formatter(int row, int cell, object value, Column columnDef, object dataContext) { if (value != null) { string currencySymbol = getCurrencySymbol((EntityReference)((EntityBuiltInAttributes)dataContext).TransactionCurrencyId); Money numeric = (Money)value; return(currencySymbol + " " + NumberEx.Format(numeric.Value, (NumberFormatInfo)columnDef.Options)); } else { return(""); } }
public override void LoadValue(Dictionary <string, object> item) { // Get currency symbol string currencySymbolString = getCurrencySymbol((EntityReference)((EntityBuiltInAttributes)((object)item)).TransactionCurrencyId); currencySymbol.Text(currencySymbolString + " "); Money value = (Money)item[_args.Column.Field]; defaultValue = ""; if (value != null) { defaultValue = NumberEx.Format(value.Value, numberFormatInfo); } input.Value(defaultValue); input[0].SetAttribute("defaultValue", defaultValue); input.Select(); }
public override void Update(System.Html.Element element, Func <object> valueAccessor, Func <System.Collections.Dictionary> allBindingsAccessor, object viewModel, object context) { jQueryObject textBox = jQuery.FromElement(element).Find(".sparkle-input-textbox-part"); NumberFormatInfo format = GetNumberFormatInfo(allBindingsAccessor); Func <object> interceptAccesor = delegate() { Money value = ((Observable <Money>)valueAccessor()).GetValue(); if (value != null) { return(NumberEx.Format(value.Value, format)); } else { return(String.Empty); } }; // Use the standard value binding from ko Script.Literal("ko.bindingHandlers.value.update({0},{1},{2},{3},{4})", textBox.GetElement(0), interceptAccesor, allBindingsAccessor, viewModel, context); }