private void dothesearch()
        {
            if (txtBoxSearchAimodoti.Text != "")
            {
                AimodotisAnazitisis = null;
                this.aimodotesTableAdapter.Fill(ptuxiakiDatabaseDataSet1.Aimodotes);
                DataRow[] grammes;
                int count_results;
                int idAimodoti;
                bool is_int = int.TryParse(txtBoxSearchAimodoti.Text, out idAimodoti);
                if (is_int)
                {
                    grammes = ptuxiakiDatabaseDataSet1.Tables["Aimodotes"].Select("ID = '" + txtBoxSearchAimodoti.Text + "'");
                }
                else
                {
                    txtBoxSearchAimodoti.Text = txtBoxSearchAimodoti.Text.Replace('*', '%');
                    grammes = ptuxiakiDatabaseDataSet1.Tables["Aimodotes"].Select("Name LIKE '" + txtBoxSearchAimodoti.Text + "' or LastName LIKE '" + txtBoxSearchAimodoti.Text + "'");
                }

                count_results = grammes.Length;
                if (count_results > 1)
                {
                    textboxes_enable(true);
                    stoixeio = txtBoxSearchAimodoti.Text;
                    FormEpilogiAimodoti_Edit AimodotiEpilogi_Show_A = new FormEpilogiAimodoti_Edit();
                    if (AimodotiEpilogi_Show_A.ShowDialog() == DialogResult.OK)
                    {
                        AimodotisAnazitisis = grammes[0];
                        txtBoxName.Text = AimodotisAnazitisis[0].ToString();
                        txtBoxLastName.Text = AimodotisAnazitisis[1].ToString();
                        txtBoxFatherName.Text = AimodotisAnazitisis[3].ToString();
                        txtBoxOmadaAimatos.Text = AimodotisAnazitisis[4].ToString();
                        txtBoxRhesus.Text = AimodotisAnazitisis[5].ToString();
                        txtBoxBirthYear.Text = AimodotisAnazitisis[6].ToString();
                        txtBoxJob.Text = AimodotisAnazitisis[7].ToString();
                        txtBoxAddress.Text = AimodotisAnazitisis[8].ToString();
                        txtBoxPhone1.Text = AimodotisAnazitisis[9].ToString();
                        txtBoxPhone2.Text = AimodotisAnazitisis[10].ToString();
                    }
                }
                if (count_results == 1)
                {
                    textboxes_enable(true);
                    AimodotisAnazitisis = grammes[0];
                    txtBoxName.Text = AimodotisAnazitisis[0].ToString();
                    txtBoxLastName.Text = AimodotisAnazitisis[1].ToString();
                    txtBoxFatherName.Text = AimodotisAnazitisis[3].ToString();
                    txtBoxOmadaAimatos.Text = AimodotisAnazitisis[4].ToString();
                    txtBoxRhesus.Text = AimodotisAnazitisis[5].ToString();
                    txtBoxBirthYear.Text = AimodotisAnazitisis[6].ToString();
                    txtBoxJob.Text = AimodotisAnazitisis[7].ToString();
                    txtBoxAddress.Text = AimodotisAnazitisis[8].ToString();
                    txtBoxPhone1.Text = AimodotisAnazitisis[9].ToString();
                    txtBoxPhone2.Text = AimodotisAnazitisis[10].ToString();
                }
                if (count_results == 0)
                {
                    MessageBox.Show("Δεν βρέθηκε η εγγραφή!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    txtBoxSearchAimodoti.Focus();
                    txtBoxSearchAimodoti.SelectAll();
                }
            }
        }
Ejemplo n.º 2
0
        private void SearchAimodoti()
        {
            if (TextBoxSearchAimodoti.Text != "")
            {
                AimodotisAnazitisis = null;
                this.aimodotesTableAdapter1.Fill(ptuxiakiDatabaseDataSet11.Aimodotes);
                DataRow[] grammes;
                int count_results = 0;
                int idAimodoti;
                bool idgiven = int.TryParse(TextBoxSearchAimodoti.Text, out idAimodoti);
                if (idgiven)
                {
                    grammes = ptuxiakiDatabaseDataSet11.Tables["Aimodotes"].Select("ID='" + TextBoxSearchAimodoti.Text + "'");
                    count_results = grammes.Length;
                    if (count_results != 0)
                    {
                        AimodotisAnazitisis = grammes[0];
                    }
                    else
                    {
                        MessageBox.Show("Δεν βρέθηκε ο Αιμοδότης!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
                else
                {
                    TextBoxSearchAimodoti.Text = TextBoxSearchAimodoti.Text.Replace('*', '%');
                    grammes = ptuxiakiDatabaseDataSet11.Tables["Aimodotes"].Select("Name LIKE '" + TextBoxSearchAimodoti.Text + "' or LastName LIKE '" + TextBoxSearchAimodoti.Text + "'");
                    count_results = grammes.Length;

                    if (count_results > 1)
                    {
                        stoixeio = TextBoxSearchAimodoti.Text;
                        FormEpilogiAimodoti_Edit epilogiaimodoti = new FormEpilogiAimodoti_Edit();
                        epilogiaimodoti.stoixeio = stoixeio;
                        if (epilogiaimodoti.ShowDialog() == DialogResult.OK)
                        {
                            AimodotisAnazitisis = epilogiaimodoti.AimodotisAnazitishs;
                        }
                    }
                    if (count_results == 1)
                    {
                        AimodotisAnazitisis = grammes[0];
                    }
                    if (count_results == 0)
                    {
                        MessageBox.Show("Δεν βρέθηκε ο Αιμοδότης!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }

            }
        }
Ejemplo n.º 3
0
        private void dothesearch()
        {
            if (TextBoxSearchAimodoti.Text != "")
            {
                int count_results = 0;
                DataRow[] grammes;
                this.aimodotesTableAdapter1.Fill(ptuxiakiDatabaseDataSet11.Aimodotes);
                int idAimodoti;
                bool is_int = int.TryParse(TextBoxSearchAimodoti.Text, out idAimodoti);
                if (is_int)
                {
                    grammes = ptuxiakiDatabaseDataSet11.Tables["Aimodotes"].Select("ID = '" + TextBoxSearchAimodoti.Text + "'");
                }
                else
                {
                    TextBoxSearchAimodoti.Text = TextBoxSearchAimodoti.Text.Replace('*', '%');
                    grammes = ptuxiakiDatabaseDataSet11.Tables["Aimodotes"].Select("LastName LIKE '" + TextBoxSearchAimodoti.Text + "' or Name LIKE '" + TextBoxSearchAimodoti.Text + "'");
                }

                count_results = grammes.Length;
                if (count_results > 1)
                {

                    stoixeio = TextBoxSearchAimodoti.Text;
                    FormEpilogiAimodoti_Edit epilogiAimodoti=new FormEpilogiAimodoti_Edit();
                    epilogiAimodoti.stoixeio = stoixeio;
                    if (epilogiAimodoti.ShowDialog() == DialogResult.OK)
                    {
                        AimodotisAnazitisis = epilogiAimodoti.AimodotisAnazitishs;
                        FormFindAimodotiFromMain AimodotiEpilogi_Show_A = new FormFindAimodotiFromMain();
                        AimodotiEpilogi_Show_A.AimodotisAnazitisis = AimodotisAnazitisis;
                        AimodotiEpilogi_Show_A.Show();
                    }

                }
                if (count_results == 1)
                {
                    MessageBox.Show("Ο Αιμοδότης βρέθηκε", "Found !", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    FormFindAimodotiFromMain findaimodotis = new FormFindAimodotiFromMain();
                    findaimodotis.AimodotisAnazitisis=grammes[0];
                    findaimodotis.Show();
                }
                if (count_results == 0)
                {
                    MessageBox.Show("Δεν βρέθηκε ο Αιμοδότης!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
        }