private void Guardarbutton_Click(object sender, EventArgs e)
        {
            MyErrorProvider.Clear();
            Instituciones instituciones;

            if (!Validar())
            {
                return;
            }

            if (InstitucionesBLL.ExisteInstitucion(NombretextBox.Text))
            {
                MyErrorProvider.SetError(NombretextBox, "Esta institución ya existe en la base de datos");
                NombretextBox.Focus();
            }

            instituciones = LlenarClase();

            var paso = InstitucionesBLL.Guardar(instituciones);

            if (paso)
            {
                Limpiar();
                MessageBox.Show("Transaccion Exitosa", "Exito", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("Transaccion Fallida", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void Eliminarbutton_Click(object sender, EventArgs e)
        {
            MyErrorProvider.Clear();
            int id;

            int.TryParse(InstitucionIdNumericUpDown.Text, out id);

            if (InstitucionIdNumericUpDown.Value == 0)
            {
                MessageBox.Show("Debes agregar un id valido para poder eliminarlo.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if (!InstitucionesBLL.Existe(id))
            {
                MessageBox.Show("Institucion Inexistente!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                if (MessageBox.Show("Deseas eliminar esta institucion?", "Validar", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    if (InstitucionesBLL.Eliminar(id))
                    {
                        MessageBox.Show("Transaccion Exitosa", "Exito", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        Limpiar();
                    }
                }
            }
        }
Пример #3
0
        private void rPasantes_Load(object sender, EventArgs e)
        {
            InstitucionComboBox.DataSource    = InstitucionesBLL.GetInstituciones();
            InstitucionComboBox.DisplayMember = "Nombre";
            InstitucionComboBox.ValueMember   = "InstitucionId";

            HabilidadComboBox.DataSource    = HabilidadesBLL.GetHabilidades();
            HabilidadComboBox.DisplayMember = "Nombre";
            HabilidadComboBox.ValueMember   = "HabilidadId";
        }
        private void BuscarButton_Click(object sender, EventArgs e)
        {
            var listado = new List <Instituciones>();

            if (!string.IsNullOrEmpty(InformacionTextBox.Text))
            {
                switch (FiltroComboBox.SelectedIndex)
                {
                case 0:
                    listado = InstitucionesBLL.GetList(e => e.InstitucionId == int.Parse(InformacionTextBox.Text));
                    break;

                case 1:
                    listado = InstitucionesBLL.GetList(e => e.Nombre.Contains(InformacionTextBox.Text));
                    break;

                case 2:
                    listado = InstitucionesBLL.GetList(e => e.Region.Contains(InformacionTextBox.Text));
                    break;
                }
            }
            else
            {
                listado = InstitucionesBLL.GetList(c => true);
            }

            if (FiltroCheckBox.Checked == true)
            {
                listado = InstitucionesBLL.GetList(e => e.Fecha.Date >= FechaDesdeDateTimePicker.Value.Date && e.Fecha.Date <= FechaHastaDateTimePicker.Value.Date);
            }

            if (ActivoRadioButton.Checked == true)
            {
                listado = InstitucionesBLL.GetList(e => e.Activo == true);
            }

            if (InactivoRadioButton.Checked == true)
            {
                listado = InstitucionesBLL.GetList(e => e.Activo == false);
            }


            InstitucionesDataGridView.DataSource = null;
            InstitucionesDataGridView.DataSource = listado;
        }
        private void Buscarbutton_Click(object sender, EventArgs e)
        {
            MyErrorProvider.Clear();
            int           id;
            Instituciones instituciones = new Instituciones();

            int.TryParse(InstitucionIdNumericUpDown.Text, out id);

            Limpiar();

            instituciones = InstitucionesBLL.Buscar(id);

            if (instituciones != null)
            {
                LlenarCampos(instituciones);
            }
            else
            {
                MessageBox.Show("Institución no Encontrada", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }