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);
            }
        }
Beispiel #2
0
 public MedicForm()
 {
     InitializeComponent();
     if (action == 1)
     {
         btn_del.Enabled = false;
     }
     else if (action == 2)
     {
         btn_del.Enabled = true;
         MedicObj p = MedicObj.getById(id);
         if (p.id > 0)
         {
             name.Text     = p.name;
             lastname.Text = p.lastname;
             address.Text  = p.address;
             email.Text    = p.email;
             phone.Text    = p.phone;
         }
         else
         {
             MessageBox.Show("No se encontro el medico.");
         }
     }
 }
 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);
     }
 }
 void fill(List <ReservationObj> res)
 {
     dataGridView1.Rows.Clear();
     foreach (ReservationObj r in res)
     {
         MedicObj   m = MedicObj.getById(r.medic_id);
         PacientObj p = PacientObj.getById(r.pacient_id);
         dataGridView1.Rows.Add(r.id, r.title, p.name + " " + p.lastname, m.name + " " + m.name, r.date_at + "/" + r.time_at);
     }
 }
        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.");
                }
            }
        }
Beispiel #6
0
        public static MedicObj getById(int product_id)
        {
            Connection   c   = new Connection();
            MySqlCommand cmd = c.con.CreateCommand();

            cmd.CommandText = "select * from medic where id=" + product_id;
            c.con.Open();
            MySqlDataReader r       = cmd.ExecuteReader();
            MedicObj        product = new MedicObj();

            while (r.Read())
            {
                product.id       = r.GetInt32("id");
                product.name     = r.GetString("name");
                product.lastname = r.GetString("lastname");
                product.address  = r.GetString("address");
                product.phone    = r.GetString("phone");

                product.email = r.GetString("email");
                break;
            }
            return(product);
        }
Beispiel #7
0
        public static List <MedicObj> getAll()
        {
            List <MedicObj> list = new List <MedicObj>();
            Connection      c    = new Connection();
            MySqlCommand    cmd  = c.con.CreateCommand();

            cmd.CommandText = "select * from medic";
            c.con.Open();
            MySqlDataReader r = cmd.ExecuteReader();

            while (r.Read())
            {
                MedicObj product = new MedicObj();
                product.id       = r.GetInt32("id");
                product.name     = r.GetString("name");
                product.lastname = r.GetString("lastname");
                product.address  = r.GetString("address");
                product.phone    = r.GetString("phone");

                product.email = r.GetString("email");
                list.Add(product);
            }
            return(list);
        }