123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- using System;
- using System.Web;
- using System.Configuration;
- using System.Collections.Generic;
- using System.Reflection;
- using System.ComponentModel;
- namespace CB.Common
- {
- public class ToolUtility
- {
- /// <summary>
- /// 自动生成元素name前缀
- /// </summary>
- public static string FilterNamePrefix
- {
- get
- {
- return Utils.GetAppSeting("ElementName") + "_";
- }
- }
- /// <summary>
- /// 获取枚举的Description信息
- /// </summary>
- /// <param name="obj"></param>
- /// <returns></returns>
- public static string GetEnumDescription<T>(string enumValue)
- {
- T obj = TypeConverter.StringToEnum<T>(enumValue, "0");
- string objName = obj.ToString();
- Type t = obj.GetType();
- FieldInfo fi = t.GetField(objName);
- DescriptionAttribute[] arrDesc = (DescriptionAttribute[])fi.GetCustomAttributes(typeof(DescriptionAttribute), false);
- return arrDesc[0].Description;
- }
- public static string GetAdvertJsPath(params object[] args)
- {
- var pathFormat = System.Configuration.ConfigurationManager.AppSettings["advertremotingpath"];
- if (string.IsNullOrEmpty(pathFormat))
- pathFormat = "http://www.55125.cn/{0}/{1}.{2}";
- return string.Format(pathFormat, args);
- }
- }
- }
|