コード例 #1
0
ファイル: xlsUsuario.aspx.cs プロジェクト: GCSoft/CEDHNL
        // Eventos de la página
        protected void Page_Load(object sender, EventArgs e)
        {
            ENTUsuario oENTUsuario = new ENTUsuario();
            String sDefaultErrorMessage = "";

            try
            {

                // Mensaje de error por default
                sDefaultErrorMessage = gcEncryption.EncryptString("[V03] Acceso ilegal a la página", true);

                // Validaciones
                if (this.Request.QueryString["key"] == null)
                {
                    this.Response.Redirect("~/Application/WebApp/Private/SysApp/saNotificacion.aspx?key=" + sDefaultErrorMessage, false);
                }

                if (!HasValidParams(this.Request.QueryString["key"].ToString(), ref oENTUsuario))
                {
                    this.Response.Redirect("~/Application/WebApp/Private/SysApp/saNotificacion.aspx?key=" + sDefaultErrorMessage, false);
                }

                // Consultar Órdenes de Compra
                SelectUsuario(oENTUsuario);

            }
            catch (Exception)
            {
                // Do Nothing
            }
        }
コード例 #2
0
        // Funciones del programador
        private void updateUserPassword()
        {
            BPUsuario oBPUsuario = new BPUsuario();

            ENTSession oENTSession = new ENTSession();
            ENTUsuario oENTUsuario = new ENTUsuario();
            ENTResponse oENTResponse = new ENTResponse();

            try{

                // Obtener sesion
                oENTSession = (ENTSession)this.Session["oENTSession"];

                // Datos del formulario
                oENTUsuario.idUsuario = oENTSession.idUsuario;
                oENTUsuario.sPassword = this.sNewPassword.Text;
                oENTUsuario.sOldPassword = this.sOldPassword.Text;

                // Transacción
                oENTResponse = oBPUsuario.UpdateUsuario_ActualizaContrasena(oENTUsuario);

                // Validaciones
                if (oENTResponse.GeneratesException){ throw (new Exception(oENTResponse.sErrorMessage)); }
                if (oENTResponse.sMessage != ""){ throw (new Exception(oENTResponse.sMessage)); }

                // Transacción exitosa
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), Convert.ToString(Guid.NewGuid()), "alert('Su contraseña ha sido actualizada con éxito'); focusControl('" + this.sOldPassword.ClientID + "');", true);

            }catch (Exception ex){
                throw(ex);
            }
        }
コード例 #3
0
ファイル: scatUsuario.aspx.cs プロジェクト: GCSoft/CEDHNL
        private void SelectUsuario()
        {
            ENTSession oENTSession;
            ENTUsuario oENTUsuario = new ENTUsuario();
            ENTResponse oENTResponse = new ENTResponse();

            BPUsuario oBPUsuario = new BPUsuario();

            DataTable tblUsuario;
            String sMessage = "";

            try
            {

                // Formulario
                oENTUsuario.idRol = Int32.Parse(this.ddlRol.SelectedItem.Value);
                oENTUsuario.idArea = Int32.Parse(this.ddlArea.SelectedItem.Value);
                oENTUsuario.sEmail = this.txtEmail.Text;
                oENTUsuario.sNombre = this.txtNombre.Text;
                oENTUsuario.tiActivo = Int16.Parse(this.ddlStatus.SelectedItem.Value);

                // Transacción
                oENTResponse = oBPUsuario.SelectUsuario(oENTUsuario);

                // Validaciones
                if (oENTResponse.GeneratesException) { throw (new Exception(oENTResponse.sErrorMessage)); }

                // Mensaje de la BD
                if (oENTResponse.sMessage != "") { sMessage = "alert('" + gcJavascript.ClearText(oENTResponse.sMessage) + "');"; }

                // Seguridad
                oENTSession = (ENTSession)this.Session["oENTSession"];
                tblUsuario = (oENTSession.idRol != 1 ? deleteDataTableRow(oENTResponse.dsResponse.Tables[1], "idRol", "1") : oENTResponse.dsResponse.Tables[1]);

                // Llenado de controles
                this.gvUsuario.DataSource = tblUsuario;
                this.gvUsuario.DataBind();

                // Mensaje al usuario
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), Convert.ToString(Guid.NewGuid()), sMessage, true);

            }
            catch (Exception ex)
            {
                throw (ex);
            }
        }
コード例 #4
0
ファイル: frmLogin.aspx.cs プロジェクト: GCSoft/CEDHNL
        private void recoveryPassword()
        {
            BPUsuario oBPUsuario = new BPUsuario();

            ENTUsuario oENTUsuario = new ENTUsuario();
            ENTResponse oENTResponse = new ENTResponse();

            try
            {

                // Datos del formulario
                oENTUsuario.sEmail = this.txtEmail.Text;

                // Transacción
                oENTResponse = oBPUsuario.SelectUsuario_RecuperaContrasena(oENTUsuario);

                // Validaciones
                if (oENTResponse.GeneratesException) { throw (new Exception(oENTResponse.sErrorMessage)); }
                if (oENTResponse.sMessage != "") { throw (new Exception(oENTResponse.sMessage)); }

                // Recuperación exitosa
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), Convert.ToString(Guid.NewGuid()), "alert('Los datos de recuperación de contraseña han sido enviados por correo electrónico'); function pageLoad(){ focusControl('" + this.txtEmail.ClientID + "'); }", true);

            }catch (Exception ex){
                throw (ex);
            }
        }
コード例 #5
0
ファイル: frmLogin.aspx.cs プロジェクト: GCSoft/CEDHNL
        private void loginUser()
        {
            BPUsuario oBPUsuario = new BPUsuario();

            ENTUsuario oENTUsuario = new ENTUsuario();
            ENTResponse oENTResponse = new ENTResponse();
            ENTSession oENTSession = new ENTSession();

            try
            {

                // Datos del formulario
                oENTUsuario.sEmail = this.txtEmail.Text;
                oENTUsuario.sPassword = (this.hddEncryption.Value == "1" ? gcEncryption.DecryptString(this.txtPassword.Text, false) : this.txtPassword.Text);

                // Transacción
                oENTResponse = oBPUsuario.SelectUsuario_Autenticacion(oENTUsuario);

                // Validaciones
                if (oENTResponse.GeneratesException) { throw (new Exception(oENTResponse.sErrorMessage)); }
                if (oENTResponse.sMessage != "") { throw (new Exception(oENTResponse.sMessage)); }

                // Usuario válido
                cookiesSetConfiguration();
                // oENTSession = (ENTSession)Session["oENTSession"];
                this.Response.Redirect("../Private/Home/AppIndex.aspx", false);

            }catch (Exception ex){
                throw (ex);
            }
        }
コード例 #6
0
ファイル: DAUsuario.cs プロジェクト: GCSoft/CEDHNL
        ///<remarks>
        ///   <name>DAUsuario.UpdateUsuario_Estatus</name>
        ///   <create>21-Octubre-2013</create>
        ///   <author>GCSoft - Web Project Creator BETA 1.0</author>
        ///</remarks>
        ///<summary>Activa/inactiva un Usuario</summary>
        ///<param name="oENTUsuario">Entidad de Usuario con los parámetros necesarios para crear el registro</param>
        ///<param name="sConnection">Cadena de conexión a la base de datos</param>
        ///<param name="iAlternateDBTimeout">Valor en milisegundos del Timeout en la consulta a la base de datos. 0 si se desea el Timeout por default</param>
        ///<returns>Una entidad de respuesta</returns>
        public ENTResponse UpdateUsuario_Estatus(ENTUsuario oENTUsuario, String sConnection, Int32 iAlternateDBTimeout)
        {
            SqlConnection sqlCnn = new SqlConnection(sConnection);
            SqlCommand sqlCom;
            SqlParameter sqlPar;
            SqlDataAdapter sqlDA;

            ENTResponse oENTResponse = new ENTResponse();

            // Configuración de objetos
            sqlCom = new SqlCommand("uspcatUsuario_Upd_Estatus", sqlCnn);
            sqlCom.CommandType = CommandType.StoredProcedure;

            // Timeout alternativo en caso de ser solicitado
            if (iAlternateDBTimeout > 0) { sqlCom.CommandTimeout = iAlternateDBTimeout; }

            // Parametros
            sqlPar = new SqlParameter("idUsuario", SqlDbType.Int);
            sqlPar.Value = oENTUsuario.idUsuario;
            sqlCom.Parameters.Add(sqlPar);

            sqlPar = new SqlParameter("tiActivo", SqlDbType.TinyInt);
            sqlPar.Value = oENTUsuario.tiActivo;
            sqlCom.Parameters.Add(sqlPar);

            // Inicializaciones
            oENTResponse.dsResponse = new DataSet();
            sqlDA = new SqlDataAdapter(sqlCom);

            // Transacción
            try{
                sqlCnn.Open();
                sqlDA.Fill(oENTResponse.dsResponse);
                sqlCnn.Close();
            }catch (SqlException sqlEx){
                oENTResponse.ExceptionRaised(sqlEx.Message);
            }catch (Exception ex){
                oENTResponse.ExceptionRaised(ex.Message);
            }finally{
                if (sqlCnn.State == ConnectionState.Open) { sqlCnn.Close(); }
                sqlCnn.Dispose();
            }

            // Resultado
            return oENTResponse;
        }
コード例 #7
0
ファイル: BPUsuario.cs プロジェクト: GCSoft/CEDHNL
        ///<remarks>
        /// <name>BPUsuario.SelectUsuario_ParaFuncionario</name>
        /// <create>06-Abril-2014</create>
        /// <author>Ruben.Cobos</author>
        ///</remarks>
        ///<summary>Consulta el catálogo de Usuarios y filtra los que son candidatos a ser funcionarios</summary>
        ///<param name="oENTUsuario">Entidad de usuario con los filtros necesarios para la consulta</param>
        ///<returns>Una entidad de respuesta</returns>
        public ENTResponse SelectUsuario_ParaFuncionario(ENTUsuario oENTUsuario)
        {
            DAUsuario oDAUsuario = new DAUsuario();
            ENTResponse oENTResponse = new ENTResponse();

            DataTable tblFuncionario;
            DataRow rowFuncionario;

            try
            {

                // Transacción en base de datos
                oENTResponse = oDAUsuario.SelectUsuario(oENTUsuario, this.sConnectionApplication, 0);

                // Validación de error en consulta
                if (oENTResponse.GeneratesException) { return oENTResponse; }

                // Mensajes de la BD
                oENTResponse.sMessage = oENTResponse.dsResponse.Tables[0].Rows[0]["sResponse"].ToString();

                // Filtrar solo los registros candidatos a funcionarios
                tblFuncionario = oENTResponse.dsResponse.Tables[1].Clone();
                foreach (DataRow rowFilter in oENTResponse.dsResponse.Tables[1].Select("FuncionarioId = 0 And idRol Not In (1, 2)")){

                    rowFuncionario = tblFuncionario.NewRow();
                    foreach (DataColumn colFilter in tblFuncionario.Columns){
                        rowFuncionario[colFilter.ColumnName] = rowFilter[colFilter.ColumnName];
                    }
                    tblFuncionario.Rows.Add(rowFuncionario);
                }

                // Reescribir DataTable de respuesta
                oENTResponse.dsResponse.Tables[1].Clear();
                foreach (DataRow rowActual in tblFuncionario.Rows){

                    rowFuncionario = oENTResponse.dsResponse.Tables[1].NewRow();
                    foreach (DataColumn colFilter in tblFuncionario.Columns){
                        rowFuncionario[colFilter.ColumnName] = rowActual[colFilter.ColumnName];
                    }
                    oENTResponse.dsResponse.Tables[1].Rows.Add(rowFuncionario);
                }

                // Validación - Consulta Vacía
                if (oENTResponse.dsResponse.Tables[1].Rows.Count == 0 && oENTResponse.sMessage != ""){
                    oENTResponse.sMessage = "No se encontraron usuarios disponibles para convertirse en funcionarios";
                }

            }catch (Exception ex){
                oENTResponse.ExceptionRaised(ex.Message);
            }

            // Resultado
            return oENTResponse;
        }
コード例 #8
0
ファイル: vicClimaLaboral.aspx.cs プロジェクト: GCSoft/CEDHNL
        void InsertClimaLaboralUsuario_Local()
        {
            ENTUsuario oENTUsuario = new ENTUsuario();
            ENTResponse oENTResponse = new ENTResponse();

            BPUsuario oBPUsuario = new BPUsuario();

            DataTable tblUsuario = null;
            DataRow rowUsuario = null;

            try
            {

                // Validaciones
                if (this.ddlUsuario.SelectedValue == "0") { throw new Exception("Es necesario seleccionar un Usuario"); }

                // Obtener el DataTable del grid
                tblUsuario = gcParse.GridViewToDataTable(this.gvUsuario, false);

                // Validación de que no se haya agregado el Usuario
                if (tblUsuario.Select("idUsuario='" + this.ddlUsuario.SelectedItem.Value + "'").Length > 0){
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), Convert.ToString(Guid.NewGuid()), "alert('Ya ha seleccionado éste Usuario'); function pageLoad(){ focusControl('" + this.ddlUsuario.ClientID + "'); }", true);
                    return;
                }

                // Formulario
                oENTUsuario.idRol = 0;
                oENTUsuario.idArea = 0;
                oENTUsuario.idUsuario = Int32.Parse(this.ddlUsuario.SelectedItem.Value);
                oENTUsuario.sEmail = "";
                oENTUsuario.sNombre = "";
                oENTUsuario.tiActivo = 1;

                // Transacción
                oENTResponse = oBPUsuario.SelectUsuario(oENTUsuario);

                // Errores y Warnings
                if (oENTResponse.GeneratesException) { throw (new Exception(oENTResponse.sErrorMessage)); }
                if (oENTResponse.sMessage != "") { throw (new Exception(oENTResponse.sMessage)); }

                // Nuevo Item
                rowUsuario = tblUsuario.NewRow();
                rowUsuario["idUsuario"] = oENTResponse.dsResponse.Tables[1].Rows[0]["idUsuario"];
                rowUsuario["sFullName"] = oENTResponse.dsResponse.Tables[1].Rows[0]["sFullName"];
                rowUsuario["sArea"] = oENTResponse.dsResponse.Tables[1].Rows[0]["sArea"];
                rowUsuario["SexoNombre"] = oENTResponse.dsResponse.Tables[1].Rows[0]["SexoNombre"];
                rowUsuario["sEmail"] = oENTResponse.dsResponse.Tables[1].Rows[0]["sEmail"];
                tblUsuario.Rows.Add(rowUsuario);

                // Refrescar el Grid
                this.gvUsuario.DataSource = tblUsuario;
                this.gvUsuario.DataBind();

                // Foco
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), Convert.ToString(Guid.NewGuid()), "focusControl('" + this.ddlUsuario.ClientID + "');", true);

            }catch (Exception ex){
                throw (ex);
            }
        }
コード例 #9
0
ファイル: scatUsuario.aspx.cs プロジェクト: GCSoft/CEDHNL
        private void UpdateUsuario_Estatus(Int32 idUsuario, UsuarioActionTypes UsuarioActionType)
        {
            ENTUsuario oENTUsuario = new ENTUsuario();
            ENTResponse oENTResponse = new ENTResponse();

            BPUsuario oBPUsuario = new BPUsuario();

            try
            {

                // Formulario
                oENTUsuario.idUsuario = idUsuario;
                switch (UsuarioActionType)
                {
                    case UsuarioActionTypes.DeleteUsuario:
                        oENTUsuario.tiActivo = 0;
                        break;
                    case UsuarioActionTypes.ReactivateUsuario:
                        oENTUsuario.tiActivo = 1;
                        break;
                    default:
                        throw new Exception("Opción inválida");
                }

                // Transacción
                oENTResponse = oBPUsuario.UpdateUsuario_Estatus(oENTUsuario);

                // Validaciones
                if (oENTResponse.GeneratesException) { throw (new Exception(oENTResponse.sErrorMessage)); }
                if (oENTResponse.sMessage != "") { throw (new Exception(oENTResponse.sMessage)); }

                // Actualizar datos
                SelectUsuario();

            }
            catch (Exception ex)
            {
                throw (ex);
            }
        }
コード例 #10
0
ファイル: xlsUsuario.aspx.cs プロジェクト: GCSoft/CEDHNL
        void SelectUsuario(ENTUsuario oENTUsuario)
        {
            ENTResponse oENTResponse = new ENTResponse();
            BPUsuario oBPUsuario = new BPUsuario();

            try
            {

                // Transacción
                oENTResponse = oBPUsuario.SelectUsuario(oENTUsuario);

                // Validaciones
                if (oENTResponse.GeneratesException) { throw (new Exception(oENTResponse.sErrorMessage)); }

                // Transacción exitosa
                ExportExcel(oENTResponse.dsResponse.Tables[2], "Usuario");

            }
            catch (Exception ex)
            {
                throw (ex);
            }
        }
コード例 #11
0
ファイル: xlsUsuario.aspx.cs プロジェクト: GCSoft/CEDHNL
        // Funciones del programador
        Boolean HasValidParams(String sKey, ref ENTUsuario oENTUsuario)
        {
            Boolean ValidParams = true;

            try
            {

                // Query String
                sKey = gcEncryption.DecryptString(sKey, true);

                // Parámetros de consulta (idRol|sEmail|sNombre|tiActivo)
                oENTUsuario.idRol = Int32.Parse(sKey.Split(new Char[] { '|' })[0].ToString());
                oENTUsuario.sEmail = sKey.Split(new Char[] { '|' })[1].ToString();
                oENTUsuario.sNombre = sKey.Split(new Char[] { '|' })[2].ToString();
                oENTUsuario.tiActivo = Int16.Parse(sKey.Split(new Char[] { '|' })[3].ToString());

                // Parámetros validos
                ValidParams = true;

            }catch (Exception){
                ValidParams = false;
            }

            return ValidParams;
        }
コード例 #12
0
ファイル: BPUsuario.cs プロジェクト: GCSoft/CEDHNL
        ///<remarks>
        ///   <name>BPUsuario.UpdateUsuario_Estatus</name>
        ///   <create>21-Octubre-2013</create>
        ///   <author>GCSoft - Web Project Creator BETA 1.0</author>
        ///</remarks>
        ///<summary>Activa/inactiva un Usuario</summary>
        ///<param name="oENTUsuario">Entidad de Usuario con los parámetros necesarios para actualizar su información</param>
        ///<returns>Una entidad de respuesta</returns>
        public ENTResponse UpdateUsuario_Estatus(ENTUsuario oENTUsuario)
        {
            DAUsuario oDAUsuario = new DAUsuario();
            ENTResponse oENTResponse = new ENTResponse();

            try
            {

                // Transacción en base de datos
                oENTResponse = oDAUsuario.UpdateUsuario_Estatus(oENTUsuario, this.sConnectionApplication, 0);

                // Validación de error en consulta
                if (oENTResponse.GeneratesException) { return oENTResponse; }

                // Validación de mensajes de la BD
                oENTResponse.sMessage = oENTResponse.dsResponse.Tables[0].Rows[0]["sResponse"].ToString();
                if (oENTResponse.sMessage != "") { return oENTResponse; }

            }catch (Exception ex){
                oENTResponse.ExceptionRaised(ex.Message);
            }

            // Resultado
            return oENTResponse;
        }
コード例 #13
0
ファイル: BPUsuario.cs プロジェクト: GCSoft/CEDHNL
        ///<remarks>
        ///   <name>BPUsuario.UpdateUsuario_ActualizaContrasena</name>
        ///   <create>21-Octubre-2013</create>
        ///   <author>GCSoft - Web Project Creator BETA 1.0</author>
        ///</remarks>
        ///<summary>Actualiza la contraseña de un usuario</summary>
        ///<param name="oENTUsuario">Entidad de usuario con los parámetros necesarios para actualizar la contraseña</param>
        ///<returns>Una entidad de respuesta</returns>
        public ENTResponse UpdateUsuario_ActualizaContrasena(ENTUsuario oENTUsuario)
        {
            GCEncryption gcEncryption = new GCEncryption();

            DAUsuario oDAUsuario = new DAUsuario();
            ENTResponse oENTResponse = new ENTResponse();

            try
            {

                // Encriptar el passwords
                oENTUsuario.sPassword = gcEncryption.EncryptString(oENTUsuario.sPassword, false);
                oENTUsuario.sOldPassword = gcEncryption.EncryptString(oENTUsuario.sOldPassword, false);

                // Transacción en base de datos
                oENTResponse = oDAUsuario.UpdateUsuario_ActualizaContrasena(oENTUsuario, this.sConnectionApplication, 0);

                // Validación de error en consulta
                if (oENTResponse.GeneratesException) { return oENTResponse; }

                // Validación de mensajes de la BD
                oENTResponse.sMessage = oENTResponse.dsResponse.Tables[0].Rows[0]["sResponse"].ToString();
                if (oENTResponse.sMessage != "") { return oENTResponse; }

            }catch (Exception ex){
                oENTResponse.ExceptionRaised(ex.Message);
            }

            // Resultado
            return oENTResponse;
        }
コード例 #14
0
ファイル: BPUsuario.cs プロジェクト: GCSoft/CEDHNL
        ///<remarks>
        ///   <name>BPUsuario.InsertUsuario</name>
        ///   <create>21-Octubre-2013</create>
        ///   <author>GCSoft - Web Project Creator BETA 1.0</author>
        ///</remarks>
        ///<summary>Actualiza la información de un usuario</summary>
        ///<param name="oENTUsuario">Entidad de usuario con los parámetros necesarios para actualizar su información</param>
        ///<returns>Una entidad de respuesta</returns>
        public ENTResponse InsertUsuario(ENTUsuario oENTUsuario)
        {
            GCMail gcMail = new GCMail();
            GCEncryption gcEncryption = new GCEncryption();
            GCPassword gcPassword = new GCPassword();

            DAUsuario oDAUsuario = new DAUsuario();
            ENTResponse oENTResponse = new ENTResponse();

            String sHTMLMessage = "";
            String sPassword = "";

            try
            {

                // Generar Password
                sPassword = gcPassword.Create();

                // Encriptar el Password
                oENTUsuario.sPassword = gcEncryption.EncryptString(sPassword, false);

                // Validación de creación de password
                if (oENTUsuario.sPassword.Trim() == "") { throw (new Exception("Se generó una excepción al crear el usuario. Por favor intente de nuevo")); }

                // Transacción en base de datos
                oENTResponse = oDAUsuario.InsertUsuario(oENTUsuario, this.sConnectionApplication, 300);

                // Validación de error en consulta
                if (oENTResponse.GeneratesException) { return oENTResponse; }

                // Validación de mensajes de la BD
                oENTResponse.sMessage = oENTResponse.dsResponse.Tables[0].Rows[0]["sResponse"].ToString();
                if (oENTResponse.sMessage != "") { return oENTResponse; }

                // Configuración del correo
                sHTMLMessage = "" +
                "<html>" +
                   "<head>" +
                      "<title>SIAQ - Bienvenido al sistema</title>" +
                   "</head>" +
                   "<body style='height:100%; margin:0px; padding:0px; width:100%;'>" +
                      "<div style='clear:both; height:90%; text-align:center; width:100%;'>" +
                         "<div style='height:80%; clear: both; margin:0px auto; position:relative; top:10%; width:90%;'>" +
                            "<table border='0px;' cellpadding='0' cellspacing='0' style='height:100%; width:100%;'>" +
                               "<tr>" +
                                  "<td colspan='2' valign='middle' style='color:#549CC6; font-family:Arial; font-size:12px; font-weight:bold; text-align:left;'>SIAQ - Bienvenido al sistema</td>" +
                               "</tr>" +
                               "<tr><td colspan='3'><div style='border-bottom:1px solid #549CC6;'></div></td></tr>" +
                               "<tr style='height:10px'><td colspan='3'></td></tr>" +
                               "<tr>" +
                                  "<td colspan='2' valign='top' style='font-family:Arial; font-size:12px;'>" +
                                     "El equipo de Logística le da la bienvenida al sistema de SIAQ. Los datos de acceso a la aplicación son los siguientes<br><br>" +
                                     "<table border='0px' cellpadding='0' cellspacing ='0' class='Text' style='height:100%; width:100%'>" +
                                        "<tr style='height:10px'><td></td></tr>" +
                                        "<tr>" +
                                           "<td style='text-align:left;'>" +
                                                 "<b>Usuario:</b>&nbsp;" + oENTUsuario.sEmail +
                                           "</td>" +
                                        "</tr>" +
                                        "<tr>" +
                                           "<td style='text-align:left;'>" +
                                                 "<b>Password:</b>&nbsp;" + sPassword +
                                           "</td>" +
                                        "</tr>" +
                                        "<tr>" +
                                           "<td style='font-family:Arial; font-size:12px; text-align:left;'>" +
                                                 "<br>Puede acceder al sistema haciendo click <a href='" + this.sApplicationURL + "'>aqui</a>" +
                                           "</td>" +
                                        "</tr>" +
                                        "<tr>" +
                                           "<td style='text-align:left;'>" +
                                              "<br><br>NOTA: Es recomendable que cambie su contraseña desde el menú Administración/Cambio de Contraseña." +
                                           "</td>" +
                                        "</tr>" +
                                        "<tr>" +
                                           "<td style='font-family:Arial; font-size:12px; text-align:left;'>" +
                                              "<br><br><br>Gracias por utilizar nuestros servicios informáticos" +
                                           "</td>" +
                                        "</tr>" +
                                        "<tr>" +
                                           "<td style='font-family:Arial; font-size:9px; text-align:center;'>" +
                                              "<br><br>Powered By SetUp" +
                                           "</td>" +
                                        "</tr>" +
                                     "</table>" +
                                  "</td>" +
                               "</tr>" +
                               "<tr style='height:20px'><td colspan='3'></td></tr>" +
                               "<tr style='height:20px'><td colspan='3'></td></tr>" +
                               "<tr style='height:1px'><td colspan='3' style='background:#000063 repeat-x;'></td></tr>" +
                               "<tr style='height:60px; vertical-align:top;'>" +
                                  "<td colspan='2' style='font-family:Arial; font-size:10px; color: #180A3B; text-align:justify; vertical-align:middle;'>" +
                                     "Este correo electronico es confidencial y/o puede contener informacion privilegiada. Si usted no es su destinatario o no es alguna persona autorizada por este para recibir sus correos electronicos, NO debera usted utilizar, copiar, revelar, o tomar ninguna accion basada en este correo electronico o cualquier otra informacion incluida en el, favor de notificar al remitente de inmediato mediante el reenvio de este correo electronico y borrar a continuacion totalmente este correo electronico y sus anexos.<br/><br/>Nota: Los acentos y caracteres especiales fueron omitidos para su correcta lectura en cualquier medio electronico.<br/>" +
                                  "</td>" +
                                  "<td></td>" +
                               "</tr>" +
                               "<tr><td colspan='3'></td></tr>" +
                            "</table>" +
                         "</div>" +
                      "</div>" +
                   "</body>" +
                "</html>";

                // Enviar correo
                gcMail.Send("SIAQ - Bienvenido al sistema", oENTUsuario.sEmail, "SIAQ - Bienvenido al sistema", sHTMLMessage);

            }catch (Exception ex){
                oENTResponse.ExceptionRaised(ex.Message);
            }

            // Resultado
            return oENTResponse;
        }
コード例 #15
0
ファイル: scatUsuario.aspx.cs プロジェクト: GCSoft/CEDHNL
        private void SelectUsuario_ForEdit(Int32 idUsuario)
        {
            ENTUsuario oENTUsuario = new ENTUsuario();
            ENTResponse oENTResponse = new ENTResponse();

            BPUsuario oBPUsuario = new BPUsuario();

            try
            {

                // Formulario
                oENTUsuario.idArea = 0;
                oENTUsuario.idRol = 0;
                oENTUsuario.idUsuario = idUsuario;
                oENTUsuario.sEmail = "";
                oENTUsuario.sNombre = "";
                oENTUsuario.tiActivo = 2;

                // Transacción
                oENTResponse = oBPUsuario.SelectUsuario(oENTUsuario);

                // Validaciones
                if (oENTResponse.GeneratesException) { throw (new Exception(oENTResponse.sErrorMessage)); }

                // Mensaje de la BD
                this.lblActionMessage.Text = oENTResponse.sMessage;

                // Llenado de formulario
                this.ddlActionArea.SelectedValue = oENTResponse.dsResponse.Tables[1].Rows[0]["idArea"].ToString();
                this.ddlSexo.SelectedValue = oENTResponse.dsResponse.Tables[1].Rows[0]["SexoId"].ToString();
                this.ddlActionRol.SelectedValue = oENTResponse.dsResponse.Tables[1].Rows[0]["idRol"].ToString();
                this.txtActionEmail.Text = oENTResponse.dsResponse.Tables[1].Rows[0]["sEmail"].ToString();
                this.txtActionNombre.Text = oENTResponse.dsResponse.Tables[1].Rows[0]["sNombre"].ToString();
                this.txtActionApellidoPaterno.Text = oENTResponse.dsResponse.Tables[1].Rows[0]["sApellidoPaterno"].ToString();
                this.txtActionApellidoMaterno.Text = oENTResponse.dsResponse.Tables[1].Rows[0]["sApellidoMaterno"].ToString();
                this.txtActionDescripcion.Text = oENTResponse.dsResponse.Tables[1].Rows[0]["sDescripcion"].ToString();
                this.ddlActionStatus.SelectedValue = oENTResponse.dsResponse.Tables[1].Rows[0]["tiActivo"].ToString();

            }catch (Exception ex){
                throw (ex);
            }
        }
コード例 #16
0
ファイル: scatUsuario.aspx.cs プロジェクト: GCSoft/CEDHNL
        private void UpdateUsuario(Int32 idUsuario)
        {
            ENTUsuario oENTUsuario = new ENTUsuario();
            ENTResponse oENTResponse = new ENTResponse();

            BPUsuario oBPUsuario = new BPUsuario();

            try
            {

                // Formulario
                oENTUsuario.idUsuario = idUsuario;
                oENTUsuario.idArea = Int32.Parse(this.ddlActionArea.SelectedValue);
                oENTUsuario.SexoId = Int32.Parse(this.ddlSexo.SelectedValue);
                oENTUsuario.idRol = Int32.Parse(this.ddlActionRol.SelectedValue);
                oENTUsuario.sApellidoMaterno = this.txtActionApellidoMaterno.Text.Trim();
                oENTUsuario.sApellidoPaterno = this.txtActionApellidoPaterno.Text.Trim();
                oENTUsuario.sDescripcion = this.txtActionDescripcion.Text.Trim();
                oENTUsuario.sEmail = this.txtActionEmail.Text.Trim();
                oENTUsuario.sNombre = this.txtActionNombre.Text.Trim();
                oENTUsuario.tiActivo = Int16.Parse(this.ddlActionStatus.SelectedValue);

                // Transacción
                oENTResponse = oBPUsuario.UpdateUsuario(oENTUsuario);

                // Validaciones
                if (oENTResponse.GeneratesException) { throw (new Exception(oENTResponse.sErrorMessage)); }
                if (oENTResponse.sMessage != "") { throw (new Exception(oENTResponse.sMessage)); }

                // Transacción exitosa
                ClearActionPanel();

                // Actualizar grid
                SelectUsuario();

                // Mensaje de usuario
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), Convert.ToString(Guid.NewGuid()), "alert('Información actualizada con éxito!'); focusControl('" + (this.ddlArea.Enabled ? this.ddlArea.ClientID : this.ddlRol.ClientID) + "');", true);

            }
            catch (Exception ex)
            {
                throw (ex);
            }
        }
コード例 #17
0
ファイル: DAUsuario.cs プロジェクト: GCSoft/CEDHNL
        ///<remarks>
        ///   <name>DAUsuario.SelectUsuario_RecuperaContrasena</name>
        ///   <create>21-Octubre-2013</create>
        ///   <author>GCSoft - Web Project Creator BETA 1.0</author>
        ///</remarks>
        ///<summary>Consulta el password de un usuario para enviarlo por correo a través del sistema</summary>
        ///<param name="oENTUsuario">Entidad de usuario con los parámetros necesarios para consultar la información</param>
        ///<param name="sConnection">Cadena de conexión a la base de datos</param>
        ///<param name="iAlternateDBTimeout">Valor en milisegundos del Timeout en la consulta a la base de datos. 0 si se desea el Timeout por default</param>
        ///<returns>Una entidad de respuesta</returns>
        public ENTResponse SelectUsuario_RecuperaContrasena(ENTUsuario oENTUsuario, String sConnection, Int32 iAlternateDBTimeout)
        {
            SqlConnection sqlCnn = new SqlConnection(sConnection);
            SqlCommand sqlCom;
            SqlParameter sqlPar;
            SqlDataAdapter sqlDA;

            ENTResponse oENTResponse = new ENTResponse();

            // Configuración de objetos
            sqlCom = new SqlCommand("uspcatUsuario_Sel_PasswordRecovery", sqlCnn);
            sqlCom.CommandType = CommandType.StoredProcedure;

            // Timeout alternativo en caso de ser solicitado
            if (iAlternateDBTimeout > 0) { sqlCom.CommandTimeout = iAlternateDBTimeout; }

            // Parametros
            sqlPar = new SqlParameter("sEmail", SqlDbType.VarChar);
            sqlPar.Value = oENTUsuario.sEmail;
            sqlCom.Parameters.Add(sqlPar);

            // Inicializaciones
            oENTResponse.dsResponse = new DataSet();
            sqlDA = new SqlDataAdapter(sqlCom);

            // Transacción
            try{
                sqlCnn.Open();
                sqlDA.Fill(oENTResponse.dsResponse);
                sqlCnn.Close();
            }catch (SqlException sqlEx){
                oENTResponse.ExceptionRaised(sqlEx.Message);
            }catch (Exception ex){
                oENTResponse.ExceptionRaised(ex.Message);
            }finally{
                if (sqlCnn.State == ConnectionState.Open) { sqlCnn.Close(); }
                sqlCnn.Dispose();
            }

            // Resultado
            return oENTResponse;
        }
コード例 #18
0
        // Runtinas del programador
        private void SelectUsuario_ParaFuncionario()
        {
            BPUsuario oBPUsuario = new BPUsuario();
            ENTUsuario oENTUsuario = new ENTUsuario();
            ENTResponse oENTResponse = new ENTResponse();

            // Limpiar mensajes anteriores
            this.lblMessage.Text = "";

            try
            {

                // Formulario
                oENTUsuario.idRol = 0;
                oENTUsuario.idArea = 0;
                oENTUsuario.sEmail = "";
                oENTUsuario.sNombre = this.txtNombre.Text.Trim();
                oENTUsuario.tiActivo = 1;

                // Transacción
                oENTResponse = oBPUsuario.SelectUsuario_ParaFuncionario(oENTUsuario);

                // Validaciones
                if (oENTResponse.GeneratesException) { throw (new Exception(oENTResponse.sErrorMessage)); }

                // Mensaje de la BD
                if (oENTResponse.sMessage != ""){
                    this.lblMessage.Text = oENTResponse.sMessage;
                    this.gvUsuario.DataSource = null;
                    this.gvUsuario.DataBind();
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), Convert.ToString(Guid.NewGuid()), "focusControl('" + this.txtNombre.ClientID + "');", true);
                    return;
                }

                // Llenado de contClientees
                this.gvUsuario.DataSource = oENTResponse.dsResponse.Tables[1];
                this.gvUsuario.DataBind();

                // Foco
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), Convert.ToString(Guid.NewGuid()), "focusControl('" + this.txtNombre.ClientID + "');", true);

            }catch (Exception ex){
                throw (ex);
            }
        }
コード例 #19
0
ファイル: DAUsuario.cs プロジェクト: GCSoft/CEDHNL
        ///<remarks>
        ///   <name>DAUsuario.InsertUsuario</name>
        ///   <create>21-Octubre-2013</create>
        ///   <author>GCSoft - Web Project Creator BETA 1.0</author>
        ///</remarks>
        ///<summary>Crea un nuevo Usuario</summary>
        ///<param name="oENTUsuario">Entidad de usuario con los parámetros necesarios para actualizar su información</param>
        ///<param name="sConnection">Cadena de conexión a la base de datos</param>
        ///<param name="iAlternateDBTimeout">Valor en milisegundos del Timeout en la consulta a la base de datos. 0 si se desea el Timeout por default</param>
        ///<returns>Una entidad de respuesta</returns>
        public ENTResponse InsertUsuario(ENTUsuario oENTUsuario, String sConnection, Int32 iAlternateDBTimeout)
        {
            SqlConnection sqlCnn = new SqlConnection(sConnection);
            SqlCommand sqlCom;
            SqlParameter sqlPar;
            SqlDataAdapter sqlDA;

            ENTResponse oENTResponse = new ENTResponse();

            // Configuración de objetos
            sqlCom = new SqlCommand("uspcatUsuario_Ins", sqlCnn);
            sqlCom.CommandType = CommandType.StoredProcedure;

            // Timeout alternativo en caso de ser solicitado
            if (iAlternateDBTimeout > 0) { sqlCom.CommandTimeout = iAlternateDBTimeout; }

            // Parametros
             sqlPar = new SqlParameter("idArea", SqlDbType.Int);
             sqlPar.Value = oENTUsuario.idArea;
             sqlCom.Parameters.Add(sqlPar);

            sqlPar = new SqlParameter("idRol", SqlDbType.Int);
            sqlPar.Value = oENTUsuario.idRol;
            sqlCom.Parameters.Add(sqlPar);

            sqlPar = new SqlParameter("SexoId", SqlDbType.Int);
            sqlPar.Value = oENTUsuario.SexoId;
            sqlCom.Parameters.Add(sqlPar);

            sqlPar = new SqlParameter("sApellidoMaterno", SqlDbType.VarChar);
            sqlPar.Value = oENTUsuario.sApellidoMaterno;
            sqlCom.Parameters.Add(sqlPar);

            sqlPar = new SqlParameter("sApellidoPaterno", SqlDbType.VarChar);
            sqlPar.Value = oENTUsuario.sApellidoPaterno;
            sqlCom.Parameters.Add(sqlPar);

            sqlPar = new SqlParameter("sDescripcion", SqlDbType.VarChar);
            sqlPar.Value = oENTUsuario.sDescripcion;
            sqlCom.Parameters.Add(sqlPar);

            sqlPar = new SqlParameter("sEmail", SqlDbType.VarChar);
            sqlPar.Value = oENTUsuario.sEmail;
            sqlCom.Parameters.Add(sqlPar);

            sqlPar = new SqlParameter("sNombre", SqlDbType.VarChar);
            sqlPar.Value = oENTUsuario.sNombre;
            sqlCom.Parameters.Add(sqlPar);

            sqlPar = new SqlParameter("sPassword", SqlDbType.VarChar);
            sqlPar.Value = oENTUsuario.sPassword;
            sqlCom.Parameters.Add(sqlPar);

             sqlPar = new SqlParameter("tiActivo", SqlDbType.TinyInt);
             sqlPar.Value = oENTUsuario.tiActivo;
             sqlCom.Parameters.Add(sqlPar);

            // Inicializaciones
            oENTResponse.dsResponse = new DataSet();
            sqlDA = new SqlDataAdapter(sqlCom);

            // Transacción
            try{
                sqlCnn.Open();
                sqlDA.Fill(oENTResponse.dsResponse);
                sqlCnn.Close();
            }catch (SqlException sqlEx){
                oENTResponse.ExceptionRaised(sqlEx.Message);
            }catch (Exception ex){
                oENTResponse.ExceptionRaised(ex.Message);
            }finally{
                if (sqlCnn.State == ConnectionState.Open) { sqlCnn.Close(); }
                sqlCnn.Dispose();
            }

            // Resultado
            return oENTResponse;
        }
コード例 #20
0
ファイル: vicClimaLaboral.aspx.cs プロジェクト: GCSoft/CEDHNL
        void SelectUsuario()
        {
            ENTUsuario oENTUsuario = new ENTUsuario();
            ENTResponse oENTResponse = new ENTResponse();

            BPUsuario oBPUsuario = new BPUsuario();

            try
            {

                // Formulario
                oENTUsuario.idRol = 0;
                oENTUsuario.idArea = 0;
                oENTUsuario.sEmail = "";
                oENTUsuario.sNombre = "";
                oENTUsuario.tiActivo = 1;

                // Transacción
                oENTResponse = oBPUsuario.SelectUsuario(oENTUsuario);

                // Errores y Warnings
                if (oENTResponse.GeneratesException) { throw (new Exception(oENTResponse.sErrorMessage)); }
                if (oENTResponse.sMessage != "") { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), Convert.ToString(Guid.NewGuid()), "alert('" + oENTResponse.sMessage + "');", true); }

                // Llenado de control
                this.ddlUsuario.DataTextField = "sFullName";
                this.ddlUsuario.DataValueField = "idUsuario";
                this.ddlUsuario.DataSource = oENTResponse.dsResponse.Tables[3];
                this.ddlUsuario.DataBind();

                // Opción todos
                this.ddlUsuario.Items.Insert(0, new ListItem("[Seleccione]", "0"));

            }catch (Exception ex){
                throw (ex);
            }
        }
コード例 #21
0
ファイル: BPUsuario.cs プロジェクト: GCSoft/CEDHNL
        ///<remarks>
        ///   <name>BPUsuario.selectUsuario_Autenticacion</name>
        ///   <create>21-Octubre-2013</create>
        ///   <author>GCSoft - Web Project Creator BETA 1.0</author>
        ///</remarks>
        ///<summary>Valida las credenciales de un usuario para verificar el acceso al sistema. Si las credenciales son válidas configura la sesión.</summary>
        ///<param name="oENTUsuario">Entidad de usuario con los parámetros necesarios para consultar la información</param>
        ///<returns>Una entidad de respuesta</returns>
        public ENTResponse SelectUsuario_Autenticacion(ENTUsuario oENTUsuario)
        {
            GCAuthentication gcAuthentication = new GCAuthentication();
            GCEncryption gcEncryption = new GCEncryption();

            DAUsuario oDAUsuario = new DAUsuario();
            ENTResponse oENTResponse = new ENTResponse();
            ENTSession oENTSession = new ENTSession();

            HttpContext oContext;

            try
            {

                // Encriptar el password
                oENTUsuario.sPassword = gcEncryption.EncryptString(oENTUsuario.sPassword, false);

                // Consulta a base de datos
                oENTResponse = oDAUsuario.SelectUsuario_Autenticacion(oENTUsuario, this.sConnectionApplication, 0);

                // Validación de error en consulta
                if (oENTResponse.GeneratesException) { return oENTResponse; }

                // Validación de mensajes de la BD
                oENTResponse.sMessage = oENTResponse.dsResponse.Tables[0].Rows[0]["sResponse"].ToString();
                if (oENTResponse.sMessage != "") { return oENTResponse; }

                // Configurar de entidad de sesión
                oENTSession.idUsuario = int.Parse(oENTResponse.dsResponse.Tables[1].Rows[0]["idUsuario"].ToString());
                oENTSession.FuncionarioId = int.Parse(oENTResponse.dsResponse.Tables[1].Rows[0]["FuncionarioId"].ToString());
                oENTSession.idArea = int.Parse(oENTResponse.dsResponse.Tables[1].Rows[0]["idArea"].ToString());
                oENTSession.idRol = int.Parse(oENTResponse.dsResponse.Tables[1].Rows[0]["idRol"].ToString());
                oENTSession.sEmail = oENTUsuario.sEmail;
                oENTSession.sNombre = oENTResponse.dsResponse.Tables[1].Rows[0]["sNombre"].ToString();
                oENTSession.tblSubMenu = oENTResponse.dsResponse.Tables[2];
                oENTSession.tblMenu = oENTResponse.dsResponse.Tables[3];

                // Autenticar el usuario
                gcAuthentication.AuthenticateUser(oENTSession.sEmail, this.iSessionTimeout);
                oENTSession.TokenGenerado = true;

                // Variable de sesión con los datos del usuario
                oContext = HttpContext.Current;
                oContext.Session["oENTSession"] = oENTSession;

            }catch (Exception ex){
                oENTResponse.ExceptionRaised(ex.Message);
            }

            // Resultado
            return oENTResponse;
        }