public static void UpdatePatientNotes(PatientVisitNotes note) { string updateStatement = "UPDATE patient_visit_notes SET " + "note = @note, employeeID = @employeeID, date = @date " + "WHERE visitID = @visitID AND notesID = @notesID"; try { using (SqlConnection connection = NorthwindDbConnection.GetConnection()) { connection.Open(); using (SqlCommand updateCommand = new SqlCommand(updateStatement, connection)) { //parameters updateCommand.Parameters.AddWithValue("@visitID", note.VisitId); updateCommand.Parameters.AddWithValue("@notesID", note.NotesId); updateCommand.Parameters.AddWithValue("@note", note.Note); updateCommand.Parameters.AddWithValue("@employeeID", note.EmployeeId); updateCommand.Parameters.AddWithValue("@date", DateTime.Now); updateCommand.ExecuteNonQuery(); } } } catch (SqlException ex) { throw ex; } catch (Exception ex) { throw ex; } }
public static int AddPatientVisitNotes(PatientVisitNotes note) { string insertStatement = "INSERT patient_visit_notes " + "(employeeID, visitID, note, date) " + "VALUES (@employeeID, @visitID, @note, @date)"; try { using (SqlConnection connection = NorthwindDbConnection.GetConnection()) { connection.Open(); using (SqlCommand insertCommand = new SqlCommand(insertStatement, connection)) { //parameters insertCommand.Parameters.AddWithValue("@employeeID", note.EmployeeId); insertCommand.Parameters.AddWithValue("@visitID", note.VisitId); insertCommand.Parameters.AddWithValue("@note", note.Note); insertCommand.Parameters.AddWithValue("@date", DateTime.Now); insertCommand.ExecuteNonQuery(); string selectStatement = "SELECT IDENT_CURRENT('patient_visit_notes') FROM patient_visit_notes"; SqlCommand selectCommand = new SqlCommand(selectStatement, connection); int noteID = Convert.ToInt32(selectCommand.ExecuteScalar()); return noteID; } } } catch (SqlException ex) { throw ex; } catch (Exception ex) { throw ex; } }
private void saveButton5_Click(object sender, EventArgs e) { if (IsValidDataNotes()) { note = new PatientVisitNotes(); this.PutPatientVisitNotesData(note); try { note.NotesId = NorthwindController.AddPatientVisitNotes(note); saveButton5.Visible = false; editButton5.Visible = true; editButton5.Enabled = false; } catch (SqlException ex) { MessageBox.Show(ex.Message, ex.GetType().ToString()); } catch (Exception ex) { MessageBox.Show(ex.Message, ex.GetType().ToString()); } } }
//Saves the symptoms/notes data private void PutPatientVisitSymptomsData(PatientVisitSymptoms symptoms, PatientVisitNotes note) { symptoms.VisitId = patientVisit.VisitId; symptoms.SymptomName = txtBoxSymptoms.Text; note.Note = txtBoxNotes.Text; note.EmployeeId = NwLogin.employeeUser.EmployeeId; note.VisitId = patientVisit.VisitId; }
//Saves info in the symptoms table for the diagnoses private void saveButton4_Click(object sender, EventArgs e) { if (IsValidDataDiagnoses()) { dsymptoms = new PatientVisitSymptoms(); note = new PatientVisitNotes(); this.PutPatientVisitDiagnosesData(dsymptoms, note); try { NorthwindController.UpdatePatientDiagnoses(dsymptoms); if (note.Note != null) { note.NotesId = NorthwindController.AddPatientVisitNotes(note); } saveButton4.Visible = false; editButton4.Visible = true; editButton4.Enabled = false; } catch (SqlException ex) { MessageBox.Show(ex.Message, ex.GetType().ToString()); } catch (Exception ex) { MessageBox.Show(ex.Message, ex.GetType().ToString()); } } }
//Saves the diagnoses for the symptoms/notes data private void PutPatientVisitNotesData(PatientVisitNotes note) { note.Note = notesBox3.Text; note.EmployeeId = NwLogin.employeeUser.EmployeeId; note.VisitId = patientVisit.VisitId; }
//Saves the diagnoses for the symptoms/notes data private void PutPatientVisitDiagnosesData(PatientVisitSymptoms dsymptoms, PatientVisitNotes note) { dsymptoms.VisitId = patientVisit.VisitId; dsymptoms.SymptomId = symptoms.SymptomId; dsymptoms.DiagnosesID = (int)diagnosesComboBox.SelectedValue; note.Note = notesBox2.Text; note.EmployeeId = NwLogin.employeeUser.EmployeeId; note.VisitId = patientVisit.VisitId; }
private void editButton5_Click(object sender, EventArgs e) { if (IsValidDataNotes()) { PatientVisitNotes updateNote = new PatientVisitNotes(); this.PutPatientVisitNotesData(updateNote); updateNote.NotesId = note.NotesId; try { NorthwindController.UpdatePatientNotes(updateNote); editButton5.Enabled = false; } catch (SqlException ex) { MessageBox.Show(ex.Message, ex.GetType().ToString()); } catch (Exception ex) { MessageBox.Show(ex.Message, ex.GetType().ToString()); } } }
public static void UpdatePatientNotes(PatientVisitNotes note) { PatientVisitNotesDal.UpdatePatientNotes(note); }
public static int AddPatientVisitNotes(PatientVisitNotes note) { return PatientVisitNotesDal.AddPatientVisitNotes(note); }