public List <ClaseTratamiento> mostrarIdPacientes() { sqlConnection.Open(); try { SqlCommand command = new SqlCommand("MostrarPacientes", sqlConnection); command.CommandType = CommandType.StoredProcedure; SqlDataReader reader = command.ExecuteReader(); List <ClaseTratamiento> pacientes = new List <ClaseTratamiento>(); ClaseTratamiento paciente = null; while (reader.Read()) { paciente = new ClaseTratamiento(); paciente.IdPaciente = reader["id_paciente"].ToString(); pacientes.Add(paciente); } return(pacientes); } catch { throw; } finally { sqlConnection.Close(); } }
public List <ClaseTratamiento> mostrarMateriales(int idtratamiento) { sqlConnection.Open(); try { SqlCommand command = new SqlCommand("materialnecesario", sqlConnection); command.CommandType = CommandType.StoredProcedure; command.Parameters.AddWithValue("@id", idtratamiento); SqlDataReader reader = command.ExecuteReader(); List <ClaseTratamiento> materiales = new List <ClaseTratamiento>(); ClaseTratamiento material = null; while (reader.Read()) { material = new ClaseTratamiento(); material.NombreMaterial = reader["nombre"].ToString(); material.Cantidad = Convert.ToInt32(reader["cantidad"].ToString()); materiales.Add(material); } return(materiales); } catch { throw; } finally { sqlConnection.Close(); } }
public void ActualizarMaterialDisponible(ClaseTratamiento tratamiento) { sqlConnection.Open(); try { SqlCommand command = new SqlCommand("actualizarCantidad", sqlConnection); command.CommandType = CommandType.StoredProcedure; command.Parameters.AddWithValue("@cantidad", tratamiento.Cantidad); command.Parameters.AddWithValue("@nombre", tratamiento.NombreMaterial); command.ExecuteNonQuery(); } catch { throw; } finally { sqlConnection.Close(); } }
public void IngresarAlHistorial(ClaseTratamiento tratamiento) { sqlConnection.Open(); try { SqlCommand command = new SqlCommand("IngresoHistorial", sqlConnection); command.CommandType = CommandType.StoredProcedure; command.Parameters.AddWithValue("@idpaciente", tratamiento.IdPaciente); command.Parameters.AddWithValue("@fecha", Convert.ToDateTime(tratamiento.fecha)); command.Parameters.AddWithValue("@idtratamiento", tratamiento.IdTratamiento); command.ExecuteNonQuery(); } catch { throw; } finally { sqlConnection.Close(); } }