public ClinicalFindings() { _id = -1; _anesthesiaConcerns = new List<AnesthesiaConcern>(); _priorAnesthesia = new PriorAnesthesia(); _cardiacAuscultation = new DropdownValue(); _pulseQuality = new DropdownValue(); _respiratoryAuscultation = new DropdownValue(); _physicalStatusClassification = new DropdownValue(); _mucousMembraneColor = new DropdownValue(); _capillaryRefillTime = new DropdownValue(); }
public void SavePriorAnesthesia(PriorAnesthesia priors) { if (service.UpdatePriorAnesthesia(priors) == 0) service.CreatePriorAnesthesia(priors); }
public int UpdatePriorAnesthesia(PriorAnesthesia priorAnes) { int returnNum = 0; using (SqlConnection conn = new SqlConnection(connString)) { string sql = @"UPDATE dbo.Prior_Anesthesia_To_Patient SET DateOfProblem = @DateOfProblem, Problem = @Problem WHERE PatientId = @PatientId"; SqlCommand cmd = new SqlCommand(sql, conn); cmd.Parameters.Add("@PatientId", SqlDbType.Int).Value = priorAnes.PatientId; if (priorAnes.DateOfProblem != DateTime.MinValue) cmd.Parameters.Add("@DateOfProblem", SqlDbType.DateTime).Value = priorAnes.DateOfProblem; else cmd.Parameters.Add("@DateOfProblem", SqlDbType.DateTime).Value = DBNull.Value; cmd.Parameters.Add("@Problem", SqlDbType.NVarChar).Value = priorAnes.Problem; try { conn.Open(); returnNum = cmd.ExecuteNonQuery(); } catch (Exception e) { throw e; } finally { conn.Close(); } } return returnNum; }
public void CreatePriorAnesthesia(PriorAnesthesia priorAnes) { using (SqlConnection conn = new SqlConnection(connString)) { string sql = @"INSERT INTO dbo.Prior_Anesthesia_To_Patient ( PatientId, DateOfProblem, Problem ) VALUES ( @PatientId, @DateOfProblem, @Problem )"; SqlCommand cmd = new SqlCommand(sql, conn); cmd.Parameters.Add("@PatientId", SqlDbType.Int).Value = priorAnes.PatientId; if (priorAnes.DateOfProblem != DateTime.MinValue) cmd.Parameters.Add("@DateOfProblem", SqlDbType.DateTime).Value = priorAnes.DateOfProblem; else cmd.Parameters.Add("@DateOfProblem", SqlDbType.DateTime).Value = DBNull.Value; cmd.Parameters.Add("@Problem", SqlDbType.NVarChar).Value = priorAnes.Problem; try { conn.Open(); cmd.ExecuteNonQuery(); } catch (Exception e) { throw e; } finally { conn.Close(); } } }
public PriorAnesthesia GetPriorAnesthesia(int patientId) { PriorAnesthesia priorAnes = new PriorAnesthesia(); using (SqlConnection conn = new SqlConnection(connString)) { // Abstract database field names as much as possible in case of field name changes string sql = BuildPriorAnesthesiaSQL(); string from = @"FROM dbo.Prior_Anesthesia_To_Patient AS a"; string where = @" WHERE a.PatientId = @PatientId "; sql = sql + from + where; SqlCommand cmd = new SqlCommand(sql, conn); cmd.Parameters.Add("@PatientId", SqlDbType.Int).Value = patientId; try { conn.Open(); SqlDataReader read = cmd.ExecuteReader(); while (read.Read()) { // Create a callback for everytime you have to read something from database. // We do this, so we only have to change string values in one place if we change things. priorAnes = new PriorAnesthesiaCallback().ProcessRow(read); } } catch (Exception e) { throw e; } finally { conn.Close(); } } return priorAnes; }