Example #1
0
        private void btnBuscar_Click(object sender, EventArgs e)
        {
            dgvCategorias.Rows.Clear();
            btnEditar.Enabled   = false;
            btnEliminar.Enabled = false;

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

            if (chbBuscarTodos.Checked)
            {
                IList <Categorias> lst = servicio.GetCategoriasConBorrado(txtNombre.Text);

                foreach (Categorias obj in lst)
                {
                    dgvCategorias.Rows.Add(new object[] { obj.Id_Categoria, obj.Nombre, obj.Descripcion, obj.Borrado });
                    if (obj.Borrado == true)
                    {
                        dgvCategorias.Rows[dgvCategorias.RowCount - 1].DefaultCellStyle.ForeColor          = Color.Red;
                        dgvCategorias.Rows[dgvCategorias.RowCount - 1].DefaultCellStyle.SelectionForeColor = Color.Red;
                    }
                }
            }
            else
            {
                IList <Categorias> lst = servicio.GetCategoriasSinBorrado(txtNombre.Text);

                foreach (Categorias obj in lst)
                {
                    dgvCategorias.Rows.Add(new object[] { obj.Id_Categoria, obj.Nombre, obj.Descripcion, obj.Borrado });
                }
            }
            lblCantEncontrado.Visible = true;
            lblCantEncontrado.Text    = "Categorías encontradas = " + dgvCategorias.Rows.Count;
        }
Example #2
0
        private void FrmAbmcCursos_Load(object sender, EventArgs e)
        {
            switch (formMode)
            {
            case FormMode.nuevo:
            {
                this.Text = "Nueva Curso";
                LlenarCombo(cmbCategoria, oCategoriasServices.GetCategoriasSinBorrado(""), "nombre", "id_categoria");
                break;
            }

            case FormMode.actualizar:
            {
                LlenarCombo(cmbCategoria, oCategoriasServices.GetCategoriasSinBorrado(""), "nombre", "id_categoria");
                this.Text = "Actualizar Curso";
                MostrarDatos();
                txtNombre.Enabled      = true;
                txtDescripcion.Enabled = true;
                dtpVigencia.Enabled    = true;
                cmbCategoria.Enabled   = true;
                break;
            }

            case FormMode.eliminar:
            {
                LlenarCombo(cmbCategoria, oCategoriasServices.GetCategoriasSinBorrado(""), "nombre", "id_categoria");
                this.Text = "Actualizar Curso";
                MostrarDatos();
                txtNombre.Enabled      = false;
                txtDescripcion.Enabled = false;
                dtpVigencia.Enabled    = false;
                cmbCategoria.Enabled   = false;
                btnAceptar.Text        = "Eliminar";
                break;
            }
            }
        }
Example #3
0
        private void FrmReporteCursos_Load(object sender, EventArgs e)
        {
            LlenarCombo(cmbCategoria, oCategoriasServices.GetCategoriasSinBorrado(""), "nombre", "id_categoria");

            this.reportViewer1.RefreshReport();
        }