public Form1()
        {
            InitializeComponent();
            dataGridView1.Columns.Add("Id", "Id");
            dataGridView1.Columns.Add("Asunto", "Asunto");
            dataGridView1.Columns.Add("Paciente", "Paciente");
            dataGridView1.Columns.Add("Medico", "Medico");
            dataGridView1.Columns.Add("Fecha", "Fecha");
            dataGridView1.Columns[0].Width = 50;
            dataGridView1.Columns[1].Width = 200;
            dataGridView1.Columns[2].Width = 150;
            dataGridView1.Columns[3].Width = 150;
            dataGridView1.Columns[4].Width = 150;

            pas = PacientObj.getAll();
            mes = MedicObj.getAll();
            foreach (MedicObj m in mes)
            {
                medic.Items.Add(m.name + " " + m.lastname);
            }
            foreach (PacientObj p in pas)
            {
                pacient.Items.Add(p.name + " " + p.lastname);
            }
        }
 public static void load()
 {
     data.Rows.Clear();
     foreach (MedicObj p in MedicObj.getAll())
     {
         data.Rows.Add(p.id, p.name, p.lastname, p.address, p.phone);
     }
 }
        public ReservationForm()
        {
            InitializeComponent();
            pas = PacientObj.getAll();
            mes = MedicObj.getAll();
            foreach (MedicObj m in mes)
            {
                medic.Items.Add(m.name + " " + m.lastname);
            }
            foreach (PacientObj p in pas)
            {
                pacient.Items.Add(p.name + " " + p.lastname);
            }

            if (action == 1)
            {
                btn_del.Enabled = false;
            }
            else if (action == 2)
            {
                label_title.Text = "Editar Cita";
                Text             = "Editar Cita";
                btn_del.Enabled  = true;
                ReservationObj p = ReservationObj.getById(id);
                if (p.id > 0)
                {
                    title.Text   = p.title;
                    note.Text    = p.note;
                    date_at.Text = p.date_at;
                    time_at.Text = p.time_at;
                    int n = 0;
                    foreach (MedicObj m in mes)
                    {
                        if (m.id == p.medic_id)
                        {
                            medic.SelectedIndex = n; break;
                        }
                        n++;
                    }
                    n = 0;
                    foreach (PacientObj m in pas)
                    {
                        if (m.id == p.pacient_id)
                        {
                            pacient.SelectedIndex = n; break;
                        }
                        n++;
                    }
                }
                else
                {
                    MessageBox.Show("No se encontro el paciente.");
                }
            }
        }