상속: BPBase
예제 #1
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);
            }
        }
예제 #2
0
        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);
            }
        }
예제 #3
0
        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);
            }
        }
예제 #4
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);
            }
        }
예제 #5
0
        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);
            }
        }
예제 #6
0
        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);
            }
        }
예제 #7
0
        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);
            }
        }
예제 #8
0
        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);
            }
        }
예제 #9
0
        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);
            }
        }
예제 #10
0
        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);
            }
        }
예제 #11
0
        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);
            }
        }