Esempio n. 1
0
        private void updateCombo(int visit_slot)
        {
            Dictionary <int, string> slots = Utilis.getSlots();

            command             = conn.CreateCommand();
            command.CommandText = "SELECT reservation_visit_slot FROM reservation WHERE reservation_visit_date = @date AND reservation_id <> @id";
            command.Parameters.AddWithValue("@date", dateTimePicker1.Value.ToString("yyyy-MM-dd"));
            command.Parameters.AddWithValue("@id", txtReservationID.Text);
            conn.Open();

            SqlDataReader reader = command.ExecuteReader();

            while (reader.Read())
            {
                slots.Remove(reader.GetInt32(0));;
            }

            comboBox1.Items.Clear();

            foreach (KeyValuePair <int, string> slot in slots)
            {
                comboBox1.Items.Add(slot);
                if (slot.Key == visit_slot)
                {
                    comboBox1.SelectedItem = slot;
                }
            }

            conn.Close();
        }
        private void updateSlots()
        {
            command             = conn.CreateCommand();
            command.CommandText = "SELECT reservation_visit_slot FROM reservation WHERE reservation_visit_date=@date ";
            command.Parameters.AddWithValue("@date", dateTimePicker1.Value.ToString("yyyy-MM-dd"));

            conn.Open();

            SqlDataReader            reader = command.ExecuteReader();
            Dictionary <int, string> slots  = Utilis.getSlots();

            while (reader.Read())
            {
                slots.Remove(reader.GetInt32(0));
            }

            comboBox1.Items.Clear();
            foreach (object slot in slots.ToArray())
            {
                comboBox1.Items.Add(slot);
            }

            if (comboBox1.Items.Count > 0)
            {
                comboBox1.SelectedIndex = 0;
            }

            conn.Close();
        }
Esempio n. 3
0
        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;
            }
        }
Esempio n. 4
0
 public override string ToString()
 {
     return(base.ToString() + ":" + patient.Value + ":" + visit_date.Date.ToString() + "=>" + Utilis.getSlots()[slot]);
 }