///<summary></summary> public static void GetVoid(MethodBase methodBase, params object[] parameters) { if (RemotingClient.RemotingRole != RemotingRole.ClientWeb) { throw new ApplicationException("Meth.GetVoid may only be used when RemotingRole is ClientWeb."); } #if DEBUG //Verify that it returns void MethodInfo methodInfo = null; try { methodInfo = methodBase.ReflectedType.GetMethod(methodBase.Name); } catch { //this is just a debugging tool for obvious mismatches. Sometimes it will fail if there are two methods with the same name. } if (methodInfo != null && methodInfo.ReturnType != typeof(void)) { throw new ApplicationException("Meth.GetVoid calling class must return void."); } #endif DtoGetVoid dto = new DtoGetVoid(); dto.MethodName = methodBase.DeclaringType.Name + "." + methodBase.Name; dto.Params = DtoObject.ConstructArray(parameters, GetParamTypes(methodBase)); dto.Credentials = new Credentials(); dto.Credentials.Username = Security.CurUser.UserName; dto.Credentials.Password = Security.PasswordTyped; //.CurUser.Password; RemotingClient.ProcessGetVoid(dto); }
///<summary></summary> public static void GetVoid(MethodBase methodBase, params object[] parameters) { if (RemotingClient.RemotingRole != RemotingRole.ClientWeb) { throw new ApplicationException("Meth.GetVoid may only be used when RemotingRole is ClientWeb."); } #if DEBUG //Verify that it returns void MethodInfo methodInfo = null; try { methodInfo = methodBase.ReflectedType.GetMethod(methodBase.Name); } catch (AmbiguousMatchException) { //Ambiguous match exceptions do not matter for the middle tier and are just annoying when they get thrown here. Ignore them. } if (methodInfo != null && methodInfo.ReturnType != typeof(void)) { throw new ApplicationException("Meth.GetVoid calling class must return void."); } #endif DtoGetVoid dto = new DtoGetVoid(); dto.MethodName = methodBase.DeclaringType.Namespace + "." + methodBase.DeclaringType.Name + "." + methodBase.Name; dto.Params = DtoObject.ConstructArray(methodBase, parameters); dto.Credentials = new Credentials(); dto.Credentials.Username = Security.CurUser.UserName; dto.Credentials.Password = Security.PasswordTyped; //.CurUser.Password; dto.ComputerName = Security.CurComputerName; try { RemotingClient.ProcessGetVoid(dto); } catch (ODException ex) { if (ex.ErrorCode == (int)ODException.ErrorCodes.CheckUserAndPasswordFailed) { CredentialsFailed(); //The application pauses here in the main thread to wait for user input. GetVoid(methodBase, parameters); } else { throw; } } }