gov.va.medora.mdws.MySession.execute C# (CSharp) Method

execute() public method

public execute ( string className, string methodName, object args ) : Object
className string
methodName string
args object
return Object
        public Object execute(string className, string methodName, object[] args)
        {
            string userIdStr = "";
            //if (_user != null)
            //{
            //    userIdStr = _user.LogonSiteId.Id + '/' + _user.Uid + ": ";
            //}
            string fullClassName = className;
            if (!fullClassName.StartsWith("gov."))
            {
                fullClassName = "gov.va.medora.mdws." + fullClassName;
            }
            Object theLib = Activator.CreateInstance(Type.GetType(fullClassName), new object[] { this });
            Type theClass = theLib.GetType();
            Type[] theParamTypes = new Type[args.Length];
            for (int i = 0; i < args.Length; i++)
            {
                theParamTypes[i] = args[i].GetType();
            }
            MethodInfo theMethod = theClass.GetMethod(methodName, theParamTypes);
            Object result = null;
            if (theMethod == null)
            {
                result = new Exception("Method " + className + " " + methodName + " does not exist.");
            }
            try
            {
                result = theMethod.Invoke(theLib, BindingFlags.InvokeMethod, null, args, null);
            }
            catch (Exception e)
            {
                if (e.GetType().IsAssignableFrom(typeof(System.Reflection.TargetInvocationException)) &&
                    e.InnerException != null)
                {
                    result = e.InnerException;
                }
                else
                {
                    result = e;
                }
                return result;
            }
            return result;
        }

Usage Example

Ejemplo n.º 1
0
 public TextTO getConsultNote(string consultId)
 {
     return((TextTO)MySession.execute("ClinicalLib", "getConsultNote", new object[] { consultId }));
 }
All Usage Examples Of gov.va.medora.mdws.MySession::execute