private void button1_Click(object sender, EventArgs e) { try { validarDatos(); FixamoContext context = new FixamoContext(); if (plazoEntrega == null) { Clases.PlazoEntrega newPlazoEntrega = new Clases.PlazoEntrega(); newPlazoEntrega.Nombre = nombre.Text; context.PlazosDeEntrega.Add(newPlazoEntrega); } else { Clases.PlazoEntrega newPlazoEntrega = context.PlazosDeEntrega.Find(plazoEntrega.PlazoEntregaId); newPlazoEntrega.Nombre = nombre.Text; } context.SaveChanges(); this.Close(); } catch (Exception exc) { MessageBox.Show(exc.Message); } }
private void button3_Click(object sender, EventArgs e) { int idPlazoEntrega = (int)dataGridView1.SelectedRows[0].Cells["PlazoEntregaId"].Value; // FixamoContext context = new FixamoContext(); Clases.PlazoEntrega plazoEntregaSeleccionado = context.PlazosDeEntrega.Find(idPlazoEntrega); plazoEntregaSeleccionado.Habilitado = false; context.SaveChanges(); // this.AdministracionPlazosDeEntrega_Load(null, null); }
private void button1_Click(object sender, EventArgs e) { try { validarDatos(); Clases.PlazoEntrega newPlazoEntrega = new Clases.PlazoEntrega(); newPlazoEntrega.Nombre = nombreAgregar.Text; FixamoContext context = new FixamoContext(); context.PlazosDeEntrega.Add(newPlazoEntrega); context.SaveChanges(); limpiarDatos(); this.AdministracionPlazosDeEntrega_Load(null, null); } catch (Exception exc) { MessageBox.Show(exc.Message); } }
public AMPlazosDeEntrega(Clases.PlazoEntrega plazoEntregaP) { InitializeComponent(); plazoEntrega = plazoEntregaP; }