/// 
/// 批量删除指定类的对象
/// 2011-11-17 Aiice
/// 
///
需要删除数据对应的类名称 例如:ShippAddress
///
需要删除对象的ID对象组
/// 删除成功:ture 删除失败:false
private bool DeleteObject(string ClassName,object[] obj)
{
	bool result = false;
	string str = String.Empty;
	try
	{
		//需要反射类 对应的dll文件或exe文件
		string assFile = "D:/WebERP/BusinessData/bin/Debug/Smart.Component.BusinessData.dll";
		Assembly assembly =Assembly.GetExecutingAssembly();
		if(assFile!="")
		{
			assembly = Assembly.LoadFrom(assFile);
		}
		//把String的ClassName转换为对应Type
		Type t = assembly.GetType(ClassName);
		Type[] tp =new Type[1];
		tp[0] = typeof(int);

		object o;
		/* Object.Methods 获取类里面方法
		 * 1,获取类里面全部方法
		 * System.Reflection.MethodInfo[] methods = t.t.GetMethods();
		 *
		 * 2,获取类里面指定名称的方法
		 * GetMethod(方法名称, 方法参数类型) 用于方法重写
		 * 例如方法: Seek(int ID); Seek(String Key) 我现在要获取Seek(int ID)方法 需要这么设置type(tp)参数
		 * 方法参数类型初始化
		 * Type[] tp =new Type[1];tp[0] = typeof(int);
		 * System.Reflection.MethodInfo method = t.GetMethod(methodName,tp);
		 */
		System.Reflection.MethodInfo seekMethod = t.GetMethod("Seek",tp);
		System.Reflection.MethodInfo deleteMethod = t.GetMethod("Delete");
		/* Object obj = new Object(SysManager sm)
		 * 所以 System.Activator.CreateInstance 创建一个对象时候需要传人 SysManager 对象 否则无发创建一个新的Object对象
		 */
		o = System.Activator.CreateInstance(t,new object[]{CurrentPortal.SysManager});
		//Object.Seek(int ID) obj需要object ID 信息
		str=Convert.ToString(seekMethod.Invoke(o,obj));
		//如果对象存在 则开始删除对象
		if(str=="True")
		{
			//Object.Delete() 不需要参数传人参数便可
			deleteMethod.Invoke(o,new object[]{});
			result = true;
		}
	}
	catch
	{
		//Nothing To Do Now
	}
	return result;
}

//方法调用
private void Page_Load(object sender, System.EventArgs e)
{
	MenuId=ConvertToInt(Request.Params["MenuId"]);
	object[] obj=new object[]{99};
	bool objResult = DeleteObject("Smart.Component.BusinessData.ShipAddress",obj);
}