Beispiel #1
0
        private void Guest_Load(object sender, EventArgs e)
        {
            SearchInCB();

            Disease d = new Disease();

            d.DiseaseLoadGuest(dataGridView1);

            SqlCommand cmd = new SqlCommand();

            cmd.CommandText = "Select NameDisease From Disease";
            cmd.Connection  = sqlConnection;

            sqlConnection.Open();
            SqlDataReader reader = cmd.ExecuteReader();

            while (reader.Read())
            {
                comboBox1.Items.Add(reader["NameDisease"]);
            }
            reader.Close();
            sqlConnection.Close();
            ///////////////////////////////////////////////////////////////////////
            Forms f = new Forms();

            f.FormGuestLoad(dataGridView2);

            cmd.CommandText = "Select FormName From Forms";
            cmd.Connection  = sqlConnection;

            sqlConnection.Open();
            SqlDataReader reader1 = cmd.ExecuteReader();

            while (reader1.Read())
            {
                comboBox2.Items.Add(reader1["FormName"]);
            }
            reader1.Close();
            sqlConnection.Close();
            ///////////////////////////////////////////////////////////////////////
            Manufacturer man = new Manufacturer();

            man.ManGuestLoad(dataGridView3);

            cmd.CommandText = "Select NameManufacturer From Manufacturer";
            cmd.Connection  = sqlConnection;

            sqlConnection.Open();
            SqlDataReader reader2 = cmd.ExecuteReader();

            while (reader2.Read())
            {
                comboBox3.Items.Add(reader2["NameManufacturer"]);
            }
            reader2.Close();
            sqlConnection.Close();
            ///////////////////////////////////////////////////////////////////////
            Medicine med = new Medicine();

            med.MedGuestLoad(dataGridView4);


            cmd.CommandText = "Select NameMedicine From Medicine";
            cmd.Connection  = sqlConnection;

            sqlConnection.Open();
            SqlDataReader reader3 = cmd.ExecuteReader();

            while (reader3.Read())
            {
                comboBox4.Items.Add(reader3["NameMedicine"]);
            }
            reader3.Close();
            sqlConnection.Close();
            ///////////////////////////////////////////////////////////////////////


            cmd.CommandText = "Select NameSymptom From Symptom";
            cmd.Connection  = sqlConnection;

            sqlConnection.Open();
            SqlDataReader reader4 = cmd.ExecuteReader();

            while (reader4.Read())
            {
                comboBox5.Items.Add(reader4["NameSymptom"]);
            }
            reader4.Close();
            sqlConnection.Close();

            //////////////////////////////////////////////////////////////

            cmd.CommandText = "Select NameSymptom From Symptom";
            cmd.Connection  = sqlConnection;

            sqlConnection.Open();
            SqlDataReader reader5 = cmd.ExecuteReader();

            while (reader5.Read())
            {
                comboBox7.Items.Add(reader5["NameSymptom"]);
            }
            reader5.Close();
            sqlConnection.Close();

            /////////////////////////////////////////////////////////////

            sqlConnection.Open();
            string          query   = "Select FormName, NameMedicine, NameManufacturer, Duration, Frequency, Age_From, Age_To, Healing, Dosage From((Forms inner join MedicineForms on Forms.ID_Form = MedicineForms.ID_Form)inner join Medicine on MedicineForms.ID_Medicine = Medicine.ID_Medicine) inner join Manufacturer on MedicineForms.ID_Manufacturer = Manufacturer.ID_Manufacturer ";
            List <string[]> data    = new List <string[]>();
            SqlCommand      command = new SqlCommand(query, sqlConnection);
            SqlDataReader   reader6 = command.ExecuteReader();

            while (reader6.Read())
            {
                data.Add(new string[9]);
                data[data.Count - 1][0] = reader6[0].ToString();
                data[data.Count - 1][1] = reader6[1].ToString();
                data[data.Count - 1][2] = reader6[2].ToString();
                data[data.Count - 1][3] = reader6[3].ToString();
                data[data.Count - 1][4] = reader6[4].ToString();
                data[data.Count - 1][5] = reader6[5].ToString();
                data[data.Count - 1][6] = reader6[6].ToString();
                data[data.Count - 1][7] = reader6[7].ToString();
                data[data.Count - 1][8] = reader6[8].ToString();
            }
            foreach (string[] s in data)
            {
                dataGridView5.Rows.Add(s);
            }
            sqlConnection.Close();

            ////////////////////////////////////////////////////////////////



            ///////////////////////////////////////////////////////////////////////
            sqlConnection.Open();
            string          query2   = "select NameManufacturer, NameMedicine From (Manufacturer inner join MedManufacturer on Manufacturer.ID_Manufacturer = MedManufacturer.ID_Manufacturer) inner join Medicine on MedManufacturer.ID_Medicine = Medicine.ID_Medicine ";
            List <string[]> data2    = new List <string[]>();
            SqlCommand      command2 = new SqlCommand(query2, sqlConnection);
            SqlDataReader   reader8  = command2.ExecuteReader();

            while (reader8.Read())
            {
                data2.Add(new string[2]);
                data2[data2.Count - 1][0] = reader8[0].ToString();
                data2[data2.Count - 1][1] = reader8[1].ToString();
            }
            foreach (string[] s in data2)
            {
                dataGridView7.Rows.Add(s);
            }
            sqlConnection.Close();

            ////////////////////////////////////////////////////////
            sqlConnection.Open();
            string          query3   = "select NameSymptom From Symptom";
            List <string[]> data3    = new List <string[]>();
            SqlCommand      command3 = new SqlCommand(query3, sqlConnection);
            SqlDataReader   reader9  = command3.ExecuteReader();

            while (reader9.Read())
            {
                data3.Add(new string[1]);
                data3[data3.Count - 1][0] = reader9[0].ToString();
            }
            foreach (string[] s in data3)
            {
                dataGridView8.Rows.Add(s);
            }
            sqlConnection.Close();
        }
        private void button1_Click(object sender, EventArgs e)
        {
            Medicine med = new Medicine();

            med.InsertMedicine(textBox1, textBox2, mf.dataGridView4);
        }
        private void MedicineForm_Load(object sender, EventArgs e)
        {
            Medicine med = new Medicine();

            med.MedicineLoad(dataGridView4);
        }
Beispiel #4
0
        private void button1_Click(object sender, EventArgs e)
        {
            Medicine med = new Medicine();

            med.UpdateMedicine(comboBox1, textBox2, textBox1, mf.dataGridView4);
        }