private void button1_Click(object sender, EventArgs e) { try { validarDatos(); FixamoContext context = new FixamoContext(); if (doctor == null) { Clases.Doctor newDoctor = new Clases.Doctor(); newDoctor.Nombre = nombre.Text; context.Doctores.Add(newDoctor); } else { Clases.Doctor newDoctor = context.Doctores.Find(doctor.DoctorId); newDoctor.Nombre = nombre.Text; } context.SaveChanges(); this.Close(); } catch (Exception exc) { MessageBox.Show(exc.Message); } }
private void button4_Click(object sender, EventArgs e) { int idDoc = (int)dataGridView1.SelectedRows[0].Cells["DoctorId"].Value; // FixamoContext context = new FixamoContext(); Clases.Doctor doctorSeleccionado = context.Doctores.Find(idDoc); doctorSeleccionado.Habilitado = false; context.SaveChanges(); // cargarDataGrid(); buscarCoincidencias(); }
private void button1_Click(object sender, EventArgs e) { try { validarDatos(); Clases.Doctor newDoctor = new Clases.Doctor(); newDoctor.Nombre = nombreAgregar.Text; FixamoContext context = new FixamoContext(); context.Doctores.Add(newDoctor); context.SaveChanges(); limpiarDatos(); cargarDataGrid(); buscarCoincidencias(); } catch (Exception exc) { MessageBox.Show(exc.Message); } }
public AMDoctor(Clases.Doctor doctorP) { InitializeComponent(); doctor = doctorP; }