Exemplo n.º 1
0
        /// <summary>
        /// Displays the decimal in kilograms ({0}kg).
        /// </summary>
        /// <param name="kilograms">The kilograms.</param>
        /// <param name="isHumanBody">if set to <c>true</c> [is human body].</param>
        /// <param name="precision">The precision.</param>
        /// <returns></returns>
        public static string AsKilograms(this decimal kilograms, bool isHumanBody, int precision)
        {
            if (isHumanBody)
            {
                if (kilograms < 1)
                {
                    return(string.Empty);
                }
            }

            return(string.Format("{0}kg", kilograms.AsNumber(precision: precision)));            //TODO: Dictionary
        }
Exemplo n.º 2
0
        /// <summary>
        /// Displays the decimal in centimeters ({0}cm).
        /// </summary>
        /// <param name="centimeters">The centimeters.</param>
        /// <param name="isHumanBody">if set to <c>true</c> [is human body].</param>
        /// <param name="precision">The precision.</param>
        /// <returns></returns>
        public static string AsCentimeters(this decimal centimeters, bool isHumanBody, int precision)
        {
            if (isHumanBody)
            {
                if (centimeters < 1)
                {
                    return(string.Empty);
                }
                if ((centimeters / 100) > 4)
                {
                    return(string.Empty);                                         // Taller than 4m is "not" possible
                }
            }

            return(string.Format("{0}cm", centimeters.AsNumber(precision: precision)));            //TODO: Dictionary
        }
Exemplo n.º 3
0
 /// <summary>
 /// Displays the decimal as a number with thread's ui culture.
 /// </summary>
 /// <param name="value">The integer.</param>
 /// <param name="precision">The precision.</param>
 /// <returns></returns>
 public static string AsNumber(this decimal value, int precision = 0)
 {
     return(value.AsNumber(precision, Thread.CurrentThread.CurrentUICulture));
 }