private void buscarbutton_Click(object sender, EventArgs e) { int ID; NotasDeCredito Nota = new NotasDeCredito(); Estudiantes estudiantes = new Estudiantes(); int.TryParse(idnumericUpDown.Text, out ID); Nota = BLL.NotasDeCreditoBLL.Buscar(ID); if (Nota != null) { MessageBox.Show("Nota de Credito Encontrada"); search(Nota); if (BLL.EstudiantesBLL.Buscar(Nota.estudianteID) != null) { estudiantes = BLL.EstudiantesBLL.Buscar(Nota.estudianteID); nombretextBox.Text = estudiantes.nombre; } } else { MessageBox.Show("Nota de Credito No encontada"); } }
public static bool Eliminar(int ID) { bool paso = false; try { ContextoNotasDeCredito contex = new ContextoNotasDeCredito(); NotasDeCredito nc = contex.Notas.Find(ID); Estudiantes es = BLL.EstudiantesBLL.Buscar(nc.estudianteID); es.montoDescuento -= nc.monto; var estudiante = contex.Notas.Find(ID); BLL.EstudiantesBLL.Modificar(es); contex.Notas.Remove(estudiante); contex.SaveChanges(); paso = true; } catch (Exception) { throw; } return(paso); }
private void buscarbutton_Click(object sender, EventArgs e) { Contexto db = new Contexto(); int p = 0; int.TryParse(notaIDtextBox.Text, out p); NotasDeCredito notasDeCredito = new NotasDeCredito(); notasDeCredito = db.NC.Find(p); if (notasDeCredito == null) { MessageBox.Show("Estudiante No encontado"); } else { MessageBox.Show("Estudiante Encontado"); fechadateTimePicker.Text = notasDeCredito.fecha; estudianteIDtextBox.Text = notasDeCredito.estudianteID.ToString(); montoasignaturasnumericUpDown.Text = notasDeCredito.montoAsignaturas.ToString(); porcientobecatextBox.Text = notasDeCredito.pctBeca.ToString(); montotextBox.Text = notasDeCredito.monto.ToString(); } }
private void mod(NotasDeCredito nc) { nc.fecha = fechadateTimePicker.Value; nc.estudianteID = int.Parse(estudianteidnumericUpDown.Text); nc.montoAsignatura = montoasignaturasnumericUpDown.Value; nc.pctBeca = pctnumericUpDown.Value; nc.monto = (montoasignaturasnumericUpDown.Value * (pctnumericUpDown.Value / 100)); }
private void search(NotasDeCredito Nota) { fechadateTimePicker.Value = Nota.fecha; estudianteidnumericUpDown.Value = Convert.ToDecimal(Nota.estudianteID); montoasignaturasnumericUpDown.Value = Convert.ToDecimal(Nota.montoAsignatura); pctnumericUpDown.Value = Convert.ToDecimal(Nota.pctBeca); montotextBox.Text = Nota.monto.ToString(); }
/* * NotasDeCredito Notas = LlenarClase(); * if (idnumericUpDown.Value == 0 || fechadateTimePicker.Text == string.Empty || * estudianteidnumericUpDown.Value == 0 || nombretextBox.Text == string.Empty || * montoasignaturasnumericUpDown.Value == 0 || pctnumericUpDown.Value == 0 || * montotextBox.Text == string.Empty) * ValidarerrorProvider.SetError(guardarbutton, "No puede dejar nada vacio"); * else if (BLL.NotasDeCreditoBLL.Guardar(Notas)) * MessageBox.Show("Nota de Credito Guardada"); * * LimpiarTextBox(); */ private NotasDeCredito LlenarClase() { NotasDeCredito NC = new NotasDeCredito(); int a, b; decimal MontoFinal; int.TryParse(idnumericUpDown.Text, out a); NC.notasID = a; NC.fecha = fechadateTimePicker.Value; int.TryParse(estudianteidnumericUpDown.Text, out b); NC.estudianteID = b; NC.montoAsignatura = montoasignaturasnumericUpDown.Value; NC.pctBeca = pctnumericUpDown.Value; MontoFinal = (NC.montoAsignatura * (NC.pctBeca / 100)); NC.monto = MontoFinal; return(NC); }
private void eliminarbutton_Click(object sender, EventArgs e) { NotasDeCredito Nota = new NotasDeCredito(); int ID; int.TryParse(idnumericUpDown.Text, out ID); NotasDeCredito nc = BLL.NotasDeCreditoBLL.Buscar(ID); if (BLL.NotasDeCreditoBLL.Eliminar(ID)) { MessageBox.Show("Acaba de Eliminar Esta Nota de Credito"); } else { MessageBox.Show("No Puede Eliminar Una Nota de Credito Que No Existe"); } LimpiarTextBox(); }
private void guardarbutton_Click(object sender, EventArgs e) { int ID; int.TryParse(idnumericUpDown.Text, out ID); NotasDeCredito nc = BLL.NotasDeCreditoBLL.Buscar(ID); if (nc == null) { NotasDeCredito nc1 = LlenarClase(); if (fechadateTimePicker.Text == string.Empty || estudianteidnumericUpDown.Value == 0 || nombretextBox.Text == string.Empty || montoasignaturasnumericUpDown.Value == 0 || pctnumericUpDown.Value == 0 || montotextBox.Text == string.Empty) { ValidarerrorProvider.SetError(guardarbutton, "No puede dejar nada vacio"); } else if (BLL.NotasDeCreditoBLL.Guardar(nc1)) { MessageBox.Show("Nota de Credito Guardada"); } else if (!BLL.NotasDeCreditoBLL.Guardar(nc1)) { MessageBox.Show("Nota de Credito No Guardada"); } } else { mod(nc); if (BLL.NotasDeCreditoBLL.Modificar(nc)) { MessageBox.Show("Acaba de Modificar La Nota De Credito"); } else { MessageBox.Show("No Se Pudo Modificar La Nota De Credito"); } } LimpiarTextBox(); }
public static NotasDeCredito Buscar(int EstudianteId) { NotasDeCredito NotaCredito = new NotasDeCredito(); try { ContextoNotasDeCredito contex = new ContextoNotasDeCredito(); NotaCredito = contex.Notas.Find(EstudianteId); if (NotaCredito != null) { M = NotaCredito.monto; } } catch (Exception) { throw; } return(NotaCredito); }
public static bool Guardar(NotasDeCredito nc) { bool paso = false; try { ContextoNotasDeCredito Contex = new ContextoNotasDeCredito(); Estudiantes es = BLL.EstudiantesBLL.Buscar(nc.estudianteID); es.montoDescuento += nc.monto; BLL.EstudiantesBLL.Modificar(es); Contex.Notas.Add(nc); Contex.SaveChanges(); paso = true; } catch (Exception) { throw; } return(paso); }
public static bool Modificar(NotasDeCredito nota) { bool paso = false; try { ContextoNotasDeCredito contex = new ContextoNotasDeCredito(); Estudiantes es = BLL.EstudiantesBLL.Buscar(nota.estudianteID); es.montoDescuento -= M; contex.Entry(nota).State = EntityState.Modified; es.montoDescuento += nota.monto; contex.SaveChanges(); BLL.EstudiantesBLL.Modificar(es); paso = true; } catch (Exception) { throw; } return(paso); }
public Tuple <bool, int> AgregarNotaDeCredito(NotasDeCredito notasDeCredito) { return(notasDeCreditoDatos.AgregarNotaDeCredito(notasDeCredito)); }