Esempio n. 1
0
        /// <summary>   A TransactionAmount extension method that output total. </summary>
        /// <param name="transactionObj">   The transactionObj to act on. </param>
        /// <returns>   A string. </returns>
        public static string OutputTotal(this TransactionAmount transactionObj)
        {
            var sb = new StringBuilder();

            if (transactionObj.PlatinumAmount > 0)
            {
                sb.Append(transactionObj.PlatinumAmount + "p");
            }

            if (transactionObj.GoldAmount > 0)
            {
                sb.Append(transactionObj.GoldAmount + "g");
            }

            if (transactionObj.SilverAmount > 0)
            {
                sb.Append(transactionObj.SilverAmount + "s");
            }

            if (transactionObj.CopperAmount > 0)
            {
                sb.Append(transactionObj.CopperAmount + "c");
            }

            return(sb.ToString());
        }
Esempio n. 2
0
 /// <summary>   Determines whether the specified object is equal to the current object. </summary>
 /// <param name="other">    The transaction amount to compare to this object. </param>
 /// <returns>
 ///     true if the specified object  is equal to the current object; otherwise, false.
 /// </returns>
 protected bool Equals(TransactionAmount other)
 {
     return(CopperTotal == other.CopperTotal && PlatinumAmount == other.PlatinumAmount && GoldAmount == other.GoldAmount && SilverAmount == other.SilverAmount && CopperAmount == other.CopperAmount);
 }