예제 #1
0
        public static String DisplayCategoryColor(this HtmlHelper htmlHelper, EnumTxnType category)
        {
            var className = "";

            if (category == EnumTxnType.Revenue)
            {
                className = "text-success";
            }
            else if (category == EnumTxnType.Expense)
            {
                className = "text-danger";
            }

            return(className);
        }
예제 #2
0
파일: Tools.cs 프로젝트: lynnlee19/finance
        public static string GetEnumDescription(this EnumTxnType source)
        {
            FieldInfo fi = source.GetType().GetField(source.ToString());

            DescriptionAttribute[] attributes = (DescriptionAttribute[])fi.GetCustomAttributes(
                typeof(DescriptionAttribute), false);
            if (attributes.Length > 0)
            {
                return(attributes[0].Description);
            }
            else
            {
                return(source.ToString());
            }
        }