private void button1_Click(object sender, EventArgs e) { try { validarDatos(); FixamoContext context = new FixamoContext(); if (condicionPago == null) { Clases.CondicionPago newCondicionDePago = new Clases.CondicionPago(); newCondicionDePago.Nombre = nombre.Text; context.CondicionesDePago.Add(newCondicionDePago); } else { Clases.CondicionPago newCondicionDePago = context.CondicionesDePago.Find(condicionPago.CondicionPagoId); newCondicionDePago.Nombre = nombre.Text; } context.SaveChanges(); this.Close(); } catch (Exception exc) { MessageBox.Show(exc.Message); } }
private void button3_Click(object sender, EventArgs e) { int idCondicion = (int)dataGridView1.SelectedRows[0].Cells["CondicionPagoId"].Value; // FixamoContext context = new FixamoContext(); Clases.CondicionPago condicionSeleccionado = context.CondicionesDePago.Find(idCondicion); condicionSeleccionado.Habilitado = false; context.SaveChanges(); // this.AdministracionCondicionesDePago_Load(null, null); }
private void button1_Click(object sender, EventArgs e) { try { validarDatos(); Clases.CondicionPago newCondicionDePago = new Clases.CondicionPago(); newCondicionDePago.Nombre = nombreAgregar.Text; FixamoContext context = new FixamoContext(); context.CondicionesDePago.Add(newCondicionDePago); context.SaveChanges(); limpiarDatos(); this.AdministracionCondicionesDePago_Load(null, null); } catch (Exception exc) { MessageBox.Show(exc.Message); } }
public AMCondicionesDePago(Clases.CondicionPago condicionPagoP) { InitializeComponent(); condicionPago = condicionPagoP; }