private void buttonSaveVisit_Click(object sender, EventArgs e) { if (this.comboBoxVisitDoctor.SelectedValue == null) { MessageBox.Show("Please select a doctor"); return; } this.labelSymptomsError.Visible = false; int patientId = this.patient.PatientID.Value; DateTime apptDateTime = this.dateTimePickerVisit.Value; int doctorId = Int32.Parse(this.comboBoxVisitDoctor.SelectedValue.ToString()); int bpSystolic = (int)this.numericUpDownSystolic.Value; int bpDiastolic = (int)this.numericUpDownDiastolic.Value; decimal temperature = this.numericUpDownTemperature.Value; decimal weight = this.numericUpDownWeight.Value; int pulse = (int)this.numericUpDownPulse.Value; string symptoms = this.textBoxSymptoms.Text; string diagnoses = this.textBoxDiagnoses.Text; bool finalDiagnosisMade = this.checkBoxFinalDiagnosis.Checked; if (string.IsNullOrWhiteSpace(diagnoses)) { diagnoses = null; } if (string.IsNullOrWhiteSpace(symptoms)) { this.labelSymptomsError.Visible = true; return; } bool isSuccessful; if (this.visitUpdateMode) { isSuccessful = VisitDAL.UpdateVisit(patientId, apptDateTime, bpSystolic, bpDiastolic, temperature, weight, pulse, symptoms, nurseUserId, doctorId, diagnoses, finalDiagnosisMade); } else { isSuccessful = VisitDAL.AddVisit(patientId, apptDateTime, bpSystolic, bpDiastolic, temperature, weight, pulse, symptoms, this.nurseUserId, doctorId, diagnoses, finalDiagnosisMade); } if (isSuccessful) { this.clearVisitInfoFields(); this.groupBoxVisitInfo.Enabled = false; this.currentlyEditingVisit = false; this.loadVisits(); } else { MessageBox.Show("An error occured when adding a visit"); } }
// Adds the person public int AddVisit(Visit visit) { return(VisitDAL.AddVisit(visit)); }