コード例 #1
0
        private void btnConsultar_Click(object sender, EventArgs e)
        {
            String condiciones = "";

            if (!chkTodos.Checked)
            {
                // Validar si el combo 'Perfiles' esta seleccionado.

                /*if (cboPerfil.Text != string.Empty)
                 * {
                 *  condiciones += " AND u.perfil=" + cboPerfil.SelectedValue.ToString();
                 *
                 * }**/

                // Validar si el textBox 'Nombre' esta vacio.
                if (txtNombre.Text != string.Empty)
                {
                    condiciones += "AND nombre=" + "'" + txtNombre.Text + "'";
                }

                if (condiciones != "")
                {
                    grdPerfiles.DataSource = oPerfilService.ObtenerConFiltros(condiciones);
                }

                else
                {
                    MessageBox.Show("Debe ingresar al menos un criterio", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }
            else
            {
                grdPerfiles.DataSource = oPerfilService.ObtenerTodos();
            }
        }
コード例 #2
0
        private void btnConsultar_Click(object sender, EventArgs e)
        {
            String condiciones = "";
            var    filters     = new Dictionary <string, object>();

            if (!chkTodas.Checked)//si el checkbox no esta marcado...
            {
                if (txtNombre.Text != string.Empty)
                {
                    // Si el textBox tiene un texto no vacìo entonces recuperamos el valor del texto
                    filters.Add("perfil", txtNombre.Text);
                    //condiciones += "AND u.usuario=" + "'" + txtNombre.Text + "'";

                    condiciones += " AND (nombre LIKE '%" + txtNombre.Text + "%') ";

                    // strSql += " AND (u.usuario LIKE '%' + @usuario + '%') ";
                }

                if (filters.Count > 0)
                {
                    //SIN PARAMETROS
                    dgvMarcas.DataSource = oPerfilService.ConsultarConFiltros(condiciones);
                }


                else
                {
                    MessageBox.Show("Debe ingresar una Perfil", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }
            else
            {
                dgvMarcas.DataSource = oPerfilService.ObtenerTodos();
            }
        }
コード例 #3
0
 private void frmReporteUsuarios_Load(object sender, EventArgs e)
 {
     // TODO: esta línea de código carga datos en la tabla 'datosReporteUsuarios.DatosUsuario' Puede moverla o quitarla según sea necesario.
     this.datosUsuarioTableAdapter.Fill(this.datosReporteUsuarios.DatosUsuario);
     // TODO: esta línea de código carga datos en la tabla 'datosReporteUsuarios.DatosUsuario' Puede moverla o quitarla según sea necesario.
     this.datosUsuarioTableAdapter.Fill(this.datosReporteUsuarios.DatosUsuario);
     // TODO: esta línea de código carga datos en la tabla 'datosReporteUsuarios.DatosUsuario' Puede moverla o quitarla según sea necesario.
     //this.datosUsuarioTableAdapter.Fill(this.datosReporteUsuarios.DatosUsuario);
     this.CenterToParent();
     this.cargarCombo(cboUsuario, oUsuarioService.ObtenerTodos(), "NombreUsuario", "IdUsuario");
     this.cargarCombo(cboPerfiles, oPerfilService.ObtenerTodos(), "Nombre", "IdPerfil");
 }
コード例 #4
0
        private void btnConsultar_Click(object sender, EventArgs e)
        {
            String condiciones = "";

            var filters = new Dictionary <string, object>();

            if (!chkTodos.Checked)
            {
                // Validar si el textBox 'Nombre' esta vacio.
                if (cboNombre.Text != string.Empty)
                {
                    // Si el textBox tiene un texto no vacìo entonces recuperamos el valor del texto
                    filters.Add("p.nombre", cboNombre.Text);
                    condiciones += " AND p.nombre LIKE " + "'%" + cboNombre.Text + "%'";
                }

                if (filters.Count > 0)
                {
                    //si agrego alguna condicion
                    //SIN PARAMETROS

                    MessageBox.Show("condiciones para el where del sql " + condiciones, "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);

                    dgvPerfiles.DataSource = oPerfilService.ConsultarConFiltrosSinParametros(condiciones);

                    //CON PARAMETROS
                    //dgvPerfil.DataSource = oCursoService.ConsultarConFiltrosConParametros(filters);
                }
                else
                {
                    MessageBox.Show("Debe ingresar al menos un dato.", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }
            else
            {
                //selecciono el checkbox(todos)
                dgvPerfiles.DataSource = oPerfilService.ObtenerTodos();
                habilitar();
            }
        }
コード例 #5
0
        private void frmABMUsuario_Load(object sender, EventArgs e)
        {
            LlenarCombo(cboPerfil, oPerfilService.ObtenerTodos(), "Nombre", "IdPerfil");
            switch (formMode)
            {
            case FormMode.insert:
            {
                this.Text = "Nuevo Usuario";
                break;
            }

            case FormMode.update:
            {
                this.Text = "Actualizar Usuario";
                // Recuperar usuario seleccionado en la grilla
                MostrarDatos();
                txtNombre.Enabled        = true;
                txtEmail.Enabled         = true;
                txtEmail.Enabled         = true;
                txtPassword.Enabled      = true;
                txtConfirmarPass.Enabled = true;
                cboPerfil.Enabled        = true;
                break;
            }

            case FormMode.delete:
            {
                MostrarDatos();
                this.Text                = "Habilitar/Deshabilitar Usuario";
                txtNombre.Enabled        = false;
                txtEmail.Enabled         = false;
                txtEmail.Enabled         = false;
                txtPassword.Enabled      = false;
                cboPerfil.Enabled        = false;
                txtConfirmarPass.Enabled = false;
                break;
            }
            }
        }
コード例 #6
0
        private void frmABMUsuario_Load(System.Object sender, System.EventArgs e)
        {
            LlenarCombo(cboPerfil, oPerfilService.ObtenerTodos(), "Nombre", "IdPerfil");
            switch (formMode)
            {
            case FormMode.nuevo:
            {
                this.Text = "Nuevo Usuario";
                break;
            }

            case FormMode.actualizar:
            {
                this.Text = "Actualizar Usuario";
                // Recuperar usuario seleccionado en la grilla
                MostrarDatos();
                txtNombre.Enabled        = true;
                txtEmail.Enabled         = true;
                txtEmail.Enabled         = true;
                txtPassword.Enabled      = true;
                txtConfirmarPass.Enabled = true;
                cboPerfil.Enabled        = true;
                break;
            }

            case FormMode.eliminar:
            {
                MostrarDatos();
                this.Text                = "Eliminar Usuario";
                txtNombre.Enabled        = false;
                txtEmail.Enabled         = false;
                txtEmail.Enabled         = false;
                txtPassword.Enabled      = false;
                cboPerfil.Enabled        = false;
                txtConfirmarPass.Enabled = false;
                break;
            }
            }
        }
 private void frmUsuarios_Load(object sender, EventArgs e)
 {
     LlenarCombo(cboPerfiles, oPerfilService.ObtenerTodos(), "Nombre", "IdPerfil");
     this.CenterToParent();
 }
コード例 #8
0
 private void FrmPerfiles_Load(object sender, EventArgs e)
 {
     this.CenterToParent();
     dgvPerf.DataSource = oPerfilService.ObtenerTodos();
 }