Beispiel #1
0
        //NO LA TOQUEN
        private void btn_search_Click(object sender, EventArgs e)
        {
            string selected = cb_filter.SelectedItem.ToString();

            string[]       valuesC  = Patient.cadenaValues();
            string[]       valuesN  = Patient.numericValues();
            string[]       valuesB  = Patient.binariValue();
            List <Patient> patients = new List <Patient>();

            try
            {
                if (valuesC.Contains(selected))
                {
                    int id = int.Parse(tb_cadena.Text);
                    patients = controller.search(id);
                }
                else if (valuesN.Contains(selected))
                {
                    int lower  = Math.Abs(int.Parse(tb_lower.Text));
                    int higger = Math.Abs(int.Parse(tb_higger.Text));
                    if (higger < lower)
                    {
                        int aux = lower;
                        lower  = higger;
                        higger = aux;
                    }
                    tb_lower.Text  = lower.ToString();
                    tb_higger.Text = higger.ToString();

                    patients = controller.search(selected, lower, higger);
                }
                else if (valuesB.Contains(selected))
                {
                    int value = int.Parse(cb_choose.SelectedItem.ToString());
                    patients = controller.search(selected, value);
                }
                else
                {
                    patients = controller.patient();
                }
                grid_data.DataSource = patients;
            }
            catch (FormatException t)
            {
                Console.WriteLine(t.Message);
            }
        }
Beispiel #2
0
        private void tableLayoutPanel1_Paint(object sender, PaintEventArgs e)
        {
            string selected = cb_filter.SelectedItem.ToString();

            string[]       valuesC = controller.valuesC();
            string[]       valuesN = controller.valuesN();
            string[]       valuesB = controller.valuesB();
            List <Patient> patients;

            try
            {
                if (valuesC.Contains(selected))
                {
                    int id = int.Parse(tb_cadena.Text);
                    patients = controller.search(id);
                }
                else if (valuesN.Contains(selected))
                {
                    int lower  = Math.Abs(int.Parse(tb_lower.Text));
                    int higger = Math.Abs(int.Parse(tb_higger.Text));
                    if (higger < lower)
                    {
                        int aux = lower;
                        lower  = higger;
                        higger = aux;
                    }
                    tb_lower.Text  = lower.ToString();
                    tb_higger.Text = higger.ToString();

                    patients = controller.search(selected, lower, higger);
                }
                else if (valuesB.Contains(selected))
                {
                    int value = int.Parse(cb_choose.SelectedItem.ToString());
                    patients = controller.search(selected, value);
                }
                else
                {
                    patients = controller.patient();
                }
                gridPatients.loadGrid(patients);
            }
            catch (FormatException t)
            {
                Console.WriteLine(t.Message);
            }
        }