Exemplo n.º 1
0
 public bool ResendPasswd(string e_mail)
 {
     System.Object[] Args = { null, e_mail.ToLower() };
       Perfil perfil = new Perfil();
       // Devuelve el ID del Perfil al que pertenece el Email.
       System.Object result = perfil.getValue("IDxEmail", Args);
       //System.Diagnostics.Debug.WriteLine(result);
       if (result == System.DBNull.Value)
       {
     throw new System.Exception("No existe ningún perfil que corresponda con el Correo-e: \"" + e_mail + "\", por tanto no se ha enviado la contraseña a dicha dirección.");
       }
       perfil.ID = (int)result;
       return perfil.sendWelcomeEmail();
 }
Exemplo n.º 2
0
 public System.Data.DataSet _getProfileFavorites(string e_mail, string Passwd, int cantEnLista)
 {
     try
     {
         Perfil perfil = new Perfil();
         int IdPerfil =  perfil.Identificar(e_mail, Passwd, true);
         if(IdPerfil>0)
         {
             return perfil.getFavoritos(IdPerfil, cantEnLista);
         }
         else
         {
       throw new SoapException("Error al validar las credenciales del usuario.", SoapException.ClientFaultCode);
             //throw new System.Exception("Error al validar las credenciales del usuario.");
         }
     }
     catch(System.Exception Ex)
     {
         string errorMessage = ProcessError.getMessageToUser(Ex) + " " + System.Environment.NewLine;
         try
         {
             ProcessError processError = new ProcessError();
             if(processError.GuardarError(Ex, "AzuPass", "_getProfileFavorites"))
             {
                 errorMessage = errorMessage + processError.ErrorRecordedNotification;
             }
             processError = null;
         }
         catch(System.Exception)
         {
             ; // No hacer nada si falla el mecanismo de guardar los errores.
         }
     throw new SoapException(errorMessage, SoapException.ClientFaultCode);
     //throw new System.Exception(errorMessage);
     }
 }
Exemplo n.º 3
0
 /// <summary>
 /// Comprueba si existe la dirección de correo que se pasa como valor del parámetro "e_mail"
 /// </summary>
 /// <param name="e_mail">Dirección de correo que se necesita comprobar.</param>
 /// <returns>Entero que indica la cantidad de ocurrencias encontradas.</returns>
 public static bool existEmail(string e_mail)
 {
     System.Object[] Args = { null, e_mail.ToLower() };
       Perfil perfil = new Perfil();
       // Devuelve el ID del Perfil al que pertenece el Email.
       System.Object result = perfil.getValue("IDxEmail", Args);
       //System.Diagnostics.Debug.WriteLine(result);
       perfil = null;
       return (result == System.DBNull.Value ? false : true);
 }
Exemplo n.º 4
0
        public string changeProfileEmail(string current_e_mail, string Passwd, string new_e_mail)
        {
            // Chequear los encabezados SOAP
            this.checkSoapHeader();

            try
            {
                string NoChangeMessage = "No se realizó el cambio solicitado. ";

                // Breve corrección del nuevo e_mail si es necesario.
                new_e_mail = new_e_mail==null?string.Empty:new_e_mail.ToLower().Trim();

                if(current_e_mail.ToLower() == new_e_mail)
                {
                    return NoChangeMessage + "La dirección electrónica actual y la nueva no difieren.";
                }
                // Validar la existencia dle perfil según las credenciales.
                Perfil perfil = new Perfil();
                perfil.ID = perfil.Identificar(current_e_mail, Passwd, true);
                if(perfil.ID==0)
                {
              string errorMessage = "Acceso denegado. Las credenciales proporcionadas no corresponden con ningún perfil. " +
            "Si está seguro que son estas correctas, entonces verifique con los administradores de este servicio si su " +
            "perfil se encuentra deshabilitado.";
              throw new SoapException(errorMessage, SoapException.ClientFaultCode);
                }

                // Comprobar que o estén en uso el nuevo e_mail.
                if(Perfil.existEmail(new_e_mail))
                {
                    return NoChangeMessage + "La dirección electrónica " + new_e_mail + " ya se encuentra en uso.";
                }
                // Pasar el valor a la propiedad para que lo valide según lo configurado porque esta propiedad hace la validación.
                perfil.Email = new_e_mail;
                perfil.dsEntidad.Tables[0].Rows[0]["e_mail"] = new_e_mail;
                // Crear una nueva contraseña para el usuario porque por razones de seguridad le repetimos
                // el proceso de envío de la contraseña por correo como cuando se registró por primera vez.
                string encrypted = Crypto.Encrypt(new_e_mail + System.DateTime.Now.Ticks.ToString());
                int lagroMinPasswd = wsSettings.PasswdRequeriments.pwdMinChars;
                // Obtener la cadena encriptada que se le enviará al usuario.
                string new_Passwd = encrypted.Substring((encrypted.Length-lagroMinPasswd)-3, lagroMinPasswd).ToLower();
                perfil.dsEntidad.Tables[0].Rows[0]["Passwd"] = Crypto.Encrypt(new_Passwd);
                if(perfil.Actualizar()>0)
                {
                    if(!perfil.sendWelcomeEmail())
                    {
                        // Si no se envía el correo revertir el cambio.
                        perfil.dsEntidad.Tables[0].Rows[0]["e_mail"] = current_e_mail;
                        perfil.dsEntidad.Tables[0].Rows[0]["Passwd"] = Passwd;
                        perfil.Actualizar();
                        return NoChangeMessage + "El sistema de envío de notificaciones por correo no ha " +
                            "funcionado como se esperaba. Por favor, inténtelo más tarde. Se ha guardado " +
                            "un registro del suceso para que el personal de soporte de este servicio lo " +
                            "revise si es necesario.";
                    }
                    return "Su dirección electrónica ha cambiado, espere recibir a la nueva dirección un " +
                        "correo con una nueva contraseña, la cual ha sido cambiada por razones de seguridad.";
                }
                else
                {
                    string[] aryServiceAdmins = wsSettings.wsAdmins;
                    string ServiceAdmins = string.Empty;

                    for(int i =0; i<=(aryServiceAdmins.Length-1); i++)
                    {
                        ServiceAdmins = i!=0?ServiceAdmins + ", ":"";
                        ServiceAdmins = ServiceAdmins + aryServiceAdmins[i];
                    }

                    return NoChangeMessage + "El servicio ha experimentado un comportamiento fuera de lo normal. " +
                        "Por favor, inténtelo más tarde, si el problema persiste no dude en consultar a algunos " +
                        "de los administradores (" + ServiceAdmins + ") de este servicio.";
                }
            }
            catch(System.Exception Ex)
            {
                string errorMessage = ProcessError.getMessageToUser(Ex) + " " + System.Environment.NewLine;
                try
                {
                    ProcessError processError = new ProcessError();
                    if(processError.GuardarError(Ex, "AzuPass", "changeProfileEmail"))
                    {
                        errorMessage = errorMessage + processError.ErrorRecordedNotification;
                    }
                    processError = null;
                }
                catch(System.Exception)
                {
                    ; // No hacer nada si falla el mecanismo de guardar los errores.
                }
            throw new SoapException(errorMessage, SoapException.ClientFaultCode);
            //throw new System.Exception(errorMessage);
            }
        }
Exemplo n.º 5
0
        public bool UpdateProfile(string e_mail, string Passwd, string Nombre, string Apellidos, System.DateTime FechaNac, Perfil.enuSexo Sexo, int IdCatOcupacional, string DescripcionIntereses)
        {
            // Chequear el encabezado SOAP.
            this.checkSoapHeader();

            try
            {
                Perfil perfil = new Perfil(0);
                perfil.ID = perfil.Identificar(e_mail, Passwd, false);
                if(perfil.ID==0)
                {
              throw new SoapException("Las credenciales proporcionadas no son válidas. Acceso denegado.", SoapException.ClientFaultCode);
              //throw new System.Exception("Las credenciales proporcionadas no son válidas. Acceso denegado.");
                }

                System.Text.StringBuilder errorMessage = new System.Text.StringBuilder("");

                // Nombre
                try
                {
                    perfil.Nombre = Nombre;
                }
                catch(System.Exception Ex)
                {
                    errorMessage.Append(Ex.Message + System.Environment.NewLine);
                }
                // Apellidos
                try
                {
                    perfil.Apellidos = Apellidos;
                }
                catch(System.Exception Ex)
                {
                    errorMessage.Append(Ex.Message + System.Environment.NewLine);
                }
                // FechaNac
                try
                {
                    perfil.FechaNac = FechaNac;
                }
                catch(System.Exception Ex)
                {
                    errorMessage.Append(Ex.Message + System.Environment.NewLine);
                }
                // Sexo
                try
                {
                    perfil.Sexo = Sexo;
                }
                catch(System.Exception Ex)
                {
                    errorMessage.Append(Ex.Message + System.Environment.NewLine);
                }
                // IdCatOcupacional
                try
                {
                    perfil.IdCatOcupacional = IdCatOcupacional;
                }
                catch(System.Exception Ex)
                {
                    errorMessage.Append(Ex.Message + System.Environment.NewLine);
                }
                // DescripIntereses
                try
                {
                    perfil.DescripIntereses = DescripcionIntereses;
                }
                catch(System.Exception Ex)
                {
                    errorMessage.Append(Ex.Message + System.Environment.NewLine);
                }
                // Si se registró algún error emitir una Exception cion las descripciones correspondientes.
                if(errorMessage.ToString()!=string.Empty)
                {
                    perfil = null;
              throw new SoapException(errorMessage.ToString(), SoapException.ClientFaultCode);
              //throw new System.Exception(errorMessage.ToString());
                }
                // El valor Passwd que se pasa para almacenarse es encriptado.
                //System.Object[] Args = { perfil.ID, perfil.Nombre, perfil.Apellidos, perfil.Email, perfil.Passwd, perfil.FechaNac, perfil.Sexo, perfil.IdCatOcupacional, perfil.FechaRegistro, perfil.Habilitado};
                //newPerfil.dsEntidad.Tables[0].Rows[0].ItemArray = Args;
                perfil.Actualizar();
                perfil = null;
                return true;
            }
            catch(System.Exception Ex)
            {
                string errorMessage = ProcessError.getMessageToUser(Ex) + " " + System.Environment.NewLine;
                try
                {
                    ProcessError processError = new ProcessError();
                    if(processError.GuardarError(Ex, "AzuPass", "UpdateProfile"))
                    {
                        errorMessage = errorMessage + processError.ErrorRecordedNotification;
                    }
                    processError = null;
                }
                catch(System.Exception)
                {
                    ; // No hacer nada si falla el mecanismo de guardar los errores.
                }
            throw new SoapException(errorMessage, SoapException.ClientFaultCode);
                //throw new System.Exception(errorMessage);
            }
        }
Exemplo n.º 6
0
        public bool Register(string Nombre, string Apellidos, string e_mail, System.DateTime FechaNac, Perfil.enuSexo Sexo, int IdCatOcupacional, string DescripcionIntereses)
        {
            // Chequear el encabezado SOAP.
            this.checkSoapHeader();

            try
            {
                // Arreglar errores menores en las siguientes variables.
                Nombre = Nombre==null?string.Empty:Nombre.Trim();
                Apellidos = Apellidos==null?string.Empty:Apellidos.Trim();
                e_mail = e_mail==null?string.Empty:e_mail.ToLower().Trim();
                // Validar los datos proporcionados por la aplicación cliente.
                valUserData(Nombre, Apellidos, e_mail, FechaNac, IdCatOcupacional);
                if(DescripcionIntereses!=null)
                {
                    if (DescripcionIntereses.Trim() == string.Empty){DescripcionIntereses=null;}
                }

                // Obtener un valor encriptado para enviar por correo como Passwd inicial para el usuario.
                string encrypted = Crypto.Encrypt(e_mail + System.DateTime.Now.Ticks.ToString());
                int largoMinPasswd = wsSettings.PasswdRequeriments.pwdMinChars;
                // Obtener la cadena encriptada que se le enviará al usuario.
            string Passwd = encrypted.Substring((encrypted.Length - largoMinPasswd) - 3, largoMinPasswd).ToLower();
                // El valor Passwd que se pasa para almacenarse es otra vez encriptado.
                System.Object[] Args = { null, Nombre, Apellidos, e_mail, Crypto.Encrypt(Passwd), FechaNac, Sexo, IdCatOcupacional,
                                           System.DateTime.Now, true, DescripcionIntereses };
                Perfil perfil = new Perfil();
                perfil.dsEntidad.Tables[0].Rows[0].ItemArray = Args;
                int IdPerfil = perfil.Agregar();

                // Enviar el correo de notificación. Si no se puede eliminará los registros recien agregados.
                if(!perfil.sendWelcomeEmail())
                {
                    perfil.Eliminar();
                    perfil = null;

                    string[] aryServiceAdmins = wsSettings.wsAdmins;
                    string ServiceAdmins = string.Empty;

                    for(int i =0; i<=(aryServiceAdmins.Length-1); i++)
                    {
                        ServiceAdmins = i!=0?ServiceAdmins + ", ":"";
                        ServiceAdmins = ServiceAdmins + aryServiceAdmins[i];
                    }
              string errorMessage = "El sistema para envío de notificaciones no ha funcionado como se esperaba, no se ha registrado el Perfil. " +
                        "Por favor, inténtelo más tarde, si el problema persiste no dude en consultar a alguno de los administradores (" + ServiceAdmins + ") de este servcio.";
              throw new SoapException(errorMessage, SoapException.ClientFaultCode);
                }

                perfil = null;
                return true;
            }
            catch(System.Exception Ex)
            {
                string errorMessage = ProcessError.getMessageToUser(Ex) + " " + System.Environment.NewLine;
                try
                {
                    ProcessError processError = new ProcessError();
                    if(processError.GuardarError(Ex, "AzuPass", "Register"))
                    {
                        errorMessage = errorMessage + processError.ErrorRecordedNotification;
                    }
                    processError = null;
                }
                catch(System.Exception)
                {
                    ; // No hacer nada si falla el mecanismo de guardar los errores.
                }
            throw new SoapException(errorMessage, SoapException.ClientFaultCode);
            }
        }
Exemplo n.º 7
0
        public bool resendWelcomeEmail(string e_mail)
        {
            // Chequear los encabezados SOAP
            this.checkSoapHeader();

            try
            {
                Perfil perfil = new Perfil();
                return perfil.ResendPasswd(e_mail);
            }
            catch(System.Exception Ex)
            {
                string errorMessage = ProcessError.getMessageToUser(Ex) + " " + System.Environment.NewLine;
                try
                {
                    ProcessError processError = new ProcessError();
                    if(processError.GuardarError(Ex, "AzuPass", "resendWelcomeEmail"))
                    {
                        errorMessage = errorMessage + processError.ErrorRecordedNotification;
                    }
                    processError = null;
                }
                catch(System.Exception)
                {
                    ; // No hacer nada si falla el mecanismo de guardar los errores.
                }
            throw new SoapException(errorMessage, SoapException.ClientFaultCode);
                //throw new System.Exception(errorMessage);
            }
        }
Exemplo n.º 8
0
        public System.Data.DataSet PrepareNewProfile()
        {
            // Comprobar encabezados SOAP
            this.checkSoapHeader();

            try
            {
                Perfil perfil = new Perfil(0);
                perfil.dsEntidad.DataSetName = "dsPerfil";
                perfil.dsEntidad.Tables[0].TableName = "Perfil";
                perfil.dsEntidad.Tables[1].TableName = "lstCatOcupacionales";
                System.Data.DataSet ds = new System.Data.DataSet();
                ds = perfil.dsEntidad.Copy();
                ds.Tables[0].Columns.Remove("ID");
                ds.Tables[0].Columns.Remove("Passwd");
                ds.Tables[0].Columns.Remove("FechaRegistro");
                ds.Tables[0].Columns.Remove("Habilitado");
                perfil = null;
                return ds;
            }
            catch(System.Exception Ex)
            {
                string errorMessage = ProcessError.getMessageToUser(Ex) + " " + System.Environment.NewLine;
                try
                {
                    ProcessError processError = new ProcessError();
                    if(processError.GuardarError(Ex, "AzuPass", "_LogOnPlus"))
                    {
                        errorMessage = errorMessage + processError.ErrorRecordedNotification;
                    }
                    processError = null;
                }
                catch(System.Exception)
                {
                    ; // No hacer nada si falla el mecanismo de guardar los errores.
                }
            throw new SoapException(errorMessage, SoapException.ClientFaultCode);
            //throw new System.Exception(errorMessage);
            }
        }
Exemplo n.º 9
0
        public System.Data.DataSet EditProfile(string Email, string Passwd)
        {
            // Comprobar encabezados SOAP
            this.checkSoapHeader();

            try
            {
                Perfil perfil = new Perfil();
                perfil.ID = perfil.Identificar(Email, Passwd, false);
                perfil.dsEntidad.DataSetName = "dsPerfil";
                perfil.dsEntidad.Tables[0].TableName = "tbl_Perfil";
                perfil.dsEntidad.Tables[1].TableName = "lst_CatOcupacional";
                // Preparar para remover las columnas que no se editan a través de este miembro.
                //System.Data.DataSet ds = new System.Data.DataSet();
                //ds = perfil.dsEntidad.Copy();
                perfil.dsEntidad.Tables[0].Columns.Remove("ID");
                perfil.dsEntidad.Tables[0].Columns.Remove("e_mail");
                perfil.dsEntidad.Tables[0].Columns.Remove("Passwd");
                perfil.dsEntidad.Tables[0].Columns.Remove("FechaRegistro");
                perfil.dsEntidad.Tables[0].Columns.Remove("Habilitado");
                //perfil = null;
                return perfil.dsEntidad;
            }
            catch(System.Exception Ex)
            {
                string errorMessage = ProcessError.getMessageToUser(Ex) + " " + System.Environment.NewLine;
                try
                {
                    ProcessError processError = new ProcessError();
                    if(processError.GuardarError(Ex, "AzuPass", "EditProfile"))
                    {
                        errorMessage = errorMessage + processError.ErrorRecordedNotification;
                    }
                    processError = null;
                }
                catch(System.Exception)
                {
                    ; // No hacer nada si falla el mecanismo de guardar los errores.
                }
            throw new SoapException(errorMessage, SoapException.ClientFaultCode);
            //throw new System.Exception(errorMessage);
            }
        }
Exemplo n.º 10
0
        public bool changeProfilePasswd(string e_mail, string current_Passwd, string new_Passwd)
        {
            // Chequear los encabezados SOAP
            this.checkSoapHeader();

            try
            {
                // Validar la existencia dle perfil según las credenciales.
                Perfil perfil = new Perfil();
                perfil.ID = perfil.Identificar(e_mail, current_Passwd, true);
                if(perfil.ID==0)
                {
              string errorMessage = "Acceso denegado. Las credenciales proporcionadas no corresponden con ningún perfil. " +
            "Si está seguro que son estas correctas, entonces verifique con los administradores de este servicio si su " +
            "perfil se encuentra deshabilitado.";
              throw new SoapException(errorMessage, SoapException.ClientFaultCode);
                }

                // Pasar el valor natural, para que lo valide según lo configurado porque esta propiedad hace la validación.
                perfil.Passwd = new_Passwd;
                // Ahora asignar el valor encriptado directamente al campo del DataSet del objeto perfil porque si lo hacemos
                // a través de la propiedad Passwd y es mayor en largo de los caracteres especificados en la cionfiguración
                // nos devolverá un error.
                perfil.dsEntidad.Tables[0].Rows[0]["Passwd"] = Crypto.Encrypt(new_Passwd);
                return perfil.Actualizar()>0?true:false;
            }
            catch(System.Exception Ex)
            {
                string errorMessage = ProcessError.getMessageToUser(Ex) + " " + System.Environment.NewLine;
                try
                {
                    ProcessError processError = new ProcessError();
                    if(processError.GuardarError(Ex, "AzuPass", "changeProfilePasswd"))
                    {
                        errorMessage = errorMessage + processError.ErrorRecordedNotification;
                    }
                    processError = null;
                }
                catch(System.Exception)
                {
                    ; // No hacer nada si falla el mecanismo de guardar los errores.
                }
            throw new SoapException(errorMessage, SoapException.ClientFaultCode);
                //throw new System.Exception(errorMessage);
            }
        }
Exemplo n.º 11
0
        /// <summary>
        /// Identifica el perfil, chequea si se requiere verificación de la URL de la aplicación cliente y ordena hacerlo 
        /// si es preciso, actualiza el registro de uso a nombre del usuario identificado.
        /// </summary>
        /// <param name="e_mail">email del perfil.</param>
        /// <param name="Passwd">contraseña del perfil.</param>
        /// <param name="clientAppName">Nombre de la aplicación cliente.</param>
        /// <param name="clientAppURL">URL que representa el punto de entrada de la aplicación cliente.</param>
        /// <param name="appState">Estado de la aplicación, "Debug" ó "Release", cuando es debug no se 
        /// realizan algunas funciones y esto aligera la carga, permitiendo que el procedimientos se 
        /// ejecute con más rapidez.</param>
        /// <returns>Devolverá el ID del usuario identificado en caso de ser correctos los elementos 
        /// e_mail y Passwd, en caso contrario devolverá cero (0).</returns>
        private int LogOn(string e_mail, string Passwd, string clientAppName, string clientAppURL, ServicedApplication.enuApplicationState appState)
        {
            int IdPerfil = 0;
            try
            {
                Perfil perfil = new Perfil();
                IdPerfil = perfil.Identificar(e_mail, Passwd, true);
                if(IdPerfil==0)
                {
                    perfil = null;
                    return IdPerfil;
                }
                /*
                    Cuando se indica que la aplicación está aún en modo de depuración,
                    evitar entonces el registro de la misma ya que muchos elementos,
                    entre ellos la URL donde se hospeda, pueden variar.
                */
                if(appState == ServicedApplication.enuApplicationState.Debug)
                {
                    perfil = null;
                    return IdPerfil;
                }

                // Verificar el formato y corregir la URL si es necesario y posible.
                clientAppURL = wsSettings.parseURL(clientAppURL, "minaz.cu");
                System.Uri appUri = new System.Uri(clientAppURL);

                ServicedApplication servicedApplication = new ServicedApplication();
                servicedApplication.ID = servicedApplication.Identificar(clientAppName, appUri);
                if(servicedApplication.ID==0)
                {
                    System.Object[] ArgsServicedApp = {null, clientAppName, appUri.AbsoluteUri, false, System.DateTime.Now};
                    appUri = null;
                    servicedApplication.dsEntidad.Tables[0].Rows[0].ItemArray = ArgsServicedApp;
                    servicedApplication.Agregar();
                }
                RegistroUso regUso = new RegistroUso(0);
                System.Object[] ArgsRegUso = {null, IdPerfil, servicedApplication.ID, System.DateTime.Now};
                regUso.dsEntidad.Tables[0].Rows[0].ItemArray = ArgsRegUso;
                regUso.Agregar();
                regUso = null;

                // Si se exige el chequeo de las URLs y la URL de la aplicación en cuestión no está chequeada ó
                // si ya venció el tiempo y debe volver a ser verificada, entonces verificarla.
                if((wsSettings.InternetAccess.CheckClientAppsURL & !servicedApplication.urlChecked) ||
                    (wsSettings.InternetAccess.CheckClientAppsURL & (servicedApplication.lastURLCheck.AddMonths(wsSettings.InternetAccess.MonthBeforeReCheck) < System.DateTime.Now)))
                {
                    servicedApplication.urlChecked = servicedApplication.isURLReachable();
                    servicedApplication.lastURLCheck = System.DateTime.Now;
                    // Revisar esto porque recuerda que hicistes un cambio en el procedimiento pa_tbl_ServicedApplication_U
                    System.Diagnostics.Debug.WriteLine(servicedApplication.Actualizar());
                }

                servicedApplication = null;
                return IdPerfil;
            }
            catch(System.Exception Ex)
            {
                string errorMessage = ProcessError.getMessageToUser(Ex) + " " + System.Environment.NewLine;
                try
                {
                    ProcessError processError = new ProcessError();
                    if(processError.GuardarError(Ex, "AzuPass", "_LogOn", clientAppName, clientAppURL, IdPerfil))
                    {
                        errorMessage = errorMessage + processError.ErrorRecordedNotification;
                    }
                    processError = null;
                }
                catch(System.Exception)
                {
                    ; // No hacer nada si falla el mecanismo de guardar los errores.
                }
            throw new SoapException(errorMessage, SoapException.ClientFaultCode);
              }
        }
Exemplo n.º 12
0
        public System.Data.DataSet _LogOnPlus(string e_mail, string Passwd, string clientAppName, string clientAppURL, ServicedApplication.enuApplicationState appState)
        {
            int IdPerfil = 0;
            IdPerfil = this.LogOn(e_mail, Passwd, clientAppName, clientAppURL, appState);
            if(IdPerfil==0)
            {
                throw new SoapException("Acceso denegado. Verifique que sus credenciales sean las correctas, " +
                    "si está seguro de ello, verifique que su cuenta no esté deshabilitada.",SoapException.ClientFaultCode);
            }

            try
            {
                Perfil perfil = new Perfil();
                perfil.ID = IdPerfil;
                // Registrar el usuario y la aplicación en tabla tbl_RegistroUso no es necesario
                // porque el propio procedimiento almacenado "pa_tbl_Perfil_GvIDxEmailPasswd_Plus"
                // valida las credenciales y agrega un nuevo registro a la tabla "tbl_RegistroUso".
                System.Data.DataSet ds = new System.Data.DataSet("dsPerfil");
                ds.Tables.Add(perfil.dsEntidad.Tables[0].Copy());
                ds.Tables[0].TableName = "Perfil";
                /* Eliminar el código para agregar el Role como campo, porque no se considera necesario.
                System.Data.DataColumn dtRole = new DataColumn("Role", System.Type.GetType("System.String"));
                ds.Tables[0].Columns.Add(dtRole);
                ds.Tables[0].Rows[0]["Role"] = "Usuario";
                for(int i=0; i<=(wsSettings.wsAdmins.Length-1); i++)
                {
                    if(e_mail == wsSettings.wsAdmins[i])
                    {
                        ds.Tables[0].Rows[0]["Role"] = "Administrador";
                    }
                }
                */
                //ds.Tables[0].Columns.Remove("ID");
                ds.Tables[0].Columns.Remove("Passwd");
                ds.Tables[0].Columns.Remove("IdCatOcupacional");
                ds.Tables[0].Columns.Remove("Habilitado");
                ds.Tables[0].Columns.Remove("DescripIntereses");
                ds.Tables.Add(perfil.getFavoritos(perfil.ID, 5).Tables[0].Copy());
                ds.Tables[1].TableName = "Favoritos";
                perfil = null;
                return ds;
            }
            catch(System.Exception Ex)
            {
                string errorMessage = ProcessError.getMessageToUser(Ex) + " " + System.Environment.NewLine;
                try
                {
                    ProcessError processError = new ProcessError();
                    if(processError.GuardarError(Ex, "AzuPass", "_LogOnPlus", clientAppName, clientAppURL, IdPerfil))
                    {
                        errorMessage = errorMessage + processError.ErrorRecordedNotification;
                    }
                    processError = null;
                }
                catch(System.Exception)
                {
                    ; // No hacer nada si falla el mecanismo de guardar los errores.
                }
            throw new SoapException(errorMessage, SoapException.ClientFaultCode);
              }
        }