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 PacientForm()
 {
     InitializeComponent();
     if (action == 1)
     {
         btn_del.Enabled = false;
     }
     else if (action == 2)
     {
         btn_del.Enabled = true;
         PacientObj p = PacientObj.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 paciente.");
         }
     }
 }
Esempio n. 3
0
 public static void load()
 {
     data.Rows.Clear();
     foreach (PacientObj p in PacientObj.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.");
                }
            }
        }
Esempio n. 6
0
        public static PacientObj getById(int product_id)
        {
            Connection c = new Connection();
            MySqlCommand cmd = c.con.CreateCommand();
            cmd.CommandText = "select * from pacient where id=" + product_id;
            c.con.Open();
            MySqlDataReader r = cmd.ExecuteReader();
            PacientObj product = new PacientObj();
            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;
        }
Esempio n. 7
0
        public static List<PacientObj> getAll()
        {
            List<PacientObj> list = new List<PacientObj>();
                Connection c = new Connection();
                MySqlCommand cmd = c.con.CreateCommand();
                cmd.CommandText = "select * from pacient";
                c.con.Open();
                MySqlDataReader r = cmd.ExecuteReader();
                while (r.Read())
                {
                    PacientObj product = new PacientObj();
                    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;
        }
        public static PacientObj getById(int product_id)
        {
            Connection   c   = new Connection();
            MySqlCommand cmd = c.con.CreateCommand();

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

            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);
        }
        public static List <PacientObj> getAll()
        {
            List <PacientObj> list = new List <PacientObj>();
            Connection        c    = new Connection();
            MySqlCommand      cmd  = c.con.CreateCommand();

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

            while (r.Read())
            {
                PacientObj product = new PacientObj();
                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);
        }