Beispiel #1
0
 /// <summary>
 ///     Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         if (AccountName != null)
         {
             hashCode = hashCode * 59 + AccountName.GetHashCode();
         }
         if (AccountNumber != null)
         {
             hashCode = hashCode * 59 + AccountNumber.GetHashCode();
         }
         if (SortCode != null)
         {
             hashCode = hashCode * 59 + SortCode.GetHashCode();
         }
         if (Balance != null)
         {
             hashCode = hashCode * 59 + Balance.GetHashCode();
         }
         if (AvailableBalance != null)
         {
             hashCode = hashCode * 59 + AvailableBalance.GetHashCode();
         }
         if (Overdraft != null)
         {
             hashCode = hashCode * 59 + Overdraft.GetHashCode();
         }
         return(hashCode);
     }
 }
        /// <summary>
        /// Returns true if BankingLendingBalance instances are equal
        /// </summary>
        /// <param name="other">Instance of BankingLendingBalance to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(BankingLendingBalance other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     AccountBalance == other.AccountBalance ||
                     AccountBalance != null &&
                     AccountBalance.Equals(other.AccountBalance)
                     ) &&
                 (
                     AvailableBalance == other.AvailableBalance ||
                     AvailableBalance != null &&
                     AvailableBalance.Equals(other.AvailableBalance)
                 ) &&
                 (
                     CreditLimit == other.CreditLimit ||
                     CreditLimit != null &&
                     CreditLimit.Equals(other.CreditLimit)
                 ) &&
                 (
                     AmortisedLimit == other.AmortisedLimit ||
                     AmortisedLimit != null &&
                     AmortisedLimit.Equals(other.AmortisedLimit)
                 ));
        }
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (AccountBalance != null)
         {
             hashCode = hashCode * 59 + AccountBalance.GetHashCode();
         }
         if (AvailableBalance != null)
         {
             hashCode = hashCode * 59 + AvailableBalance.GetHashCode();
         }
         if (CreditLimit != null)
         {
             hashCode = hashCode * 59 + CreditLimit.GetHashCode();
         }
         if (AmortisedLimit != null)
         {
             hashCode = hashCode * 59 + AmortisedLimit.GetHashCode();
         }
         return(hashCode);
     }
 }
Beispiel #4
0
        /// <summary>
        ///     Returns true if AccountViewModel instances are equal
        /// </summary>
        /// <param name="input">Instance of AccountViewModel to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(AccountViewModel input)
        {
            if (input == null)
            {
                return(false);
            }

            return
                ((
                     AccountName == input.AccountName ||
                     AccountName != null &&
                     AccountName.Equals(input.AccountName)
                     ) &&
                 (
                     AccountNumber == input.AccountNumber ||
                     AccountNumber != null &&
                     AccountNumber.Equals(input.AccountNumber)
                 ) &&
                 (
                     SortCode == input.SortCode ||
                     SortCode != null &&
                     SortCode.Equals(input.SortCode)
                 ) &&
                 (
                     Balance == input.Balance ||
                     Balance != null &&
                     Balance.Equals(input.Balance)
                 ) &&
                 (
                     AvailableBalance == input.AvailableBalance ||
                     AvailableBalance != null &&
                     AvailableBalance.Equals(input.AvailableBalance)
                 ) &&
                 (
                     Overdraft == input.Overdraft ||
                     Overdraft != null &&
                     Overdraft.Equals(input.Overdraft)
                 ));
        }
Beispiel #5
0
        private void GenerateWalletBalances()
        {
            Balance            = Money.Zero;
            AvailableBalance   = Money.Zero;
            UnconfirmedBalance = Money.Zero;
            var confirmedTxs     = this.GetConfirmedTransactions();
            var unconfirmedTxs   = this.GetUnconfirmedTransactions();
            var spendableOutputs = _spendableOutputs.ToArray();


            UnconfirmedBalance = unconfirmedTxs.Select((x) => x.ReceivedCoins.Select((r) => r.Amount).Sum()).Sum();

            AvailableBalance = spendableOutputs.Select((x) => x.Amount).Sum();

            Balance = this.Txs.Select((x) => x.Balance).Sum();

            BalanceDisplay            = Balance.ToDecimal(MoneyUnit.BTC);
            AvailableBalanceDisplay   = AvailableBalance.ToDecimal(MoneyUnit.BTC);
            UnconfirmedBalanceDisplay = UnconfirmedBalance.ToDecimal(MoneyUnit.BTC);

            this.UpdateBalanceCurrDisplay();
        }