Esempio n. 1
0
        private void guna2Button1_Click(object sender, EventArgs e)
        {
            try
            {
                string       patientNic  = nic.Text;
                DBconnection connection2 = new DBconnection();

                if (connection2.searchPatient(patientNic))
                {
                    int       counter             = 0;
                    ArrayList patientDetailsArray = new ArrayList();
                    //MessageBox.Show("Patient Found?", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    patientDetailsArray = connection2.getPatientDetails(patientNic);

                    foreach (string i in patientDetailsArray)
                    {
                        Console.WriteLine("\n console: " + i + " counter: " + counter);
                        if (counter == 0)
                        {
                            name.Text = i;
                        }
                        if (counter == 1)
                        {
                            dob.Value = DateTime.Parse(i);
                        }
                        //if (counter == 0)
                        //{
                        //    name.Text = i;
                        //}
                        if (counter == 2)
                        {
                            if (i.Equals("Male"))
                            {
                                male.Checked = true;
                            }
                            else if (i.Equals("Female"))
                            {
                                female.Checked = true;
                            }
                            else
                            {
                                other.Checked = true;
                            }
                        }
                        if (counter == 4)
                        {
                            contact.Text = i;
                        }
                        else
                        {
                            address.Text = i;
                        }
                        counter++;
                    }
                }
                else
                {
                    MessageBox.Show("No Patient Found?", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("No Patient Found ?", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Console.WriteLine("error search: " + ex);
            }
        }