} // CategorizeTransaction private AmountInfo CurrencyXchg(YMoney coin, YDate date) { try { var oDate = (date != null && date.date.HasValue) ? date.date.Value : (DateTime?)null; return((coin != null && coin.amount.HasValue) ? this._CurrencyConvertor.ConvertToBaseCurrency(coin.currencyCode, coin.amount.Value, oDate) : null); } catch { return(null); } } // CurrencyXchg
/** * Format a number but adding commas * * @param number * @return number with commas */ /**public static String formatNumber(long number){ * NumberFormat nf = new DecimalFormat("#,###,###"); * return nf.format(number); * }*/ /** * Format a number but adding commas * * @param number * @return number with commas */ /**public static String formatNumber(Long number){ * return formatNumber(number.longValue()) ; * }*/ /** * Format a number but adding commas * * @param number * @return number with commas */ /**public static String formatNumber(Double number){ * return formatNumber(number.longValue()) ; * }*/ /** * Format a number but adding commas * * @param money * @return number with commas and currenct code */ public static String formatMoney(YMoney money) { if (money == null) { return("null"); } /**if(money.amount == null){ * return "null"; * }*/ String m = String.Format("{0:N2}", money.amount); //NumberFormat nf = new DecimalFormat("#,###,###.##"); if (money.currencyCode.Equals("USD")) { m = "$" + m; } else { m = m + " " + money.currencyCode; } return(m); }
//constructs ItemData for bank container private ItemData getBankItemData() { ItemData itemData = new ItemData(); ArrayList accounts = new ArrayList(); BankData bankData = new BankData(); System.Console.WriteLine("\nEnter account holder name"); String acctHolder = IOUtils.readStr(); bankData.accountHolder = acctHolder; System.Console.WriteLine("Enter accountNo."); String accNo = IOUtils.readStr(); bankData.accountNumber = accNo; System.Console.WriteLine("Enter balance"); long bal = IOUtils.readLong(); YMoney balance = new YMoney(); balance.amount = bal; balance.currencyCode = Currency.USD; bankData.availableBalance = balance; bankData.currentBalance = balance; bankData.accountName = "Custom Account"; bankData.customDescription = "Test"; bankData.includeInNetworth = 1; bankData.hasDetails = 1; bankData.isItemAccountDeleted = 0; bankData.isDeleted = 0; bankData.lastUpdated = 999000; bankData.isSeidMod = 0; bankData.acctType = AccountType.CHECKING; YMoney intYtd = new YMoney(); intYtd.amount = 12.5; intYtd.currencyCode = Currency.USD; bankData.interestEarnedYtd = intYtd; YMoney od = new YMoney(); od.amount = 25; od.currencyCode = Currency.USD; bankData.overdraftProtection = od; YDate mat = new YDate(); mat.date = DateTime.Now; bankData.maturityDate = mat; YDate asOf = new YDate(); asOf.date = DateTime.Now; bankData.asOfDate = asOf; bankData.shortNickName = ""; bankData.nickName = ""; accounts.Add(bankData); //itemData.accounts = accounts.ToArray(); return(itemData); }
private double?CurrencyXchg(YMoney coin, DateTime?oDate) { return(coin.amount.HasValue ? _currencyConvertor.ConvertToBaseCurrency(coin.currencyCode, coin.amount.Value, oDate).Value : (double?)null); }
private decimal ConvertToPounds(YMoney money) { throw new NotImplementedException(); }