protected override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); if (e.Parameter is Appointment) { thisAppointment = (Appointment)e.Parameter; LblName.Text = thisAppointment.name + " " + thisAppointment.surname; LblDateTime.Text = DateTimeManager.DateToShort(thisAppointment.date) + " | " + thisAppointment.time; } }
private void showAppointment(Appointment appt) { BtnDeleteAppt.Tag = appt; GridNoApptSelection.Visibility = Visibility.Collapsed; NextApptPanel.Visibility = Visibility.Visible; LblName.Text = appt.name + " " + appt.surname; LblDate.Text = DateTimeManager.DateToShort(appt.date); LblTime.Text = appt.time; LblContactText.Text = appt.contact; LblNoteText.Text = appt.notes; string patientId = appt.patientId; if (apptIsExisitingPatient(patientId)) { if (visitExists(patientId, appt.date, appt.time)) { BtnNewVisit.Visibility = Visibility.Collapsed; BtnViewVisit.Visibility = Visibility.Visible; BtnDeleteAppt.Visibility = Visibility.Collapsed; BtnModifyAppointment.Visibility = Visibility.Collapsed; } else { BtnDeleteAppt.Visibility = Visibility.Visible; BtnModifyAppointment.Visibility = Visibility.Visible; BtnNewVisit.Visibility = Visibility.Visible; BtnViewVisit.Visibility = Visibility.Collapsed; } patientId = " - " + patientId; } else { patientId = ""; BtnViewVisit.Visibility = Visibility.Collapsed; BtnDeleteAppt.Visibility = Visibility.Visible; BtnModifyAppointment.Visibility = Visibility.Visible; } LblPatientID.Text = patientId; BtnNewVisit.Tag = appt; }
// GET MAIN VISIT INFO private void getVisitDetails(PatientVisit visit) { MySqlConnectionStringBuilder builder = DBConnection.Connect(); MySqlConnection conn = new MySqlConnection(builder.ToString()); String qry = "SELECT patient_visits.*, patients.Name, patients.Surname FROM patient_visits " + "JOIN patients ON patient_visits.PatientID = patients.PatientID " + "WHERE patient_visits.PatientVisitID = '" + visit.id + "'; "; MySqlCommand cmd = new MySqlCommand(qry, conn); conn.Open(); MySqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { string id = reader["PatientVisitID"].ToString(); string pId = reader["PatientID"].ToString(); string notes = reader["Notes"].ToString(); string date = reader["Date"].ToString(); string time = reader["Time"].ToString(); string incomeId = reader["IncomeID"].ToString(); string afterOpening = reader["AfterOpening"].ToString(); string actions = reader["ActionsPerformed"].ToString(); string beforeClosing = reader["BeforeClosing"].ToString(); string name = reader["Name"].ToString(); string surname = reader["Surname"].ToString(); string type = reader["Type"].ToString(); LblName.Text = name + " " + surname; LblDateTime.Text = date + " " + time; LblDateTime.Text = DateTimeManager.DateToShort(date) + " | " + time; LblAfterOpeningText.Text = afterOpening; LblActionsTakenText.Text = actions; LblBeforeClosingText.Text = beforeClosing; LblNotesText.Text = notes; } }