/// <summary> /// 基于代表医疗单的的字符串反射创建对应的医疗单控件对象 /// </summary> /// <param name="Funcclassstr"></param> /// <returns></returns> public CiorderBaseControl GetCiorderBaseControl(String funcstr) { if (String.IsNullOrEmpty(funcstr)) { new Exception("没有匹配到医疗单"); } EmsFunclassKVDTO funclassDTO = EmsMatchTool.GetEmsFunclassKVDTO(funcstr); string dllAssembly = funclassDTO.Classpath_dll; string libName = funclassDTO.Dll; //String[] str = Funcclassstr.Split(','); //string dllAssembly = str[0]; //string libName = str[1]; try { //Assembly assembly = Assembly.LoadFrom(Application.StartupPath + "\\CiSheetPlus\\" + libName); Assembly assembly = Assembly.LoadFrom(Application.StartupPath + "\\" + libName); Type type = assembly.GetType(dllAssembly); CiorderBaseControl canvas = (CiorderBaseControl)Activator.CreateInstance(type); return(canvas); } catch //(Exception e) { throw new Exception("没有匹配到医疗单"); } }
/// <summary> /// 基于代表医疗单的的字符串反射创建对应的医疗单控件对象 /// </summary> /// <param name="funcStr"></param> /// <returns></returns> private EmsFactoryBase GetEmsFactoryFromFuncStr(String funcStr) { EmsFunclassKVDTO funclassDTO = EmsMatchTool.GetEmsFunclassKVDTO(funcStr); string clazzStr = funclassDTO.Classpath_dll; string dllStr = funclassDTO.Dll; //String[] str = funcStr.Split(','); //string clazzStr = str[0]; //string dllStr = str[1]; try { //Assembly assembly = Assembly.LoadFrom(Application.StartupPath + "\\CiSheetPlus\\" + libName); Assembly assembly = Assembly.LoadFrom(Application.StartupPath + "\\" + dllStr); Type type = assembly.GetType(clazzStr); EmsFactoryBase r = (EmsFactoryBase)Activator.CreateInstance(type); return(r); } catch //(Exception e) { throw new Exception(string.Format("反射{0}时出现异常", funcStr)); } }