private void btnVisits_Click(object sender, EventArgs e) { if (listBox1.SelectedIndex < 0 || listBox1.SelectedIndex >= listBox1.Items.Count) { MessageBox.Show("Please, select a reservation"); return; } reservation res = (reservation)listBox1.SelectedItem; Hide(); Visits visits = new Visits(account_id, res.patient.Key, res.id); visits.ShowDialog(); Show(); }
public EditReservation(reservation res) { InitializeComponent(); dateTimePicker1.Value = res.visit_date; txtReservationID.Text = res.id.ToString(); txtPatient.Text = res.patient.ToString(); txtNurse.Text = res.nurse.ToString(); txtDate.Text = res.date.ToString(); dateTimePicker1.MinDate = DateTime.Today; updateCombo(res.slot); }
private void btnEdit_Click(object sender, EventArgs e) { if (listBox1.SelectedIndex < 0 || listBox1.SelectedIndex >= listBox1.Items.Count) { MessageBox.Show("Please, select a reservation"); return; } reservation res = (reservation)listBox1.SelectedItem; Hide(); EditReservation editReservation = new EditReservation(res); editReservation.ShowDialog(); updateList(); Show(); }
private void updateForm() { if (listBox1.SelectedIndex < 0 || listBox1.SelectedIndex >= listBox1.Items.Count) { MessageBox.Show("Please, select a reservation"); return; } reservation res = (reservation)listBox1.SelectedItem; txtReservationID.Text = res.id.ToString(); txtPatient.Text = res.patient.ToString(); txtNurse.Text = res.nurse.ToString(); txtVisitDate.Text = res.visit_date.Date.ToString(); txtVisitSlot.Text = Utilis.getSlots()[res.slot]; txtDate.Text = res.date.ToString(); if (account_type == 0 && res.visit_date >= DateTime.Today) { btnEdit.Enabled = true; } else { btnEdit.Enabled = false; } //enabling button if account is doctor if (account_type == 1) { btnVisits.Enabled = true; } else { btnVisits.Enabled = false; } }