using System;
using System.Web;
using System.Configuration;
using System.Collections.Generic;
using System.Reflection;
using System.ComponentModel;
namespace CB.Common
{
public class ToolUtility
{
///
/// 自动生成元素name前缀
///
public static string FilterNamePrefix
{
get
{
return Utils.GetAppSeting("ElementName") + "_";
}
}
///
/// 获取枚举的Description信息
///
///
///
public static string GetEnumDescription(string enumValue)
{
T obj = TypeConverter.StringToEnum(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);
}
}
}