private void btnAgregar_Click(object sender, EventArgs e) { if (txtID.Text.Length > 0 && txtNombre.Text.Length > 0 && txtPrimerApellido.Text.Length > 0 && txtSegundoApellido.Text.Length > 0 && txtCorreo.Text.Length > 0 && cbxDepartamento.Text.Length > 0 && picfoto.Image != null) { EmpleadoBLL oEmpleadoBLL = new EmpleadoBLL(); EmpleadoDAL oEmpleadoDAL = new EmpleadoDAL(); oEmpleadoBLL = RecuperarInformacion(); dgvEmpleados.DataSource = null; if (oEmpleadoDAL.Agregar(oEmpleadoBLL)) { dgvEmpleados.DataSource = oEmpleadoDAL.CargarDataGridView(); if (dgvEmpleados.Rows.Count > 0) { actualizarBotones(true, true); } MessageBox.Show("El registro se agregó correctamente", "Alerta", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("ERROR\nEl registro no se puede agregar", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("ERROR\nEl registro no se puede agregar,\nel campo 'ID' o 'Departamento' está vacío", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void TestInsertar() { Empleado empleado = new Empleado(); empleado.Nombre = "Mascorro"; empleado.Apelldo_p = "Alex"; empleado.Apellido_m = "ga"; empleado.Fecha_registro = "2019-04-06"; empleado.RFC = "15646481"; empleado.NSS = "54511515"; Assert.AreEqual(EmpleadoDAL.Agregar(empleado), 1); }
public static void Agregar(Empleado proy) { obj.Agregar(proy); }
public static void Agregar(Empleado empleado) { obj.Agregar(empleado); }