Exemple #1
0
        public string _getAbout()
        {
            try
            {
                string wsVersion = wsSettings.ServiceVersion;
                string wsAssemblyName = wsSettings.ServiceAssemblyName;

                string strTab = System.Web.UI.HtmlTextWriter.DefaultTabString;
                // Las comillas dobles.
                //char strQuote = System.Web.UI.HtmlTextWriter.DoubleQuoteChar;
                // Nueva línea
                string strNewLine = System.Environment.NewLine;

                /*
                System.Diagnostics.Debug.WriteLine("Request.ApplicationPath: " + HttpContext.Current.Request.ApplicationPath);
                System.Diagnostics.Debug.WriteLine("Url.AbsolutePath: " + HttpContext.Current.Request.Url.AbsolutePath);
                System.Diagnostics.Debug.WriteLine("Url.AbsoluteUri: " + HttpContext.Current.Request.Url.AbsoluteUri);
                System.Diagnostics.Debug.WriteLine("Url.Authority: " + HttpContext.Current.Request.Url.Authority);
                System.Diagnostics.Debug.WriteLine("Url.Host: " + HttpContext.Current.Request.Url.Host);
                System.Diagnostics.Debug.WriteLine("Url.LocalPath: " + HttpContext.Current.Request.Url.LocalPath);
                System.Diagnostics.Debug.WriteLine("Url.PathAndQuery: " + HttpContext.Current.Request.Url.PathAndQuery);
                System.Diagnostics.Debug.WriteLine("Url.Query: " + HttpContext.Current.Request.Url.Query);
                System.Diagnostics.Debug.WriteLine("Url.Scheme: " + HttpContext.Current.Request.Url.Scheme);
                System.Diagnostics.Debug.WriteLine("Url.UserInfo: " + HttpContext.Current.Request.Url.UserInfo);
                */

                string logotipoPath = HttpContext.Current.Request.Url.AbsoluteUri.Replace(HttpContext.Current.Request.Url.LocalPath, HttpContext.Current.Request.ApplicationPath + "/imagenes/logo_small.gif");

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

                sbHTML.Append("<table border=\"0\" cellpadding=\"5\" cellspacing=\"0\" style=\"width: 100%\">" + strNewLine);
                sbHTML.Append(strTab + "<tr>" + strNewLine);
                sbHTML.Append(strTab + strTab + "<td nowrap style=\"font-weight: bold; font-size: 9pt; color: black; font-family: Verdana; background-color: #99ccff; text-decoration: none\">" + strNewLine);
                sbHTML.Append(strTab + strTab + strTab + "Servicio Web XML: " + wsAssemblyName + strNewLine);
                sbHTML.Append(strTab + strTab + "</td>" + strNewLine);
                sbHTML.Append(strTab + strTab + "<td nowrap align=\"right\" style=\"font-weight: bold; font-size: 9pt; color: black; font-family: Verdana; background-color: #99ccff; text-decoration: none\">" + strNewLine);
                sbHTML.Append(strTab + strTab + strTab + "Versión: " + wsVersion + strNewLine);
                sbHTML.Append(strTab + strTab + "</td>" + strNewLine);
                sbHTML.Append(strTab + "</tr>" + strNewLine);
                sbHTML.Append(strTab + "<tr>" + strNewLine);
                sbHTML.Append(strTab + strTab + "<td colspan=\"2\" style=\"font-weight: normal; font-size: 8pt; color: black; font-family: Verdana; text-decoration: none\">" + strNewLine);
                sbHTML.Append(strTab + strTab + strTab + "<b>Nombre:</b><br>" + strNewLine);
                sbHTML.Append(strTab + strTab + strTab + "AzuPass es un nombre compuesto formado de la unión del vocablo en lengua inglesa ");
                sbHTML.Append(strTab + strTab + strTab + "\"Pass\" que en su forma verbal significa, entre otros, \"pasar\", \"aprobar\", \"cruzar\" ");
                sbHTML.Append(strTab + strTab + strTab + "y del diminutivo \"Azu\" que se refiere a \"Azúcar\" porque en su conjunto este servicio ");
                sbHTML.Append(strTab + strTab + strTab + "ha sido desarrollado para el Ministerio del Azúcar.<br>" + strNewLine);
                sbHTML.Append(strTab + strTab + strTab + "<b>Logotipo:</b> <img align=\"absmiddle\" height=\"20\" width=\"40\" border=\"0\"	src=\"" + logotipoPath + "\"><br>" + strNewLine);
                sbHTML.Append(strTab + strTab + strTab + "<b>Descripción:</b><br>" + strNewLine);
                sbHTML.Append(strTab + strTab + strTab + "AzuPass es un servicio Web XML que utiliza registros de usuarios en una base de " + strNewLine);
                sbHTML.Append(strTab + strTab + strTab + "datos personalizada con el fin de proporcionar a sus \"aplicaciones clientes\" un " + strNewLine);
                sbHTML.Append(strTab + strTab + strTab + "mecanismo centralizado para la identificación de los mismos, para ello expondrá " + strNewLine);
                sbHTML.Append(strTab + strTab + strTab + "los métodos necesarios a través de los cuales estos clientes podrán implementar " + strNewLine);
                sbHTML.Append(strTab + strTab + strTab + "funciones básicas como: identificar usuarios, obtener lista de sitios o aplicaciones " + strNewLine);
                sbHTML.Append(strTab + strTab + strTab + "con sus correspondientes Nombre y URL que utilicen este servicio, obtener la lista " + strNewLine);
                sbHTML.Append(strTab + strTab + strTab + "de los x sitios y/o aplicaciones más utilizadas por el usuario que se identifica, " + strNewLine);
                sbHTML.Append(strTab + strTab + strTab + "etc. Los clientes especializados de este servicio, como la aplicación Administrador " + strNewLine);
                sbHTML.Append(strTab + strTab + strTab + "de perfiles AzuPass (AzuPassProfileMgr) tendrán acceso a otros miembros que les " + strNewLine);
                sbHTML.Append(strTab + strTab + strTab + "permitirán realizar entre otras las siguientes operaciones: agregar nuevo perfil " + strNewLine);
                sbHTML.Append(strTab + strTab + strTab + "de usuario, modificar datos del perfil del usuario, etc. Gracias al desarrollo de " + strNewLine);
                sbHTML.Append(strTab + strTab + strTab + "la aplicación especializada (AzuPassProfileMgr) los desarrolladores de aplicaciones " + strNewLine);
                sbHTML.Append(strTab + strTab + strTab + "que empleen este servicio para identificación de usuarios no tendrán que preocuparse " + strNewLine);
                sbHTML.Append(strTab + strTab + strTab + "por las implementaciones, en la aplicación que desarrollen, de todos los mecanismos " + strNewLine);
                sbHTML.Append(strTab + strTab + strTab + "propios para la manipulación de los datos de los perfiles de los usuario, sino que " + strNewLine);
                sbHTML.Append(strTab + strTab + strTab + "podrán remitir a los usuarios a la URL de la aplicación que lo hace (AzuPassProfileMgr), " + strNewLine);
                sbHTML.Append(strTab + strTab + strTab + "implementando solamente el método para la validación de las credenciales que proporciona " + strNewLine);
                sbHTML.Append(strTab + strTab + strTab + "el usuario.<br>" + strNewLine);
                sbHTML.Append(strTab + strTab + strTab + "<b>Desarrolladores:</b><br>" + strNewLine);
                sbHTML.Append(strTab + strTab + strTab + "<a href=\"mailto:[email protected]?subject=Acerca de AzuPass&body=Mensaje generado desde el cuadro 'Acerca de' del servicio Web XMl AzuPass\">Lesky Alfonso M.</a><br>" + strNewLine);
                sbHTML.Append(strTab + strTab + strTab + "<b>Administradores:</b><br>" + strNewLine);
                string[] aryServiceAdmins = wsSettings.wsAdmins;
                for(int i =0; i<=(aryServiceAdmins.Length-1); i++)
                {
                    // <a href="mailto:[email protected]?subject=Asunto&body=Cuerpo del mensaje">mailto sintaxis</a>
                    sbHTML.Append(strTab + strTab + strTab + "<a href=\"mailto:" + aryServiceAdmins[i] + "?subject=Acerca de AzuPass&body=Mensaje generado desde el cuadro 'Acerca de' del servicio Web XMl AzuPass\">" + aryServiceAdmins[i] + "</a><br>" + strNewLine);
                }
                sbHTML.Append(strTab + strTab + "</td>" + strNewLine);
                sbHTML.Append(strTab + "</tr>" + strNewLine);
                sbHTML.Append(strTab + "<tr>" + strNewLine);
                sbHTML.Append(strTab + strTab + "<td colspan=\"2\" style=\"text-align: center; font-weight: bold; font-size: 6pt; color: black; font-family: Verdana; background-color: #99ccff; text-decoration: none\">" + strNewLine);
                sbHTML.Append(strTab + strTab + strTab + wsSettings.getCopyright() + strNewLine);
                sbHTML.Append(strTab + strTab + "</td>" + strNewLine);
                sbHTML.Append(strTab + "</tr>" + strNewLine);
                sbHTML.Append("</table>");

                /*
                System.Diagnostics.Debug.WriteLine("DECODED");
                System.Diagnostics.Debug.WriteLine(HttpContext.Current.Server.HtmlDecode(sbHTML.ToString()));
                System.Diagnostics.Debug.WriteLine("ENCODED");
                System.Diagnostics.Debug.WriteLine(HttpContext.Current.Server.HtmlEncode(sbHTML.ToString()));
                */
                //return sbHTML.ToString();
                return HttpContext.Current.Server.HtmlEncode(sbHTML.ToString());

            }
            catch (System.Exception Ex)
            {
                string errorMessage = ProcessError.getMessageToUser(Ex) + " " + System.Environment.NewLine;
                try
                {
                    ProcessError processError = new ProcessError();
                    if(processError.GuardarError(Ex, "AzuPass", "_getAbout"))
                    {
                        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);
            }
        }
Exemple #2
0
 public System.Data.DataSet _getListCatOcupacionales()
 {
     try
     {
         CatOcupacional catOcupacional = new CatOcupacional();
         return catOcupacional.getList();
     }
     catch (System.Exception Ex)
     {
         string errorMessage = ProcessError.getMessageToUser(Ex) + " " + System.Environment.NewLine;
         try
         {
             ProcessError processError = new ProcessError();
             if(processError.GuardarError(Ex, "AzuPass", "_getListCatOcupacionales"))
             {
                 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);
     }
 }
Exemple #3
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);
            }
        }
Exemple #4
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);
            }
        }
Exemple #5
0
 public System.Data.DataSet _getServicedApplications(int listTop)
 {
     try
     {
         RegistroUso regUso = new RegistroUso();
         return regUso.getFavoritos(listTop);
     }
     catch(System.Exception Ex)
     {
         string errorMessage = ProcessError.getMessageToUser(Ex) + " " + System.Environment.NewLine;
         try
         {
             ProcessError processError = new ProcessError();
             if(processError.GuardarError(Ex, "AzuPass", "_getServicedApplications"))
             {
                 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);
     }
 }
Exemple #6
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);
              }
        }
Exemple #7
0
        public wsSettings.passwordRequeriments getPasswdRequeriments()
        {
            // Chequear los encabezados SOAP
            //this.checkSoapHeader();

            try
            {
                return wsSettings.PasswdRequeriments;
            }
            catch(System.Exception Ex)
            {
                string errorMessage = ProcessError.getMessageToUser(Ex) + " " + System.Environment.NewLine;
                try
                {
                    ProcessError processError = new ProcessError();
                    if(processError.GuardarError(Ex, "AzuPass", "getPasswdRequeriments"))
                    {
                        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);
            }
        }
Exemple #8
0
 public string _getProfileManagerUrl()
 {
     try
     {
         return wsSettings.AzuPassProfileMgrURL;
     }
     catch(System.Exception Ex)
     {
         string errorMessage = ProcessError.getMessageToUser(Ex) + " " + System.Environment.NewLine;
         try
         {
             ProcessError processError = new ProcessError();
             if(processError.GuardarError(Ex, "AzuPass", "_getProfileManagerURL"))
             {
                 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);
     }
 }
Exemple #9
0
        public string getChangeProfileEmailWarning()
        {
            // Chequear los encabezados SOAP
            this.checkSoapHeader();

            try
            {

                string[] aryEmailTopDomains = wsSettings.EmailTopDomains;
                string EmailTopDomains = string.Empty;

                for(int i =0; i<=(aryEmailTopDomains.Length-1); i++)
                {
                    EmailTopDomains = i!=0?EmailTopDomains + ", ":"";
                    EmailTopDomains = EmailTopDomains + aryEmailTopDomains[i];
                }
                if(EmailTopDomains == "*"){EmailTopDomains = string.Concat(EmailTopDomains, " (TODOS)");}

                string returnMessage = "Si el cambio de su dirección electrónica es efectivo, se cambiará también su actual contraseña " +
                    "por un valor autogenerado por este servicio y ésta le llegará por correo a la nueva dirección especificada, como sucedió la " +
                    "primera vez que se registro como usuario del servicio \"" + wsSettings.ServiceShortName + "\". Tenga en cuenta que, según la " +
                    "configuración actual de este servicio, solo se admiten direcciones de correo cuyo formato indique que pertenezcen a los siguiente(s) " +
                    "dominio(s): " + EmailTopDomains;

                return returnMessage;
            }
            catch(System.Exception Ex)
            {
                string errorMessage = ProcessError.getMessageToUser(Ex) + " " + System.Environment.NewLine;
                try
                {
                    ProcessError processError = new ProcessError();
                    if(processError.GuardarError(Ex, "AzuPass", "getChangeProfileEmailWarning"))
                    {
                        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);
            }
        }
Exemple #10
0
        public string getChangeProfilePasswdWarning()
        {
            // Chequear los encabezados SOAP
            this.checkSoapHeader();

            try
            {

                wsSettings.passwordRequeriments passwdReq = wsSettings.PasswdRequeriments;
                string returnMessage = "Los valores de configuración de este servicio indican que su contraseña debe terner " +
                    "como mínimo " + passwdReq.pwdMinChars + " caracteres y como máximo " + passwdReq.pwdMaxChars + ".";
                if(passwdReq.pwdMustDiferUserName)
                {
                    returnMessage += " Además también se especifica que la cadena seleccionada como contraseña no podrá aparecer " +
                        "contenida dentro de su nombre, apellidos, dirección electrónica o cualquier unión de estos.";
                }

                return returnMessage;
            }
            catch(System.Exception Ex)
            {
                string errorMessage = ProcessError.getMessageToUser(Ex) + " " + System.Environment.NewLine;
                try
                {
                    ProcessError processError = new ProcessError();
                    if(processError.GuardarError(Ex, "AzuPass", "getChangeProfilePasswdWarning"))
                    {
                        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);
            }
        }
Exemple #11
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);
            }
        }
Exemple #12
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);
            }
        }
Exemple #13
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);
              }
        }
Exemple #14
0
 public string _getLogoImageSrc()
 {
     try
     {
     return TEICOCF.WebServices.wsSettings.ApplicationBaseURL + "imagenes/logo_small.gif";
     }
     catch (System.Exception Ex)
     {
         string errorMessage = ProcessError.getMessageToUser(Ex) + " " + System.Environment.NewLine;
         try
         {
             ProcessError processError = new ProcessError();
             if(processError.GuardarError(Ex, "AzuPass", "_getLogoImageSrc"))
             {
                 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);
     }
 }
Exemple #15
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);
            }
        }
Exemple #16
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);
     }
 }
Exemple #17
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);
            }
        }
Exemple #18
0
        public System.Data.DataSet _getServiceAdmins()
        {
            try
            {
                string[] aryAdmins = wsSettings.wsAdmins;
                System.Data.DataSet dsAdmins = new System.Data.DataSet();
                dsAdmins.Tables.Add("WebServiceAdmins");
                dsAdmins.Tables[0].Columns.Add("e_mail", System.Type.GetType("System.String"));
                System.Data.DataRow dr;
                for(int i=0; i<=(aryAdmins.Length-1); i++)
                {
                    dr = dsAdmins.Tables[0].NewRow();
                    dr["e_mail"] = aryAdmins[i];
                    dsAdmins.Tables[0].Rows.Add(dr);
                }

                return dsAdmins;
            }
            catch(System.Exception Ex)
            {
                string errorMessage = ProcessError.getMessageToUser(Ex) + " " + System.Environment.NewLine;
                try
                {
                    ProcessError processError = new ProcessError();
                    if(processError.GuardarError(Ex, "AzuPass", "_getServiceAdmins"))
                    {
                        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);
            }
        }
Exemple #19
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);
            }
        }
Exemple #20
0
        /// <summary>
        /// Enviar correo de notificación para nuevo registro de usuario o para cuando ha olvidado su contraseña.
        /// </summary>
        /// <returns>TRUE si es enviada la notificación, de otra manera FALSE.</returns>
        public bool sendWelcomeEmail()
        {
            try
              {
            string ServiceShortName = wsSettings.ServiceShortName;
            string ServiceFullName = wsSettings.ServiceFullName;
            string AzuPassProfileMgrURL = wsSettings.AzuPassProfileMgrURL;
            string[] aryServiceAdmins = wsSettings.wsAdmins;
            string ServiceAdmins = string.Empty;

            for (int i = 0; i <= (aryServiceAdmins.Length - 1); i++)
            {
              ServiceAdmins = i != 0 ? ServiceAdmins + ", " : "";
              // <a href="mailto:[email protected]?subject=Asunto&body=Cuerpo del mensaje">mailto sintaxis</a>
              ServiceAdmins = ServiceAdmins + "<a href=\"mailto:" + aryServiceAdmins[i] + "?subject=Sobre servicio " + ServiceShortName + "&body=Hola, soy " + Nombre + " " + Apellidos + " y estoy registrado a través del servicio " + ServiceShortName + ", le escribo porque...\">" + aryServiceAdmins[i] + "</a>";
              //System.Diagnostics.Debug.WriteLine(ServiceAdmins);
            }

            // Cadena que representa el TAB.
            string strTab = System.Web.UI.HtmlTextWriter.DefaultTabString;
            // Las comillas dobles.
            //char strQuote = System.Web.UI.HtmlTextWriter.DoubleQuoteChar;
            // Nueva línea
            string strNewLine = System.Environment.NewLine;
            System.Text.StringBuilder sbHTML = new System.Text.StringBuilder();

            // La base de los links que contiene el correo.
            string strContentBase = AzuPassProfileMgrURL; //HttpContext.Current.Request.Url.ToString().Substring(0, HttpContext.Current.Request.Url.ToString().IndexOf(HttpContext.Current.Request.ApplicationPath)+HttpContext.Current.Request.ApplicationPath.Length+1);

            // Estilos para poner en los elementos style porque algunos clientes web de mensajería no entienden de estilos empotrados, tiene que ser en-línea.
            string style_body = "font-size: 8pt; color: #000000; font-family: Verdana; text-decoration: none";
            string style_td_title = "font-size: 10pt; color: #47639a; font-weight: bold; font-family: Verdana; background-color: #f0f8ff; border-right: #47639a 1px solid; border-top: #47639a 1px solid; border-left: #47639a 1px solid; border-bottom: #47639a 1px solid; padding: 2px 2px 2px 2px";
            string style_td = "font-size: 8pt; color: #000000; font-family: Verdana; text-decoration: none; padding-right: 2px; padding-left: 2px; padding-bottom: 2px; margin: 2px; padding-top: 2px";
            string style_td_content = "font-size: 8pt; color: #000000; font-family: Verdana; text-decoration: none; padding: 2px 2px 2px 2px; margin-top: 2px background-color: #ffffff; border-right: #47639a 1px solid; border-left: #47639a 1px solid; border-bottom: #47639a 1px solid";

            sbHTML.Append("<html>" + strNewLine);
            sbHTML.Append(strTab + "<head>" + strNewLine);
            sbHTML.Append(strTab + strTab + "<title>Bienvenido a: " + ServiceFullName + "</title>" + strNewLine);
            sbHTML.Append(strTab + strTab + "<meta http-equiv=\"Content-Language\" content=\"es\">" + strNewLine);
            sbHTML.Append(strTab + strTab + "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">" + strNewLine);
            sbHTML.Append(strTab + "</head>" + strNewLine);
            sbHTML.Append(strTab + "<body style=\"" + style_body + "\" topmargin=\"0\" leftmargin=\"0\" bottommargin=\"0\" rightmargin=\"0\"> " + strNewLine);
            sbHTML.Append(strTab + strTab + "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"100%\">" + strNewLine);
            sbHTML.Append(strTab + strTab + strTab + "<tr>" + strNewLine);
            sbHTML.Append(strTab + strTab + strTab + strTab + "<td style=\"" + style_td_title + "\" valign=\"middle\" colspan=\"3\"><b>Bienvenido a: " + ServiceFullName + "</b><img border=\"0\" src=\"" + wsSettings.ApplicationBaseURL + "imagenes/logo_small.gif\"></td>" + strNewLine);
            sbHTML.Append(strTab + strTab + strTab + "</tr>" + strNewLine);
            sbHTML.Append(strTab + strTab + strTab + "<tr>" + strNewLine);
            sbHTML.Append(strTab + strTab + strTab + strTab + "<td style=\"" + style_td_content + "\" colspan=\"3\">" + strNewLine);
            sbHTML.Append(strTab + strTab + strTab + strTab + strTab + Sexo.ToString() == "F" ? "Estimada" : "Estimado " + this.m_Nombre + " " + this.m_Apellidos + ":<br>usted ha sido registrado como usuario del " + ServiceFullName + "." + strNewLine);
            sbHTML.Append(strTab + strTab + strTab + strTab + strTab + "A continuación le notificamos los datos necesarios para hacer uso de éste." + strNewLine);
            sbHTML.Append(strTab + strTab + strTab + strTab + "</td>" + strNewLine);
            sbHTML.Append(strTab + strTab + strTab + "</tr>" + strNewLine);
            sbHTML.Append(strTab + strTab + strTab + "<tr>" + strNewLine);
            sbHTML.Append(strTab + strTab + strTab + strTab + "<td style=\"" + style_td + "\" width=\"20%\" valign=\"top\"><b>Nombre</b></td>" + strNewLine);
            sbHTML.Append(strTab + strTab + strTab + strTab + "<td style=\"" + style_td + "\" width=\"30%\" valign=\"top\"><b>Valor</b></td>" + strNewLine);
            sbHTML.Append(strTab + strTab + strTab + strTab + "<td style=\"" + style_td + "\" width=\"50%\" valign=\"top\"><b>Explicación</b></td>" + strNewLine);
            sbHTML.Append(strTab + strTab + strTab + "</tr>" + strNewLine);
            sbHTML.Append(strTab + strTab + strTab + "<tr>" + strNewLine);
            sbHTML.Append(strTab + strTab + strTab + strTab + "<td style=\"" + style_td + "\" width=\"20%\" valign=\"top\">Dirección de corrreo:</td>" + strNewLine);
            sbHTML.Append(strTab + strTab + strTab + strTab + "<td style=\"" + style_td + "\" width=\"30%\" valign=\"top\">" + this.m_Email + "</td>" + strNewLine);
            sbHTML.Append(strTab + strTab + strTab + strTab + "<td style=\"" + style_td + "\" width=\"50%\" valign=\"top\">La dirección de correo se empleará como nombre de usuario.</td>" + strNewLine);
            sbHTML.Append(strTab + strTab + strTab + "</tr>" + strNewLine);
            sbHTML.Append(strTab + strTab + strTab + "<tr>" + strNewLine);
            sbHTML.Append(strTab + strTab + strTab + strTab + "<td style=\"" + style_td + "\" width=\"20%\" valign=\"top\">Contraseña:</td>" + strNewLine);
            sbHTML.Append(strTab + strTab + strTab + strTab + "<td style=\"" + style_td + "\" width=\"30%\" valign=\"top\">" + Crypto.Decrypt(this.m_Passwd) + "</td>" + strNewLine);
            sbHTML.Append(strTab + strTab + strTab + strTab + "<td style=\"" + style_td + "\" width=\"50%\" valign=\"top\">Contraseña de acceso.</td>" + strNewLine);
            sbHTML.Append(strTab + strTab + strTab + "</tr>" + strNewLine);
            sbHTML.Append(strTab + strTab + strTab + "<tr>" + strNewLine);
            sbHTML.Append(strTab + strTab + strTab + strTab + "<td valign=\"middle\" colspan=\"3\"><hr size=\"1\" color=\"#47639a\" width=\"100%\"></td>" + strNewLine);
            sbHTML.Append(strTab + strTab + strTab + "</tr>" + strNewLine);
            sbHTML.Append(strTab + strTab + strTab + "<tr>" + strNewLine);
            sbHTML.Append(strTab + strTab + strTab + strTab + "<td style=\"" + style_td + "\" valign=\"middle\" colspan=\"3\">" + strNewLine);
            sbHTML.Append(strTab + strTab + strTab + strTab + strTab + "Puede utilizar la aplicación <a href=\"" + AzuPassProfileMgrURL + "\" target=\"_blank\">Administrador de perfiles AzuPass <img border=\"0\" src=\"" + wsSettings.AzuPassProfileMgrURL + "/imagenes/logo_small.gif\"></a>" + strNewLine);
            sbHTML.Append(strTab + strTab + strTab + strTab + strTab + "para modificar datos de su perfil, su contraseña y dirección electrónica según como estime necesario y también para ver un registro de sus propias visitas a otros servicio o aplicaciones que hagan uso de " + wsSettings.ServiceShortName + "." + strNewLine);
            sbHTML.Append(strTab + strTab + strTab + strTab + "</td>" + strNewLine);
            sbHTML.Append(strTab + strTab + strTab + "</tr>" + strNewLine);
            sbHTML.Append(strTab + strTab + strTab + "<tr>" + strNewLine);
            sbHTML.Append(strTab + strTab + strTab + strTab + "<td style=\"" + style_td + "\" valign=\"middle\" colspan=\"3\">" + strNewLine);
            sbHTML.Append(strTab + strTab + strTab + strTab + strTab + "<br>Atentamente,<br>" + strNewLine);
            sbHTML.Append(strTab + strTab + strTab + strTab + strTab + "Administradores del servicio: " + ServiceAdmins + strNewLine);
            sbHTML.Append(strTab + strTab + strTab + strTab + "</td>" + strNewLine);
            sbHTML.Append(strTab + strTab + strTab + "</tr>" + strNewLine);
            sbHTML.Append(strTab + strTab + "</table>" + strNewLine);
            sbHTML.Append("<br>" + strNewLine);
            sbHTML.Append(strTab + strTab + wsSettings.getHTML_FootCopyright() + strNewLine);
            sbHTML.Append(strTab + "</body>" + strNewLine);
            sbHTML.Append("</html>");

            /*
            MailAddress from = new MailAddress("*****@*****.**");
            MailAddress to = new MailAddress("*****@*****.**");
            MailMessage message = new MailMessage(from, to);
            message.Subject = "Using the SmtpClient class.";
            message.Body = @"Using this feature, you can send an e-mail message from an application very easily.";
            SmtpClient client = new SmtpClient(server);
            Console.WriteLine("Sending an e-mail message to {0} by using SMTP host {1} port {2}.",
            to.ToString(), client.Host, client.Port);
            client.Send(message);
            */

            System.Net.Mail.MailMessage mailMsg = new System.Net.Mail.MailMessage(
              wsSettings.SMTPService.User,
              this.m_Email,
              "Notificación de registro: " + wsSettings.ServiceShortName,
              @sbHTML.ToString());

            mailMsg.BodyEncoding = System.Text.Encoding.GetEncoding("iso-8859-1");
            mailMsg.Priority = System.Net.Mail.MailPriority.Normal;
            mailMsg.Headers["Reply-To"] = "no-replay";
            //mailMsg.Subject = "Notificación de registro: " + wsSettings.ServiceShortName;
            //mailMsg.AlternateViews.Clear();
            mailMsg.AlternateViews.Add(System.Net.Mail.AlternateView.CreateAlternateViewFromString(@sbHTML.ToString(), System.Text.Encoding.GetEncoding("iso-8859-1"), System.Net.Mime.MediaTypeNames.Text.Html));

            //mailMsg.BodyFormat = System.Net.Mail.MailFormat.Html;
            //mailMsg.UrlContentBase = strContentBase;
            //mailMsg.Body = @sbHTML.ToString();
            System.Net.Mail.SmtpClient client = new System.Net.Mail.SmtpClient(wsSettings.SMTPService.Server);
            try
            {
              if (wsSettings.SMTPService.Auth)
              {
            System.Net.NetworkCredential basicAuthenticationInfo = new System.Net.NetworkCredential(
              wsSettings.SMTPService.User,
              wsSettings.SMTPService.Passwd);

            client.UseDefaultCredentials = false;
            client.Credentials = basicAuthenticationInfo;
              }
            }
            catch (System.Exception Ex)
            {
              ProcessError processError = new ProcessError();
              processError.GuardarError(Ex, "Perfil", "sendWellcomeMessage");
              processError = null;
              // No hacer nada más para cuando no se pueden establecer los parámetros de Authenticación SMTP.
            }
            client.Send(mailMsg);
            //System.Net.Mail.SmtpMail.Send(mailMsg);
            mailMsg = null;
            return true;
              }
              catch (System.Exception Ex)
              {
            // Registrar Error aqu;i de manera detallada a través de la clase ProcessError.
            ProcessError processError = new ProcessError();
            processError.GuardarError(Ex, "Perfil", "sendWellcomeMessage", "Administrador de perfiles AzuPass", wsSettings.AzuPassProfileMgrURL, this.ID);
            processError = null;
            return false;
              }
        }
        /// <summary>
        /// Chequea si es alcanzable la dirección URL almacenada en la variables provada "m_appURL"  
        /// </summary>
        /// <returns></returns>
        public bool isURLReachable()
        {
            try
            {
                string strResponse = string.Empty;
                string strMethod = "GET";
                System.Net.WebRequest WRequest;
                System.Net.WebResponse WResponse;

                System.Uri clientAppUri = new System.Uri(this.m_appURL);

                WRequest = System.Net.WebRequest.Create( clientAppUri );
                WRequest.Method = strMethod;

                // Determinar si se utiliza Proxy específico.
                System.Net.WebProxy myProxy = new System.Net.WebProxy();
                myProxy = (System.Net.WebProxy)WRequest.Proxy;
                if(wsSettings.InternetAccess.proxyAddress!=null)
                {
                    myProxy = new System.Net.WebProxy(wsSettings.InternetAccess.proxyAddress);
                    myProxy.BypassProxyOnLocal = true;
                }
                // Determinar si se configuraron credenciales para el proxy.
                System.Net.NetworkCredential proxyCredentials = new System.Net.NetworkCredential();
                if(wsSettings.InternetAccess.proxyUser.Length!=0 & wsSettings.InternetAccess.proxyPasswd.Length!=0)
                {
                    proxyCredentials.UserName = wsSettings.InternetAccess.proxyUser;
                    proxyCredentials.Password = wsSettings.InternetAccess.proxyPasswd;
                    if(wsSettings.InternetAccess.NetBIOSDomain.Length!=0)
                    {
                        proxyCredentials.Domain = wsSettings.InternetAccess.NetBIOSDomain;
                    }
                }
                else
                {
                    proxyCredentials = (System.Net.NetworkCredential)System.Net.CredentialCache.DefaultCredentials;
                }

                myProxy.Credentials = proxyCredentials;

                // Las credenciales por defecto son usualmente las credenciales de Windows
                // (user name, contraseña, y dominio) de la cuenta bajo la que corre la aplicación.
                WRequest.Credentials = System.Net.CredentialCache.DefaultCredentials;
                WRequest.Proxy = myProxy;
                WResponse = (System.Net.WebResponse)WRequest.GetResponse();
                return true;
            }
            catch(System.Exception Ex)
            {
                // Registrar Error aquí de manera detallada a través de la clase ProcessError.
                ProcessError processError = new ProcessError();
                processError.GuardarError(Ex, "ServicedApplication", "isURLReachable", this.m_appName, this.m_appURL, 0);
                processError = null;
                return false;
            }
        }