예제 #1
0
        /// <summary>
        /// Get a member's balances.
        /// </summary>
        /// <param name="member">member</param>
        /// <returns>dictionary currency: total</returns>
        public static IDictionary <string, double> MemberGetBalanceSample(Member member)
        {
            var sums = new Dictionary <string, double>();

            var accounts = member.GetAccounts().Result;

            foreach (var account in accounts)
            {
                var balance = member.GetBalanceBlocking(account.Id(), Standard).Current;
                if (sums.ContainsKey(balance.Currency))
                {
                    sums[balance.Currency] += Convert.ToDouble(balance.Value);
                }
                else
                {
                    sums[balance.Currency] = Convert.ToDouble(balance.Value);
                }
            }

            return(sums);
        }