Ejemplo n.º 1
0
 ///<summary></summary>
 public static string GetString(MethodBase methodBase, params object[] parameters)
 {
     if (RemotingClient.RemotingRole != RemotingRole.ClientWeb)
     {
         throw new ApplicationException("Meth.GetString may only be used when RemotingRole is ClientWeb.");
     }
                 #if DEBUG
     //Verify that it returns string
     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(string))
     {
         throw new ApplicationException("Meth.GetString calling class must return string.");
     }
                 #endif
     DtoGetString dto = new DtoGetString();
     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;
     string retval = null;
     try {
         retval = RemotingClient.ProcessGetString(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.
             retval = GetString(methodBase, parameters);
         }
         else
         {
             throw;
         }
     }
     return(retval);
 }
Ejemplo n.º 2
0
 ///<summary></summary>
 public static string GetString(MethodBase methodBase, params object[] parameters)
 {
     if (RemotingClient.RemotingRole != RemotingRole.ClientWeb)
     {
         throw new ApplicationException("Meth.GetString may only be used when RemotingRole is ClientWeb.");
     }
                 #if DEBUG
     //Verify that it returns string
     MethodInfo methodInfo = methodBase.ReflectedType.GetMethod(methodBase.Name);
     if (methodInfo.ReturnType != typeof(string))
     {
         throw new ApplicationException("Meth.GetString calling class must return string.");
     }
                 #endif
     DtoGetString dto = new DtoGetString();
     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;
     return(RemotingClient.ProcessGetString(dto));
 }