public entMedico BuscarPorApellidos(string apPaterno, string apMaterno) { SqlConnection conex = null; SqlCommand cmd = null; SqlDataReader dr = null; entMedico objMedico = null; try { conex = fabricaDAO.openConexionSQL(); cmd = new SqlCommand("spBuscarMedicoPorApellidos", conex); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@prmApPaterno", apPaterno); cmd.Parameters.AddWithValue("@prmApMaterno", apMaterno); dr = cmd.ExecuteReader(); if (dr.Read()) { objMedico = GetMedico(dr); } } catch (Exception ex) { throw; } return(objMedico); }
public entPaciente BuscarPorDNI(string dni) { SqlCommand cmd = null; SqlConnection conex = null; SqlDataReader dr = null; entPaciente objPaciente = null; try { conex = fabricaDAO.openConexionSQL(); cmd = new SqlCommand("spBuscarPacienteDNI", conex); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@prmDniPaciente", dni); dr = cmd.ExecuteReader(); if (dr.Read()) { objPaciente = GetPaciente(dr); } } catch (Exception e) { throw; } return(objPaciente); }
public List <entEspecialidad> Listar() { SqlCommand cmd = null; SqlConnection conex = null; SqlDataReader dr = null; entEspecialidad objEspecialidad = null; List <entEspecialidad> Lista = null; try { conex = fabricaDAO.openConexionSQL(); cmd = new SqlCommand("spListarEspecialidad", conex); cmd.CommandType = CommandType.StoredProcedure; Lista = new List <entEspecialidad>(); dr = cmd.ExecuteReader(); while (dr.Read()) { objEspecialidad = GetEspecialidad(dr); Lista.Add(objEspecialidad); } } catch (Exception e) { throw; } return(Lista); }
public List <entHorarioAtencion> Listar(string fecha, int idEspecialidad) { SqlConnection conex = null; SqlCommand cmd = null; SqlDataReader dr = null; entHorarioAtencion objHorarioAtencion = null; List <entHorarioAtencion> Lista = null; try { conex = fabricaDAO.openConexionSQL(); cmd = new SqlCommand("spListarHorarioAtencion", conex); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@prmFecha", fecha); cmd.Parameters.AddWithValue("@prmIdEspecialidad", idEspecialidad); dr = cmd.ExecuteReader(); Lista = new List <entHorarioAtencion>(); while (dr.Read()) { objHorarioAtencion = GetHorarioAtencion(dr); Lista.Add(objHorarioAtencion); } } catch (Exception e) { throw null; } return(Lista); }
public entHora BuscarHora(String hora) { SqlConnection conex = null; SqlCommand cmd = null; SqlDataReader dr = null; entHora objHora = null; try { conex = fabricaDAO.openConexionSQL(); cmd = new SqlCommand("spBuscarHora", conex); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@prmHora", hora); dr = cmd.ExecuteReader(); if (dr.Read()) { objHora = GetHora(dr); } } catch (Exception ex) { throw ex; } return(objHora); }
public int Registrar(entHistoriaClinica objHistoriaClinica) { SqlCommand cmd = null; SqlConnection conex = null; int filas = -1; try { conex = fabricaDAO.openConexionSQL(); cmd = new SqlCommand("spRegistrarHistoriaClinica", conex); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@prmIdPaciente", objHistoriaClinica.Paciente.idPaciente); // cmd.Parameters.AddWithValue("@prmfechaApertura", objHistoriaClinica.fechaApertura); // cmd.Parameters.AddWithValue("@prmEstado", objHistoriaClinica.estado); filas = cmd.ExecuteNonQuery(); return(filas); } catch (Exception e) { return(filas); } }
public int Registar(entDiagnostico objDiagnostico) { SqlCommand cmd = null; SqlConnection conex = null; int filas = -1; try { conex = fabricaDAO.openConexionSQL(); cmd = new SqlCommand("spRegistrarDiagnostico", conex); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@prmIdHistoriaClinica", objDiagnostico.HistoriaClinica.idHistoriaClinica); cmd.Parameters.AddWithValue("@prmObservacion", objDiagnostico.observacion); filas = cmd.ExecuteNonQuery(); return(filas); } catch (Exception ex) { return(filas); } }
public entEmpleado Login(String usuario, String password) { entEmpleado objEmpleado = null; SqlCommand cmd = null; SqlDataReader dr = null; SqlConnection cn = null; try { cn = new SqlConnection(); cn = fabricaDAO.openConexionSQL(); cmd = new SqlCommand("spLogin", cn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("prmUsuario", usuario); cmd.Parameters.AddWithValue("prmClave", password); dr = cmd.ExecuteReader(); if (dr.Read()) { objEmpleado = GetSolicita(dr); } } catch (Exception ex) { throw ex; } return(objEmpleado); }
public int Registrar(entCita objCita) { SqlCommand cmd = null; SqlConnection conex = null; int filas = -1; try { conex = fabricaDAO.openConexionSQL(); cmd = new SqlCommand("spRegistrarCita", conex); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@prmIdMedico", objCita.Medico.idMedico); cmd.Parameters.AddWithValue("@prmIdPaciente", objCita.Paciente.idPaciente); cmd.Parameters.AddWithValue("@prmHora", objCita.hora); cmd.Parameters.AddWithValue("@prmFechaReserva", objCita.fechaReserva); filas = cmd.ExecuteNonQuery(); } catch (Exception ex) { return(filas); } return(filas); }