Two dumbfixes

This commit is contained in:
Rick Falkvinge
2017-09-25 19:09:09 +02:00
parent 0e03d4daec
commit 77db2f1d14
2 changed files with 20 additions and 18 deletions
+1 -1
View File
@@ -40,7 +40,7 @@ namespace Swarmops.Frontend.Automation
return input.ToString("N2");
}
[WebMethod]
public static AjaxInputCallResult FormatCurrencyString(string input)
{
double outParse = 0.0;
+19 -17
View File
@@ -29,15 +29,17 @@
}
$(document).ready(function () {
var currencyText = $('#<%=this.ClientID%>_TextInput').val();
var jsonData = {};
jsonData.input = currencyText;
$('#<%=this.ClientID%>_TextInput').blur(function () {
if (currencyText.trim().indexOf(' ') >= 0) {
// the text contains at least one space, so try to interpret it and convert it to presentation currency
var currencyText = $('#<%=this.ClientID%>_TextInput').val();
var jsonData = {};
jsonData.input = currencyText;
if (currencyText.trim().indexOf(' ') >= 0) {
// the text contains at least one space, so try to interpret it and convert it to presentation currency
$('#<%=this.ClientID%>_TextInput').blur(function() {
SwarmopsJS.ajaxCall('/Automation/FinancialFunctions.aspx/InterpretCurrency',
jsonData,
function(data) {
@@ -45,19 +47,19 @@
alert("PresentationAmount:" + data.DisplayAmount + "\r\nUsed Currency:" + data.CurrencyCode + "\r\nEntered Amount:" + data.EnteredAmount);
}
});
});
} else {
// the text does NOT contain at least one space, so we should format it for presentation currency
$('#<%=this.ClientID%>_TextInput').blur(function() {
SwarmopsJS.ajaxCall('/Automation/Formatting.aspx/FormatCurrencyString',
jsonData,
function(data) {
if (data.Success) {
$('#<%=this.ClientID%>_TextInput').val(data.Result);
}
} else {
// the text does NOT contain at least one space, so we should format it for presentation currency
$('#<%=this.ClientID%>_TextInput').blur(function() {
SwarmopsJS.ajaxCall('/Automation/Formatting.aspx/FormatCurrencyString',
jsonData,
function(data) {
if (data.Success) {
$('#<%=this.ClientID%>_TextInput').val(data.Result);
}
});
});
}
});
}
});