public void BuscarTest() { EstudianteBLL <Estudiante> estudiante = new EstudianteBLL <Estudiante>(); Estudiante e = EstudianteBLL.Buscar(1); Assert.IsNotNull(e); }
private void Eliminarbutton2_Click(object sender, EventArgs e) { int Id; int.TryParse(IDnumericUpDown1.Value.ToString(), out Id); try { if (EstudianteBLL.Buscar(Id) != null) { if (EstudianteBLL.Eliminar(Id)) { MessageBox.Show("Eliminada Correctamente", "Eliminada", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { MessageBox.Show("No se puede eliminar porque no existe", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch (Exception) { throw; } }
public void GetLisTest() { var listado = new List <Estudiantes>(); listado = EstudianteBLL.GetList(p => true); Assert.AreEqual(listado, listado); }
public void GuardarTest() { int id = CursoBLL.Buscar(3).CursoId; if (id != 3) { Assert.Fail(); } Estudiante estudiante = new Estudiante() { Nombre = "Felipe", Matricula = "2016-0580", CursoId = id }; Estudiante estudiante2 = new Estudiante() { Nombre = "Felipe", Matricula = "2016-0580", CursoId = id }; bool paso = EstudianteBLL.Guardar(estudiante); EstudianteBLL.Guardar(estudiante2); Assert.AreEqual(true, paso); }
private void Buscarbutton1_Click(object sender, EventArgs e) { int id; int.TryParse(IDnumericUpDown1.Text, out id); Limpiar(); try { Estudiantes estudiante = EstudianteBLL.Buscar(id); if (estudiante != null) { LlenarCampo(estudiante); } else { MessageBox.Show("Evaluacion no encontrada.", "error", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception) { throw; } }
public void BuscarTest() { Estudiante e; e = EstudianteBLL.Buscar(2); Assert.AreEqual(e, e); }
private void btnGuargar_Click(object sender, EventArgs e) { bool paso = false; Estudiante estudiante = new Estudiante(); if (GuardarValidar()) { estudiante = LlenaEstudiante(); if (EstudianteIdNumericUpDown.Value == 0) { paso = EstudianteBLL.Guardar(estudiante); } else { if (Existe(estudiante.EstudianteId)) { paso = EstudianteBLL.Modificar(estudiante); } } if (paso) { if (EstudianteIdNumericUpDown.Value == 0) { MessageBox.Show("Registro Guardado!", "Exito", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Registro Modificado!", "Exito", MessageBoxButtons.OK, MessageBoxIcon.Information); } } LimpiarCampos(); } }
public void EliminarTest() { bool paso = false; paso = EstudianteBLL.Eliminar(5); Assert.AreEqual(paso, true); }
public void GuardarTest() { bool paso; Inscripciones inscripciones = new Inscripciones(); Estudiantes estudiantes = new Estudiantes(); estudiantes = EstudianteBLL.Buscar(1); decimal BalanceInicial = estudiantes.EstudianteBalance; decimal BalanceEsperado = BalanceInicial + 3000; inscripciones.InscripcionId = 0; inscripciones.EstudianteId = 1; inscripciones.Fecha = DateTime.Now; inscripciones.Comentario = "Usted lo hizo bien"; inscripciones.Monto = 4000; inscripciones.InscripcionBalance = 1000; paso = InscripcionBLL.Guardar(inscripciones); decimal BalancePrueba = InscripcionBLL.Buscar(inscripciones.EstudianteId).InscripcionBalance; if (BalanceEsperado == BalancePrueba) { paso = true; } Assert.AreEqual(paso, true); }
private void Buscarbutton_Click(object sender, EventArgs e) { Expression <Func <Estudiante, bool> > filtro = a => true; int id; if (FiltroComboBox.SelectedIndex == 1) { CriterioTextBox.ReadOnly = false; if (String.IsNullOrWhiteSpace(CriterioTextBox.Text)) { MyErrorProvider.SetError(CriterioTextBox, "No puede estar vacio"); return; } switch (FiltroComboBox.SelectedIndex) { case 0: //Todo. break; case 1: //Id. id = Convert.ToInt32(CriterioTextBox.Text); filtro = a => a.EstudianteId == id; break; } } EstudianteConsultaDataGridView.DataSource = EstudianteBLL.GetList(filtro); }
private void btnEliminar_Click(object sender, EventArgs e) { bool paso = false; Estudiante estudiante = new Estudiante(); int valor = (int)EstudianteIdNumericUpDown.Value; if (valor > 0) { estudiante = EstudianteBLL.Buscar(valor); if (estudiante != null) { paso = EstudianteBLL.Eliminar(valor); } if (paso) { MessageBox.Show("Estudiante: " + estudiante.Nombre + " Eliminado Correctamente", "Exito", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Error al intentar eliminar", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("Introduzca el id", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
public void ModificarTest() { Estudiante estudiante = new Estudiante(8, "Manuele", "Perez", "20170615", "825947852", "ggt/25", "stn6♦gmail.com", DateTime.Now, 1, null); bool paso = EstudianteBLL.Guardar(estudiante); Assert.AreEqual(paso, true); }
public void GetListTest() { List <Estudiante> lista = new List <Estudiante>(); lista = EstudianteBLL.GetList(l => true); Assert.IsNotNull(lista); }
private void btnBuscar_Click(object sender, EventArgs e) { tsbMod.Enabled = true; string cedula = txtCedBusqueda.Text.ToString(); EstudianteBLL estBll = new EstudianteBLL(); Estudiante estudiante = estBll.buscarEstudianteCed(cedula); tsbElim.Enabled = true; txtCédula.Text = estudiante.cedula; txtNombre.Text = estudiante.nombre; txtPriAp.Text = estudiante.primerApellido; txtFechNac.Text = estudiante.fechaNacimiento.ToString("dd/MM/yyyy"); txtExpedCed.Text = estudiante.fechaExped.ToString("dd/MM/yyyy");; txtExpirCed.Text = estudiante.fechaVenc.ToString("dd/MM/yyyy");; cboNac.SelectedIndex = estudiante.idNacionalidad; txtSegAp.Text = estudiante.segundoApellido; if (estudiante.genero.Equals("F")) { rdbFem.Select(); } else { rdbMasc.Select(); } habilitarTodo(); }
private void ___GuardaButton__Click(object sender, RoutedEventArgs e) { Estudiantes persona; bool paso = false; if (!Validar()) { return; } persona = LlenaClase(); if (Convert.ToInt32(EstudianteIDTex.Text) == 0) { paso = EstudianteBLL.Guardar(persona); } else { if (!ExisteEnLaBaseDeDatos()) { MessageBox.Show("No se puede modificar una persona que no existe", "Fallo", MessageBoxButton.OK, MessageBoxImage.Error); return; } paso = EstudianteBLL.Modificar(persona); } if (paso) { Limpiar(); MessageBox.Show("Guardado!", "Exito", MessageBoxButton.OK, MessageBoxImage.Information); } else { MessageBox.Show("No fue posible guardar!!", "Fallo", MessageBoxButton.OK, MessageBoxImage.Error); } }
private Pagos LlenarCampos() { int Id = 0; Id = Decimal.ToInt32(IDnumericUpDownP.Value); Pagos pago = PagosBLL.Buscar(Id); if (pago == null) { MessageBox.Show("No se encontro el pago"); } else { FechaTimePickerP.Text = pago.Fecha; IdEstudiantesnumericUpDownP.Value = pago.IdEstudiante; MontotextBox.Text = Convert.ToString(pago.Monto); PagotextBoxP.Text = Convert.ToString(pago.Pago); BalancetextBox.Text = Convert.ToString(pago.Balance); ObservacionestextBoxP.Text = pago.Observaciones; Estudiantes estudiantes = EstudianteBLL.Buscar(pago.IdEstudiante); Nombrelabel.Text = estudiantes.Nombres; } return(pago); }
private void toolStripButton3_Click(object sender, EventArgs e) { deshabilitarTodo(); habilitarBusqueda(); tsbInsertar.Enabled = false; tsbMod.Enabled = false; string cedula = txtCédula.Text.ToString(); if (cedula.Length > 0 && MessageBox.Show("Esta seguro de desear eliminar este estudiante de forma permanente?", "Confirmar Eliminación de Estudiante", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == System.Windows.Forms.DialogResult.Yes) { EstudianteBLL estBLL = new EstudianteBLL(); try { int resultado = estBLL.eliminarEstudiante(cedula); if (resultado == 1) { MessageBox.Show("Estudiante eliminado con exito", "Estudiante Eliminado", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception ex) { MessageBox.Show("Error al eliminar estudiante" + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("Debe buscar un estudiante para eliminar", "Estudiante Invalido", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
public void ModificarTest() { bool paso; Inscripciones inscripciones = new Inscripciones(); Estudiantes p = new Estudiantes(); p = EstudianteBLL.Buscar(1); decimal BalanceInicial = p.EstudianteBalance; decimal BalanceEsperado = BalanceInicial - 1000; inscripciones.InscripcionId = 1; inscripciones.EstudianteId = 1; inscripciones.Fecha = DateTime.Now; inscripciones.Comentario = "El paso se realizo con Exito"; inscripciones.Monto = 3000; inscripciones.InscripcionBalance = 1000; paso = InscripcionBLL.Modificar(inscripciones); decimal BalancePrueba = InscripcionBLL.Buscar(inscripciones.EstudianteId).InscripcionBalance; if (BalanceEsperado == BalancePrueba) { paso = true; } Assert.AreEqual(paso, true); }
private void EliminarButton_Click(object sender, EventArgs e) { MyError.Clear(); int id; id = Convert.ToInt32(IDnumericUpDown.Value); LimpiarCampos(); if (IdentificarInscripcion(id) == true) { MessageBox.Show("No se puede eliminar este Estudiante porque tiene una inscripción creada.", "Información", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { if (EstudianteBLL.Eliminar(id)) { MessageBox.Show("Estudiante Eliminado", "Exito", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("No se puede eliminar, porque no existe."); } } }
public void BuscarTest() { Estudiantes Estudiante = new Estudiantes(); Estudiante = EstudianteBLL.Buscar(5); Assert.Fail(); }
public void EliminarTest() { EstudianteBLL <Estudiante> estudiante = new EstudianteBLL <Estudiante>(); bool estado = false; estado = EstudianteBLL.Eliminar(1); Assert.AreEqual(true, estado); }
public void BuscarTest() { Estudiantes estudiantes; estudiantes = EstudianteBLL.Buscar(2); Assert.AreEqual(estudiantes, estudiantes); }
public void BuscarTest() { Estudiantes estu = new Estudiantes(); estu = EstudianteBLL.Buscar(1); Assert.AreEqual(estu, estu); }
private void Consultarbutton_Click(object sender, EventArgs e) { Expression <Func <Estudiante, bool> > filtro = a => true; int id; switch (FiltrocomboBox.SelectedIndex) { case 0: /// todos break; case 1: // por id id = Convert.ToInt32(CriteriotextBox.Text); filtro = a => a.EstudianteId == id; break; case 2: // por nombre filtro = a => a.Nombres.Contains(CriteriotextBox.Text); break; case 3: // por Apellidos filtro = a => a.Apellidos.Contains(CriteriotextBox.Text); break; case 4: // por matricula filtro = a => a.Matricula.Contains(CriteriotextBox.Text); break; case 5: // por Telefono filtro = a => a.Celular.Contains(CriteriotextBox.Text); break; case 6: // por Email filtro = a => a.Email.Contains(CriteriotextBox.Text); break; case 7: // por direccion filtro = a => a.Direccion.Contains(CriteriotextBox.Text); break; ///FECHA case 8: filtro = a => a.FechaInsercion >= Desde_dateTimePicker.Value.Date && a.FechaInsercion <= Hasta_dateTimePicker.Value.Date; break; } Est = EstudianteBLL.GetList(filtro); Consulta_dataGridView.DataSource = EstudianteBLL.GetList(filtro); Consulta_dataGridView.ReadOnly = true; }
public void GetListTest() { List <Estudiante> lista = new List <Estudiante>(); lista = EstudianteBLL.GetList(x => true); bool paso = lista.Count() > 0; Assert.AreEqual(true, paso); }
private void cargarNanacionalidades() { EstudianteBLL estuBLL = new EstudianteBLL(); DataTable nacionalides = estuBLL.cargarNacionalidades(); cboNac.DataSource = nacionalides; cboNac.ValueMember = Convert.ToString("idNacionalidad"); cboNac.DisplayMember = "descripcion"; }
public void EliminarTest() { int id = 1; bool paso; Contexto db = new Contexto(); paso = EstudianteBLL.Eliminar(id); Assert.AreEqual(paso, true); }
private void BuscarEbuttonP_Click(object sender, EventArgs e) { Estudiantes estudiantes = EstudianteBLL.Buscar(int.Parse(IdEstudiantesnumericUpDownP.Value.ToString())); if (estudiantes != null) { Nombrelabel.Text = estudiantes.Nombres; } }
private void btnGuardar_Click(object sender, EventArgs e) { if (this.ValidateChildren()) { char genero = 'n'; Estudiante est = new Estudiante(); est.cedula = txtCédula.Text.ToString(); est.nombre = txtNombre.Text.ToString(); est.primerApellido = txtPriAp.Text.ToString(); est.segundoApellido = txtSegAp.Text.ToString(); est.idNacionalidad = Convert.ToInt32(cboNac.SelectedValue.ToString()); foreach (Control control in pnlGen.Controls) { RadioButton radio = control as RadioButton; if (radio.Checked) { genero = Convert.ToChar(radio.Text.ToString()); } } est.genero = genero; est.fechaNacimiento = DateTime.ParseExact(txtFechNac.Text.ToString(), "d", null); est.fechaExped = DateTime.ParseExact(txtExpedCed.Text.ToString(), "d", null); est.fechaVenc = DateTime.ParseExact(txtExpirCed.Text.ToString(), "d", null); try { EstudianteBLL estuBLL = new EstudianteBLL(); estuBLL.guardarEstudiante(est); MessageBox.Show("Estudiante registrado exitosamete", "Estudiante Guardado", MessageBoxButtons.OK, MessageBoxIcon.Information); this.txtFechNac.Clear(); txtCedBusqueda.Clear(); txtCédula.Clear(); txtEXP.Clear(); txtExpCed.Clear(); txtExpirCed.Clear(); txtFechNac.Clear(); txtNombre.Clear(); txtSegAp.Clear(); txtPriAp.Clear(); txtExpedCed.Clear(); tsbElim.Enabled = true; tsbInsertar.Enabled = true; tsbMod.Enabled = true; tsbCancelar.Enabled = true; deshabilitarTodo(); cargarNanacionalidades(); tsbMod.Enabled = false; tsbElim.Enabled = false; txtCedBusqueda.Enabled = true; btnBuscar.Enabled = true; } catch (Exception ex) { MessageBox.Show("Error al guardar estudiante" + ex.Message); } } }
private void LLenaComboboxEstudiante() { List <Estudiante> Lista = new List <Estudiante>(); Lista = EstudianteBLL.GetList(p => true); EstudianteComboBox.DataSource = null; EstudianteComboBox.DataSource = Lista; EstudianteComboBox.ValueMember = "EstudianteId"; EstudianteComboBox.DisplayMember = "Nombre"; }