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