/// <summary> /// Crea el turno /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnCrearTurno_Click(object sender, EventArgs e) { try { clinica.AgregarTurno(pacienteSeleccionado, especialistaSeleccionado); MessageBox.Show("Turno Generado."); } catch (Exception ex) { ExcepcionesForm ef = new ExcepcionesForm(ex); ef.ShowDialog(); } }
/// <summary> /// Constructor, abre las dos ventanas, carga la clinica y ejecuta el hilo /// y carga los grid view /// </summary> public ClinicaUtn() { InitializeComponent(); pacienteSeleccionado = null; especialistaSeleccionado = null; try { clinica = new Clinica(); } catch (Exception e) { ExcepcionesForm ef = new ExcepcionesForm(e); ef.ShowDialog(); } ProximoTurno pt = new ProximoTurno(clinica); pt.Show(); TurnoActual ta = new TurnoActual(clinica); ta.Show(); if (clinica != null) { foreach (IPaciente item in clinica.Pacientes) { int n = dgvPacientes.Rows.Add(); switch (item.NroClinica) { case 1: dgvPacientes.Rows[n].Cells[0].Value = ((PacienteDB)item).Id; dgvPacientes.Rows[n].Cells[1].Value = ((PacienteDB)item).NroClinica; dgvPacientes.Rows[n].Cells[2].Value = ((PacienteDB)item).Apellido; dgvPacientes.Rows[n].Cells[3].Value = ((PacienteDB)item).Nombre; dgvPacientes.Rows[n].Cells[4].Value = ((PacienteDB)item).Edad; dgvPacientes.Rows[n].Cells[5].Value = ((PacienteDB)item).Sexo; dgvPacientes.Rows[n].Cells[6].Value = ((PacienteDB)item).Direccion; dgvPacientes.Rows[n].Cells[7].Value = ((PacienteDB)item).ObraSocial; break; case 2: dgvPacientes.Rows[n].Cells[0].Value = ((Paciente)item).Id; dgvPacientes.Rows[n].Cells[1].Value = ((Paciente)item).NroClinica; dgvPacientes.Rows[n].Cells[2].Value = ((Paciente)item).Apellido; dgvPacientes.Rows[n].Cells[3].Value = ((Paciente)item).Nombre; dgvPacientes.Rows[n].Cells[4].Value = ((Paciente)item).Edad; dgvPacientes.Rows[n].Cells[5].Value = ((Paciente)item).Sexo; dgvPacientes.Rows[n].Cells[6].Value = ((Paciente)item).Direccion; dgvPacientes.Rows[n].Cells[7].Value = ((Paciente)item).ObraSocial; break; } } foreach (IEspecialista item in clinica.Especialistas) { int n = dgvEspecialistas.Rows.Add(); switch (item.NroClinica) { case 1: dgvEspecialistas.Rows[n].Cells[0].Value = ((EspecialistaDB)item).Id; dgvEspecialistas.Rows[n].Cells[1].Value = ((EspecialistaDB)item).NroClinica; dgvEspecialistas.Rows[n].Cells[2].Value = ((EspecialistaDB)item).Apellido; dgvEspecialistas.Rows[n].Cells[3].Value = ((EspecialistaDB)item).Nombre; dgvEspecialistas.Rows[n].Cells[4].Value = ((EspecialistaDB)item).Edad; dgvEspecialistas.Rows[n].Cells[5].Value = ((EspecialistaDB)item).Sexo; dgvEspecialistas.Rows[n].Cells[6].Value = ((EspecialistaDB)item).Direccion; dgvEspecialistas.Rows[n].Cells[7].Value = ((EspecialistaDB)item).Especialidad; break; case 2: dgvEspecialistas.Rows[n].Cells[0].Value = ((Especialista)item).Id; dgvEspecialistas.Rows[n].Cells[1].Value = ((Especialista)item).NroClinica; dgvEspecialistas.Rows[n].Cells[2].Value = ((Especialista)item).Apellido; dgvEspecialistas.Rows[n].Cells[3].Value = ((Especialista)item).Nombre; dgvEspecialistas.Rows[n].Cells[4].Value = ((Especialista)item).Edad; dgvEspecialistas.Rows[n].Cells[5].Value = ((Especialista)item).Sexo; dgvEspecialistas.Rows[n].Cells[6].Value = ((Especialista)item).Direccion; dgvEspecialistas.Rows[n].Cells[7].Value = ((Especialista)item).Campo; break; } } } atenderConsultaThread = new Thread(AtenderConsulta); atenderConsultaThread.Start(); }