private void button_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                string          Query     = "insert into hopedatabase.patient_data (`patient_name`, `patient_age`, `patient_contact_no`, `patient_address`, `time_of_admission`, `patient_sex`, `patient_occupation`) values('" + patient_name.Text + "','" + patient_age.Text + "','" + patient_contact_no2.Text + "','" + patient_address.Text + "','" + datepicker.Text + "','" + comboboxPatient_sex.SelectedItem.ToString() + "','" + patient_occupation.Text + "');";
                MySqlCommand    MyCommand = new MySqlCommand(Query, connn);
                MySqlDataReader MyReader;
                MyReader = MyCommand.ExecuteReader();
                MyReader.Close();

                MessageBox.Show("Patient Registered");
                string          Query1     = "insert into hopedatabase.patient_data ( `patient_blood_group` ) values('" + comboboxBloodGroup.SelectedItem.ToString() + "');";
                MySqlCommand    MyCommand1 = new MySqlCommand(Query1, connn);
                MySqlDataReader MyReader1;
                MyReader1 = MyCommand1.ExecuteReader();
                MyReader1.Close();

                patient_name.Text       = ""; patient_address.Text = ""; patient_age.Text = ""; patient_contact_no2.Text = ""; referred_by.Text = ""; datepicker.Text = "";
                patient_occupation.Text = "";
                comboboxBloodGroup.Items.Clear(); comboboxPatient_sex.Items.Clear();

                load_blood_group();

                load();
                patient_name.IsEnabled       = false; patient_address.IsEnabled = false; patient_age.IsEnabled = false; referred_by.IsEnabled = false;
                comboboxBloodGroup.IsEnabled = false;
            }
            catch
            {
            }
            //catch (Exception ex)
            //{
            //    MessageBox.Show(ex.Message);
            //}
        }
Ejemplo n.º 2
0
        private void button_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                string          Query     = "insert into admitted_patient values('" + patient_name.Text + "','" + patient_age.Text + "','" + patient_contact_no.Text + "','" + comboboxBloodGroup.SelectedItem.ToString() + "','" + patient_address.Text + "','" + comboboxDisease.SelectedItem.ToString() + "','" + comboboxDoctorName.SelectedItem.ToString() + "','" + docId + "','" + textboxDoctorDept.Text + "','" + time_of_admission.Text + "','" + this.textboxWard.Text + "', '" + "Admitted" + "');";
                MySqlCommand    MyCommand = new MySqlCommand(Query, conn);
                MySqlDataReader MyReader;
                MyReader = MyCommand.ExecuteReader();
                MyReader.Close();

                string          Query1     = "DROP TABLE ward_bed;";
                MySqlCommand    MyCommand1 = new MySqlCommand(Query1, conn);
                MySqlDataReader MyReader1;
                MyReader1 = MyCommand1.ExecuteReader();
                MyReader1.Close();

                string          Query2     = "CREATE TABLE ward_bed AS SELECT ward.ward_name,bed.pat_contact_no,bed.bed_no,bed.bed_type,bed.bed_cost,bed.bed_status FROM ward,bed WHERE ward.ward_id=bed.ward_id;";
                MySqlCommand    MyCommand2 = new MySqlCommand(Query2, conn);
                MySqlDataReader MyReader2;
                MyReader2 = MyCommand2.ExecuteReader();
                MyReader2.Close();

                string          Query3     = "DROP TABLE allocate_patient_bed;";
                MySqlCommand    MyCommand3 = new MySqlCommand(Query3, conn);
                MySqlDataReader MyReader3;
                MyReader3 = MyCommand3.ExecuteReader();
                MyReader3.Close();

                string          Query4     = "CREATE TABLE allocate_patient_bed AS SELECT admitted_patient.patient_name,admitted_patient.patient_age,admitted_patient.patient_contact_no,ward_bed.ward_name,ward_bed.bed_no,ward_bed.bed_type,ward_bed.bed_cost,ward_bed.bed_status FROM admitted_patient,ward_bed WHERE admitted_patient.patient_contact_no=ward_bed.pat_contact_no AND admitted_patient.ward_name=ward_bed.ward_name;";
                MySqlCommand    MyCommand4 = new MySqlCommand(Query4, conn);
                MySqlDataReader MyReader4;
                MyReader4 = MyCommand4.ExecuteReader();
                MyReader4.Close();


                MessageBox.Show("Patient Addmitted!");

                patient_name.Text = ""; patient_address.Text = ""; patient_age.Text = ""; patient_contact_no.Text = "";
                comboboxBloodGroup.Items.Clear(); comboboxDoctorName.Items.Clear(); comboboxDisease.Items.Clear();
                textboxBed.Text = ""; textboxBedType.Text = ""; textboxWard.Text = ""; textboxDoctorDept.Text = "";
                load_blood_group(); load_disease(); load_doctor_name();

                patient_name.IsEnabled       = false; patient_address.IsEnabled = false; patient_age.IsEnabled = false; patient_contact_no.IsEnabled = false;
                comboboxBloodGroup.IsEnabled = false; comboboxDoctorName.IsEnabled = false; comboboxDisease.IsEnabled = false;
                textboxBed.IsEnabled         = false; textboxBedType.IsEnabled = false; textboxWard.IsEnabled = false; textboxDoctorDept.IsEnabled = false;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        private void btnAddMedicine_Click(object sender, RoutedEventArgs e)
        {
            if (txtMedicineName.Text.Equals("") || comboDiseaseType.Text.Equals("") || comboDiseaseName.Text.Equals("") || txtCompanyName.Text.Equals("") || txtContactNo.Text.Equals("") || txtDate.Text.Equals("") || txtQuantity.Text.Equals("") || txtBuyingPrice.Text.Equals("") || txtSellingPrice.Text.Equals(""))
            {
                MessageBox.Show("Please Fill All the fields");
            }
            else
            {
                try
                {
                    string          Query     = "insert into supplier values('" + txtCompanyName.Text + "','" + txtContactNo.Text + "','" + txtMedicineName.Text + "','" + "Medicine" + "','" + txtDate.Text + "','" + txtQuantity.Text + "','" + txtBuyingPrice.Text + "','" + txtSellingPrice.Text + "');";
                    MySqlCommand    MyCommand = new MySqlCommand(Query, conn);
                    MySqlDataReader MyReader;
                    MyReader = MyCommand.ExecuteReader();
                    MyReader.Close();

                    string          Query1     = "insert into medicine_name values('" + txtMedicineName.Text + "','" + comboDiseaseType.SelectedItem + "','" + comboDiseaseName.SelectedItem + "');";
                    MySqlCommand    MyCommand1 = new MySqlCommand(Query1, conn);
                    MySqlDataReader MyReader1;
                    MyReader1 = MyCommand1.ExecuteReader();
                    MyReader1.Close();

                    MessageBox.Show("Medicine added");

                    txtMedicineName.Text     = "";
                    txtCompanyName.Text      = "";
                    txtContactNo.Text        = "";
                    txtDate.Text             = "";
                    txtQuantity.Text         = "";
                    txtBuyingPrice.Text      = "";
                    txtSellingPrice.Text     = "";
                    btnAddMedicine.IsEnabled = false;
                    comboDiseaseType.Items.Clear();
                    load_combo_disease_typee();

                    txtCompanyName.IsEnabled   = false;
                    txtContactNo.IsEnabled     = false;
                    txtDate.IsEnabled          = false;
                    txtQuantity.IsEnabled      = false;
                    txtBuyingPrice.IsEnabled   = false;
                    txtSellingPrice.IsEnabled  = false;
                    comboDiseaseType.IsEnabled = false;
                    comboDiseaseName.IsEnabled = false;
                }
                catch (Exception exp)
                {
                    MessageBox.Show(exp.Message);
                }
            }
        }
Ejemplo n.º 4
0
 private void btnPass_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         con.Open();
         string          sql1       = "update staff set staff_password='******' where staff_id='" + textBox1.Text + "';";
         MySqlCommand    MyCommand1 = new MySqlCommand(sql1, con);
         MySqlDataReader MyReader1;
         MyReader1 = MyCommand1.ExecuteReader();
         MyReader1.Close();
         MessageBox.Show("Password Updated Succesfully");
         staffPass.Text = "";
         con.Close();
     }
     catch (Exception eee)
     {
         MessageBox.Show(eee.Message.ToString());
     }
 }
        private void btnReleasePatient_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                string          Query     = "insert into release_patient values('" + txtPatientName.Text + "','" + txtPatientAge.Text + "','" + txtContactNo.Text + "','" + txtPatientAddress.Text + "','" + txtDisease.Text + "','" + txtDocName.Text + "','" + txtDateOfAdmit.Text + "','" + txtDateOfRelease.Text + "','" + txtDays.Text + "','" + txtMedicineCost.Text + "','" + txtTestCost.Text + "', '" + txtBedCost.Text + "', '" + txtTotalCost.Text + "');";
                MySqlCommand    MyCommand = new MySqlCommand(Query, conn);
                MySqlDataReader MyReader;
                MyReader = MyCommand.ExecuteReader();
                MyReader.Close();
                MessageBox.Show("Patient Released!");

                string          Query1     = "update admitted_patient set checked_status='" + "Released" + "' where patient_contact_no='" + txtContactNo.Text + "';";
                MySqlCommand    MyCommand1 = new MySqlCommand(Query1, conn);
                MySqlDataReader MyReader1;
                MyReader1 = MyCommand1.ExecuteReader();
                MyReader1.Close();


                //These 3 block codes are responsible for free-ing the bed.
                string          Query2     = "update bed set pat_contact_no='" + "" + "', bed_status='" + "Free" + "' where pat_contact_no='" + txtContactNo.Text + "';";
                MySqlCommand    MyCommand2 = new MySqlCommand(Query2, conn);
                MySqlDataReader MyReader2;
                MyReader2 = MyCommand2.ExecuteReader();
                MyReader2.Close();

                //SELECT ward.ward_name,bed.pat_contact_no, bed.bed_no,bed.bed_type ,bed.bed_cost, bed.bed_status FROM ward,bed WHERE ward.ward_id = bed.ward_id

                string          Query3     = "DROP TABLE ward_bed;";
                MySqlCommand    MyCommand3 = new MySqlCommand(Query3, conn);
                MySqlDataReader MyReader3;
                MyReader3 = MyCommand3.ExecuteReader();
                MyReader3.Close();

                string          Query4     = "CREATE TABLE ward_bed AS SELECT ward.ward_name,bed.pat_contact_no, bed.bed_no,bed.bed_type ,bed.bed_cost, bed.bed_status FROM ward,bed WHERE ward.ward_id = bed.ward_id;";
                MySqlCommand    MyCommand4 = new MySqlCommand(Query4, conn);
                MySqlDataReader MyReader4;
                MyReader4 = MyCommand4.ExecuteReader();
                MyReader4.Close();


                string          Query5     = "DROP TABLE user.allocate_patient_bed;";
                MySqlCommand    MyCommand5 = new MySqlCommand(Query5, conn);
                MySqlDataReader MyReader5;
                MyReader5 = MyCommand5.ExecuteReader();
                MyReader5.Close();

                string          Query6     = "CREATE TABLE allocate_patient_bed AS SELECT admitted_patient.patient_name,admitted_patient.patient_age,admitted_patient.patient_contact_no,ward_bed.ward_name,ward_bed.bed_no,ward_bed.bed_type,ward_bed.bed_cost,ward_bed.bed_status FROM admitted_patient,ward_bed WHERE admitted_patient.patient_contact_no=ward_bed.pat_contact_no AND admitted_patient.ward_name=ward_bed.ward_name;";
                MySqlCommand    MyCommand6 = new MySqlCommand(Query6, conn);
                MySqlDataReader MyReader6;
                MyReader6 = MyCommand6.ExecuteReader();
                MyReader6.Close();

                txtContactNo.Text           = ""; txtPatientAge.Text = ""; txtPatientAddress.Text = ""; txtDateOfRelease.Text = "";
                txtPatientName.Text         = ""; txtDisease.Text = ""; txtDocName.Text = ""; txtDateOfAdmit.Text = "";
                txtMedicineCost.Text        = ""; txtBedCost.Text = ""; txtTestCost.Text = ""; txtTotalCost.Text = ""; txtDays.Text = "";
                btnReleasePatient.IsEnabled = false;

                /*string Query5 = "select quantity,days from user.admitted_medicine where product_name='" + comboboxMedicineName.SelectedItem + "';";
                 * MySqlCommand MyCommand5 = new MySqlCommand(Query5, conn);
                 * MySqlDataReader MyReader5;
                 * MyReader5 = MyCommand5.ExecuteReader();
                 * while (MyReader5.Read())
                 * {
                 *  string medquantyty = MyReader5.GetString(0);
                 *  x = Int32.Parse(medquantyty);
                 *  string c = this.quantity.Text;
                 *  y = Int32.Parse(c);
                 *
                 *  x = x - y;
                 * }
                 * MyReader5.Close();
                 *
                 * string Query6 = "update user.supplier set quantity='" + x.ToString() + "' where product_name='" + comboboxMedicineName.SelectedItem + "' ;";
                 * MySqlCommand MyCommand6 = new MySqlCommand(Query6, conn);
                 * MySqlDataReader MyReader6;
                 * MyReader6 = MyCommand6.ExecuteReader();
                 * MyReader6.Close();*/
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        private void Submit_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (check().Equals("Accepted"))
                {
                    Query1 = "DROP TABLE user.appointment_medicine;";
                    Query2 = "CREATE TABLE user.appointment_medicine AS SELECT appointment.pat_name,appointment.pat_contact_no,appointment.appointment_date,appointment.pat_age,medicine.disease,medicine.product_name,medicine.quantity,medicine.days,medicine.time_of_day FROM appointment,medicine WHERE user.appointment.pat_contact_no=user.medicine.pat_contact_no AND user.appointment.appointment_date=user.medicine.appointment_date;";
                    Query9 = "DROP TABLE user.appointment_test;";
                    Query8 = "CREATE TABLE user.appointment_test AS SELECT appointment.pat_name,appointment.pat_contact_no,appointment.appointment_date,appointment.pat_age,test.test_name FROM appointment,test WHERE user.appointment.pat_contact_no=user.test.pat_contact_no AND user.appointment.appointment_date=user.test.appointment_date;";
                    Query3 = "update user.appointment set appointment_status='" + "Checked" + "' where pat_contact_no='" + checkpatientContactNo.Text.ToString() + "' and appointment_date='" + checkpatientDate.Text.ToString() + "';";
                }

                if (check().Equals("Admitted"))
                {
                    Query1 = "DROP TABLE user.admitted_medicine;";
                    Query2 = "CREATE TABLE user.admitted_medicine AS SELECT admitted_patient.patient_name,admitted_patient.patient_contact_no,admitted_patient.time_of_admission,admitted_patient.patient_age,medicine.disease,medicine.product_name,medicine.quantity,medicine.days,medicine.time_of_day FROM admitted_patient,medicine WHERE user.admitted_patient.patient_contact_no=user.medicine.pat_contact_no AND user.admitted_patient.time_of_admission=user.medicine.appointment_date;";
                    Query9 = "DROP TABLE user.admitted_test;";
                    Query8 = "CREATE TABLE user.admitted_test AS SELECT admitted_patient.patient_name,admitted_patient.patient_contact_no,admitted_patient.time_of_admission,admitted_patient.patient_age,test.test_name FROM admitted_patient,test WHERE user.admitted_patient.patient_contact_no=user.test.pat_contact_no AND user.admitted_patient.time_of_admission=user.test.appointment_date;";
                    Query3 = "update user.admitted_patient set checked_status='" + "Checked" + "' where patient_contact_no='" + checkpatientContactNo.Text.ToString() + "' and time_of_admission='" + checkpatientDate.Text.ToString() + "';";
                }

                conn.Open();
                MySqlCommand    MyCommand1 = new MySqlCommand(Query1, conn);
                MySqlDataReader MyReader1;
                MyReader1 = MyCommand1.ExecuteReader();
                MyReader1.Close();
                //conn.Close();

                MySqlCommand    MyCommand2 = new MySqlCommand(Query2, conn);
                MySqlDataReader MyReader2;
                MyReader2 = MyCommand2.ExecuteReader();
                MyReader2.Close();

                MySqlCommand    MyCommand9 = new MySqlCommand(Query9, conn);
                MySqlDataReader MyReader9;
                MyReader9 = MyCommand9.ExecuteReader();
                MyReader9.Close();

                //conn.Open();
                MySqlCommand    MyCommand8 = new MySqlCommand(Query8, conn);
                MySqlDataReader MyReader8;
                MyReader8 = MyCommand8.ExecuteReader();
                MyReader8.Close();

                MySqlCommand    MyCommand3 = new MySqlCommand(Query3, conn);
                MySqlDataReader MyReader3;
                MyReader3 = MyCommand3.ExecuteReader();
                MyReader3.Close();
                //conn.Close();


                MessageBox.Show("Patient checked Succesfully . . .");

                this.checkpatientAge.Text       = "";
                this.checkpatientContactNo.Text = "";
                this.checkpatientDate.Text      = "";
                this.comboboxDiseaseType.Text   = "";
                this.checkpatientName.Text      = "";
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        private void Submit_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (check().Equals("Accepted"))
                {
                    Query1 = "DROP TABLE user.appointment_medicine;";
                    Query2 = "CREATE TABLE user.appointment_medicine AS SELECT appointment.pat_name,appointment.pat_contact_no,appointment.appointment_date,appointment.pat_age,medicine.disease,medicine.product_name,medicine.quantity,medicine.days,medicine.time_of_day FROM appointment,medicine WHERE user.appointment.pat_contact_no=user.medicine.pat_contact_no AND user.appointment.appointment_date=user.medicine.appointment_date;";
                    Query9 = "DROP TABLE user.appointment_test;";
                    Query8 = "CREATE TABLE user.appointment_test AS SELECT appointment.pat_name,appointment.pat_contact_no,appointment.appointment_date,appointment.pat_age,test.test_name FROM appointment,test WHERE user.appointment.pat_contact_no=user.test.pat_contact_no AND user.appointment.appointment_date=user.test.appointment_date;";
                    Query3 = "update user.appointment set appointment_status='" + "Checked" + "' where pat_contact_no='" + checkpatientContactNo.Text.ToString() + "' and appointment_date='" + checkpatientDate.Text.ToString() + "';";
                    i      = 1;
                }

                if (check().Equals("Admitted"))
                {
                    Query1 = "DROP TABLE user.admitted_medicine;";
                    Query2 = "CREATE TABLE user.admitted_medicine AS SELECT admitted_patient.patient_name,admitted_patient.patient_contact_no,admitted_patient.time_of_admission,admitted_patient.patient_age,medicine.disease,medicine.product_name,medicine.quantity,medicine.days,medicine.time_of_day FROM admitted_patient,medicine WHERE user.admitted_patient.patient_contact_no=user.medicine.pat_contact_no AND user.admitted_patient.time_of_admission=user.medicine.appointment_date;";
                    Query9 = "DROP TABLE user.admitted_test;";
                    Query8 = "CREATE TABLE user.admitted_test AS SELECT admitted_patient.patient_name,admitted_patient.patient_contact_no,admitted_patient.time_of_admission,admitted_patient.patient_age,test.test_name FROM admitted_patient,test WHERE user.admitted_patient.patient_contact_no=user.test.pat_contact_no AND user.admitted_patient.time_of_admission=user.test.appointment_date;";
                    Query3 = "update user.admitted_patient set checked_status='" + "Checked" + "' where patient_contact_no='" + checkpatientContactNo.Text + "' and time_of_admission='" + checkpatientDate.Text + "';";
                    i      = 0;
                }

                conn.Open();

                MySqlCommand    MyCommand1 = new MySqlCommand(Query1, conn);
                MySqlDataReader MyReader1;
                MyReader1 = MyCommand1.ExecuteReader();
                MyReader1.Close();

                MySqlCommand    MyCommand2 = new MySqlCommand(Query2, conn);
                MySqlDataReader MyReader2;
                MyReader2 = MyCommand2.ExecuteReader();
                MyReader2.Close();

                MySqlCommand    MyCommand9 = new MySqlCommand(Query9, conn);
                MySqlDataReader MyReader9;
                MyReader9 = MyCommand9.ExecuteReader();
                MyReader9.Close();

                MySqlCommand    MyCommand8 = new MySqlCommand(Query8, conn);
                MySqlDataReader MyReader8;
                MyReader8 = MyCommand8.ExecuteReader();
                MyReader8.Close();

                MySqlCommand    MyCommand3 = new MySqlCommand(Query3, conn);
                MySqlDataReader MyReader3;
                MyReader3 = MyCommand3.ExecuteReader();
                MyReader3.Close();

                if (i == 0)
                {
                    string Query67 = "DROP TABLE user.admitted_medicine_cost;";
                    string Query68 = "CREATE TABLE admitted_medicine_cost AS SELECT admitted_medicine.patient_name,admitted_medicine.patient_contact_no,admitted_medicine.time_of_admission, admitted_medicine.patient_age, admitted_medicine.disease,admitted_medicine.product_name,admitted_medicine.quantity, admitted_medicine.days,admitted_medicine.time_of_day,supplier.selling_price FROM admitted_medicine,supplier WHERE admitted_medicine.product_name = supplier.product_name;";
                    string Query69 = "DROP TABLE admitted_test_cost;";
                    string Query70 = "CREATE TABLE admitted_test_cost AS SELECT admitted_test.patient_name,admitted_test.patient_contact_no,admitted_test.time_of_admission,admitted_test.patient_age,admitted_test.test_name,test_name.test_cost FROM admitted_test,test_name WHERE admitted_test.test_name=test_name.test_Name;";

                    MySqlCommand    MyCommand67 = new MySqlCommand(Query67, conn);
                    MySqlDataReader MyReader67;
                    MyReader67 = MyCommand67.ExecuteReader();
                    MyReader67.Close();

                    MySqlCommand    MyCommand68 = new MySqlCommand(Query68, conn);
                    MySqlDataReader MyReader68;
                    MyReader68 = MyCommand68.ExecuteReader();
                    MyReader68.Close();

                    MySqlCommand    MyCommand69 = new MySqlCommand(Query69, conn);
                    MySqlDataReader MyReader69;
                    MyReader69 = MyCommand69.ExecuteReader();
                    MyReader69.Close();

                    MySqlCommand    MyCommand70 = new MySqlCommand(Query70, conn);
                    MySqlDataReader MyReader70;
                    MyReader70 = MyCommand70.ExecuteReader();
                    MyReader70.Close();
                }

                MessageBox.Show("Patient checked Succesfully . . .");

                this.checkpatientAge.Text       = "";
                this.checkpatientContactNo.Text = "";
                this.checkpatientDate.Text      = "";
                this.comboboxDiseaseType.Text   = "";
                this.checkpatientName.Text      = "";

                datagridMedicineList.ItemsSource = null;
                datagridMedicineList.Items.Refresh();
                datagridTest.ItemsSource = null;
                datagridTest.Items.Refresh();

                this.Visibility = Visibility.Hidden;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }