public List <Doctor> FetchDoctors(string conString, string query)
        {
            List <Doctor> doctorList;

            using (SqlConnection con = new SqlConnection(conString))
            {
                SqlCommands.OpenConnection(con);
                SqlDataReader reader = SqlCommands.ExecuteRead(con, query);
                doctorList = ParseDoctors(reader);
            }
            FetchDoctorsPatients(conString, ref doctorList);
            return(doctorList);
        }
 public void FetchPatientsDevices(string connectionString, ref List <PatientAdmission> patientsAdmissions)
 {
     using (SqlConnection con = new SqlConnection(connectionString))
     {
         SqlCommands.OpenConnection(con);
         foreach (var admission in patientsAdmissions)
         {
             var           previousAdmissionsQuery = String.Format("Select * FROM PatientDevices WHERE PatientId = '{0}'", admission.PatientId);
             SqlDataReader reader = SqlCommands.ExecuteRead(con, previousAdmissionsQuery);
             admission.Devices = ParsePatientsDevices(reader);
             reader.Close();
         }
     }
 }
        public List <Patient> FetchPatients(string connectionString, string patientQuery)
        {
            List <Patient> patients;

            using (SqlConnection con = new SqlConnection(connectionString))
            {
                SqlCommands.OpenConnection(con);

                SqlDataReader reader = SqlCommands.ExecuteRead(con, patientQuery);
                patients = ParsePatients(reader);
                reader.Close();
            }
            return(patients);
        }
 public void FetchDoctorsPatients(string connectionString, ref List <Doctor> doctors)
 {
     using (SqlConnection con = new SqlConnection(connectionString))
     {
         SqlCommands.OpenConnection(con);
         foreach (var doctor in doctors)
         {
             var           previousAdmissionsQuery = String.Format("Select * FROM PatientAdmission WHERE DoctorId = '{0}'", doctor.DoctorId);
             SqlDataReader reader = SqlCommands.ExecuteRead(con, previousAdmissionsQuery);
             doctor.Patients = ParsePatientIds(reader);
             reader.Close();
         }
     }
 }
Esempio n. 5
0
        public List <Limits> FetchCustomLimits(string connectionString, string deviceId, string patientId)
        {
            List <Limits> limits;

            using (SqlConnection con = new SqlConnection(connectionString))
            {
                SqlCommands.OpenConnection(con);
                string          limitsQuery  = String.Format("Select * FROM CustomLimits WHERE PatientId = '{0}' and DeviceId='{1}' order by MinValue ASC", patientId, deviceId);
                SqlDataReader   reader       = SqlCommands.ExecuteRead(con, limitsQuery);
                SqlDeviceReader deviceReader = new SqlDeviceReader();
                limits = deviceReader.ParseLimits(reader);
                reader.Close();
            }
            return(limits);
        }
 public void FetchPreviousAdmissions(string connectionString, ref List <Patient> patients)
 {
     using (SqlConnection con = new SqlConnection(connectionString))
     {
         SqlCommands.OpenConnection(con);
         foreach (var patient in patients)
         {
             var previousAdmissionsQuery = String.Format("Select * FROM AdmissionHistory WHERE PatientId = '{0}'",
                                                         patient.PatientId);
             SqlDataReader reader = SqlCommands.ExecuteRead(con, previousAdmissionsQuery);
             patient.PreviousAdmissions = ParsePreviousAdmissions(reader);
             reader.Close();
         }
     }
 }
Esempio n. 7
0
        public List <Device> FetchDevices(string connectionString, string deviceQuery)
        {
            List <Device> devices;

            using (SqlConnection con = new SqlConnection(connectionString))
            {
                SqlCommands.OpenConnection(con);

                SqlDataReader reader = SqlCommands.ExecuteRead(con, deviceQuery);
                devices = ParseDevices(reader);
                reader.Close();
            }

            return(devices);
        }
Esempio n. 8
0
        public List <HospitalBed> FetchBedNumbers(string conString, string query)
        {
            List <HospitalBed> bedList;

            using (SqlConnection con = new SqlConnection(conString))
            {
                SqlCommands.OpenConnection(con);
                using (SqlDataReader reader = SqlCommands.ExecuteRead(con, query))
                {
                    bedList = ParseHospitalBeds(reader);
                }
            }

            return(bedList);
        }
        public List <PatientAdmission> FetchPatientAdmissions(string connectionString, string admissionQuery)
        {
            List <PatientAdmission> admissions;

            using (SqlConnection con = new SqlConnection(connectionString))
            {
                SqlCommands.OpenConnection(con);

                using (SqlDataReader reader = SqlCommands.ExecuteRead(con, admissionQuery))
                {
                    admissions = ParseAdmissions(reader);
                }
            }

            return(admissions);
        }
Esempio n. 10
0
        public void FetchDefaultLimits(string connectionString, ref List <Device> devices)
        {
            string limitsQuery;

            using (SqlConnection con = new SqlConnection(connectionString))
            {
                SqlCommands.OpenConnection(con);
                foreach (var device in devices)
                {
                    limitsQuery =
                        String.Format("Select * FROM DefaultLimits WHERE DeviceId='{0}' order by MinValue ASC",
                                      device.DeviceId);
                    SqlDataReader reader = SqlCommands.ExecuteRead(con, limitsQuery);
                    device.Limits = ParseLimits(reader);
                    reader.Close();
                }
            }
        }