Example #1
0
        private void Buscarbutton_Click_1(object sender, EventArgs e)
        {
            int id;
            RepositorioBase <TipoVacante> repositorioBase = new RepositorioBase <TipoVacante>();
            TipoVacante tipoVacante = new TipoVacante();

            int.TryParse(IdnumericUpDown.Text, out id);
            controla = id;
            Limpiar();
            try
            {
                tipoVacante = repositorioBase.Buscar(id);
                if (tipoVacante != null)
                {
                    MessageBox.Show("Vacante encontrada");
                    LlenarCampo(tipoVacante);
                }
                else
                {
                    MessageBox.Show("Vacante no encontrada");
                }
            }
            catch (Exception)
            {
                MessageBox.Show("No existe la vacante");
            }
        }
Example #2
0
        public TipoVacante LlenarClase()
        {
            TipoVacante tipoVacante = new TipoVacante();

            tipoVacante.TipoVacanteId     = (int)IdnumericUpDown.Value;
            tipoVacante.NombreTipoVacante = NombreVacantetextBox.Text;
            tipoVacante.FechaCreacion     = FechaCreaciondateTimePicker.Value;
            return(tipoVacante);
        }
        public void Modificar1()
        {
            RepositorioBase <TipoVacante> repositorioBase = new RepositorioBase <TipoVacante>();
            TipoVacante tipoVacante = new TipoVacante();

            tipoVacante.TipoVacanteId     = 1;
            tipoVacante.NombreTipoVacante = "Vacantes";
            tipoVacante.FechaCreacion     = DateTime.Now;
            Assert.IsTrue(repositorioBase.Modificar(tipoVacante));
        }
        public void TestMethod1()
        {
            RepositorioBase <TipoVacante> repositorioBase = new RepositorioBase <TipoVacante>();
            TipoVacante tipoVacante = new TipoVacante();

            tipoVacante.TipoVacanteId     = 1;
            tipoVacante.NombreTipoVacante = "Vacante";
            tipoVacante.FechaCreacion     = DateTime.Now;
            Assert.IsTrue(repositorioBase.Guardar(tipoVacante));
        }
Example #5
0
        private void GuardarButton_Click(object sender, EventArgs e)
        {
            RepositorioBase <TipoVacante> repositorio = new RepositorioBase <TipoVacante>();
            bool paso = false;

            if (!Validar())
            {
                return;
            }

            TipoVacante tipoVacante = LlenarClase();

            if (IdnumericUpDown.Value == 0)
            {
                if (!NoRepetidos())
                {
                    return;
                }
                paso = repositorio.Guardar(tipoVacante);
            }
            else if (IdnumericUpDown.Value != controla)
            {
                MessageBox.Show("Se ha cambiado el id");
                return;
            }
            else
            {
                paso = repositorio.Modificar(tipoVacante);
            }
            if (paso)
            {
                MessageBox.Show("Guardado", "Informacion", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("No se pudo guardar", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            Limpiar();
        }
Example #6
0
 private void LlenarCampo(TipoVacante tipovacante)
 {
     IdnumericUpDown.Value             = tipovacante.TipoVacanteId;
     NombreVacantetextBox.Text         = tipovacante.NombreTipoVacante;
     FechaCreaciondateTimePicker.Value = tipovacante.FechaCreacion;
 }