Exemple #1
0
        private void btn_SearchPatient_Click(object sender, EventArgs e)
        {
            dictionary = new Dictionary <string, string>();
            dc         = new DatabaseConnector();

            if (txt_Output.Text != "")
            {
                bool temp = false;
                int  temp1;
                try
                {
                    temp1 = Convert.ToInt32(txt_Output.Text);
                    temp  = true;
                }
                catch (Exception ex)
                {
                    temp = false;
                }
                if (cm_Options.SelectedIndex == 1 && temp == true)
                {
                    dictionary.Add("@patientId", txt_Output.Text);
                    dtPatient = dc.getData("CheckPatientExists", dictionary);
                    if (dtPatient.Rows.Count != 0)
                    {
                        dataGridView2.Hide();
                        dataGridView1.Show();
                        this.getPatientByIdTableAdapter.Fill(searchPatientByIdDataSet.GetPatientById, txt_Output.Text);
                    }
                    else
                    {
                        MessageBox.Show("Patient does not exist.");
                        DialogResult result = MessageBox.Show("Create New Patient Demography?", "New Demography", MessageBoxButtons.OKCancel,
                                                              MessageBoxIcon.Question);

                        if (result == DialogResult.OK)
                        {
                            this.Hide();
                            CreateDemForm create = new CreateDemForm();

                            create.Show();
                        }
                    }
                }
                else if (cm_Options.SelectedIndex == 2)
                {
                    dictionary.Add("@patientName", txt_Output.Text);
                    dtPatient = dc.getData("CheckPatientExistsByName", dictionary);
                    if (dtPatient.Rows.Count != 0)
                    {
                        dataGridView1.Hide();
                        dataGridView2.Show();
                        this.getPatientByNameTableAdapter.Fill(searchPatientByNameDataSet.GetPatientByName, txt_Output.Text.ToString());
                    }
                    else
                    {
                        MessageBox.Show("Patient does not exist.");
                        DialogResult result = MessageBox.Show("Create New Patient Demography?", "New Demography", MessageBoxButtons.OKCancel,
                                                              MessageBoxIcon.Question);

                        if (result == DialogResult.OK)
                        {
                            this.Hide();
                            CreateDemForm create = new CreateDemForm();
                            create.Show();
                        }
                    }
                }
                else
                {
                    MessageBox.Show("Please proper search text!");
                    txt_Output.Focus();
                }
            }
        }
        public void testCreateDemFormCreate()
        {
            CreateDemForm a = new CreateDemForm();

            Assert.IsNotNull(a);
        }