Ejemplo n.º 1
0
        public void insertar(MySqlCommand cmd, MySqlConnection conexion)
        {
            try
            {
                verificarconexion(conexion);
                using (conexion)
                {
                    try
                    {
                        MySqlDataReader MyReader2;
                        MyReader2 = cmd.ExecuteReader();     // Here our query will be executed and data saved into the database.
                        //   MessageBox.Show("Dato Guardado");
                        while (MyReader2.Read())
                        {
                        }
                        MyReader2.Close();
                    }

                    catch (Exception e)
                    {
                        MessageBox.Show(e.ToString());
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
        private void button_delete_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                string          sql        = "delete from hopedatabase.patient_data where patient_id='" + patient_ID.Text + "';";
                MySqlCommand    MyCommand2 = new MySqlCommand(sql, connn);
                MySqlDataReader MyReader2;
                MyReader2 = MyCommand2.ExecuteReader();
                MyReader2.Close();
                MessageBox.Show("Patient Deleted");
                patient_name.Text       = ""; patient_address.Text = ""; patient_age.Text = ""; patient_contact_no2.Text = ""; referred_by.Text = ""; datepicker.Text = "";
                patient_occupation.Text = "";
                comboboxBloodGroup.Items.Clear();

                load_patient_id();
                load();
                load_blood_group();
                load_sex();
                patient_name.IsEnabled       = false; patient_address.IsEnabled = false; patient_age.IsEnabled = false; referred_by.IsEnabled = false; patient_occupation.IsEnabled = false;
                comboboxBloodGroup.IsEnabled = false;
            }
            catch (Exception eee)
            {
                MessageBox.Show(eee.Message.ToString());
            }
        }
Ejemplo n.º 3
0
 public void InsertThreeData(ArrayList array)
 {
     try
     {
         MySqlConnection MyConn2 = GetConnection();
         MyConn2.Open();
         foreach (Candle data in array)
         {
             string Query = "insert into three(code, date, time, start_price, end_price, high_price, low_price, volumn, avg_5, avg_20, avg_120 )" +
                            " values (@val1, @val2, @val3, @val4, @val5, @val6, @val7, @val8, @val9, @val10, @val11)" +
                            " on duplicate key update avg_5 = @val9, avg_20 = @val10, avg_120 = @val11";
             MySqlCommand cmd = new MySqlCommand(Query, MyConn2);
             cmd.Parameters.AddWithValue("@val1", data.code);
             cmd.Parameters.AddWithValue("@val2", data.date);
             cmd.Parameters.AddWithValue("@val3", data.time);
             cmd.Parameters.AddWithValue("@val4", data.startprice);
             cmd.Parameters.AddWithValue("@val5", data.endprice);
             cmd.Parameters.AddWithValue("@val6", data.highprice);
             cmd.Parameters.AddWithValue("@val7", data.lowprice);
             cmd.Parameters.AddWithValue("@val8", data.volume);
             cmd.Parameters.AddWithValue("@val9", data.avg5);
             cmd.Parameters.AddWithValue("@val10", data.avg20);
             cmd.Parameters.AddWithValue("@val11", data.avg120);
             MySqlDataReader MyReader2;
             MyReader2 = cmd.ExecuteReader();
             MyReader2.Close();
         }
         MyConn2.Close();
     }
     catch (Exception e)
     {
         Console.Write(e);
     }
 }
Ejemplo n.º 4
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                //This is my connection string i have assigned the database file address path
                string MyConnection2 = "datasource=172.16.60.187;port=3306;username=root";
                //This is my insert query in which i am taking input from the user through windows forms
                string Query = "insert into drawgift.drawsettings(amount,points) values('" + this.amnt.Text + "','" + this.points.Text + "');";
                //This is  MySqlConnection here i have created the object and pass my connection string.
                MySqlConnection MyConn2 = new MySqlConnection(MyConnection2);
                //This is command class which will handle the query and connection object.
                MySqlCommand    MyCommand2 = new MySqlCommand(Query, MyConn2);
                MySqlDataReader MyReader2;
                MyConn2.Open();
                MyReader2 = MyCommand2.ExecuteReader();     // Here our query will be executed and data saved into the database.
                MessageBox.Show("Data Saved");
                while (MyReader2.Read())
                {
                }
                MyReader2.Close();

                MyConn2.Close();

                this.Hide();
                //this.Show();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Ejemplo n.º 5
0
        private void btnAddDoctor_Click(object sender, RoutedEventArgs e)
        {
            if (textBox.Text.ToString().Equals(""))
            {
                MessageBox.Show("Please fill");
            }
            else
            {
                MySqlConnection conn = DBConnect.connectToDb();
                try
                {
                    string Query = "insert into user.doctor(name,age,contact_no,department,specialist_in,address,join_date,counsiling_hour,id,password) values('" + textBox.Text + "', '" + textBox1.Text + "', '" + textBox2.Text + "', '" + comboboxDept.Text + "', '" + textBox4.Text + "', '" + textBox5.Text + "', '" + datepicker.Text + "', '" + textBox6.Text + "', '" + textBox7.Text + "', '" + textBox8.Text + "');";

                    MySqlCommand    MyCommand2 = new MySqlCommand(Query, conn);
                    MySqlDataReader MyReader2;

                    MyReader2 = MyCommand2.ExecuteReader();
                    MessageBox.Show("Data Added . . .");

                    textBox.Text      = ""; textBox1.Text = ""; textBox2.Text = "";
                    comboboxDept.Text = "";
                    textBox4.Text     = ""; textBox5.Text = "";
                    datepicker.Text   = ""; textBox6.Text = ""; textBox7.Text = "";
                    textBox8.Text     = "";
                    MyReader2.Close();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
        }
        private void btnPass_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                //con.Open();
                if (DocPass.Password.Length == 0 && DocPass2.Password.Length == 0)
                {
                    MessageBox.Show("Null password");
                }
                else if (DocPass.Password == DocPass2.Password)
                {
                    string          sql1       = "update hopedatabase.admin set PASSWORD='******' where NAME='admin';";
                    MySqlCommand    MyCommand2 = new MySqlCommand(sql1, con);
                    MySqlDataReader MyReader2;
                    MyReader2 = MyCommand2.ExecuteReader();
                    MyReader2.Close();

                    MessageBox.Show("Password Updated Succesfully");
                    DocPass.Clear();
                    DocPass2.Clear();
                    con.Close();
                }
                else
                {
                    MessageBox.Show("Passwords does not match");
                }
            }
            catch (Exception eee)
            {
                MessageBox.Show(eee.Message.ToString());
            }
        }
Ejemplo n.º 7
0
        private void save_Click(object sender, EventArgs e)
        {
            try
            {
                //This is my connection string i have assigned the database file address path
                string MyConnection2 = "datasource=localhost;port=3306;username=root";
                //This is my insert query in which i am taking input from the user through windows forms
                string Query = "insert into drawgift.customer(name,raffleno,address,idno,tel) values('" + this.name.Text + "','" + this.raffle.Text + "','" + this.addr.Text + "','" + this.id.Text + "','" + this.tel.Text + "');";
                //This is  MySqlConnection here i have created the object and pass my connection string.
                MySqlConnection MyConn2 = new MySqlConnection(MyConnection2);
                //This is command class which will handle the query and connection object.
                MySqlCommand    MyCommand2 = new MySqlCommand(Query, MyConn2);
                MySqlDataReader MyReader2;
                MyConn2.Open();
                MyReader2 = MyCommand2.ExecuteReader();     // Here our query will be executed and data saved into the database.
                MessageBox.Show("Data Saved");
                while (MyReader2.Read())
                {
                }
                MyReader2.Close();

                MyConn2.Close();
                customerdetails eadd = new customerdetails();
                this.Hide();

                eadd.ShowDialog();
                //this.Show();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Ejemplo n.º 8
0
        private void comboboxDoctorName_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            ///////Loading Doctor Department Value
            try
            {
                string          Query      = "select id,department from doctor where name='" + comboboxDoctorName.SelectedItem.ToString() + "';";
                MySqlCommand    MyCommand2 = new MySqlCommand(Query, conn);
                MySqlDataReader MyReader2;
                MyReader2 = MyCommand2.ExecuteReader();

                while (MyReader2.Read())
                {
                    docId   = MyReader2.GetString(0);
                    docDept = MyReader2.GetString(1);
                    textboxDoctorDept.Text = docDept;
                }
                MyReader2.Close();

                string          Query1    = "select department from doctor where name='" + comboboxDoctorName.SelectedItem.ToString() + "';";
                MySqlCommand    MyCommand = new MySqlCommand(Query, conn);
                MySqlDataReader MyReader;
                MyReader = MyCommand.ExecuteReader();
                MyReader.Close();
                assd.IsEnabled = true;
            }
            catch { }
        }
        private void textBox2_TextChanged(object sender, TextChangedEventArgs e)
        {
            MySqlConnection conn = DBConnect.connectToDb();

            try
            {
                string q = "select * from appointment where pat_contact_no='" + pat_contact_no.Text + "';";

                MySqlCommand    MyCommand2 = new MySqlCommand(q, conn);
                MySqlDataReader MyReader2;

                MyReader2 = MyCommand2.ExecuteReader();

                while (MyReader2.Read())
                {
                    pat_name.Text    = MyReader2.GetValue(0).ToString();
                    pat_age.Text     = MyReader2.GetValue(1).ToString();
                    pat_address.Text = MyReader2.GetValue(2).ToString();
                }
                MyReader2.Close();
            }
            catch (Exception exp)
            {
                MessageBox.Show(exp.Message.ToString());
            }
        }
Ejemplo n.º 10
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                //This is my connection string i have assigned the database file address path
                string MyConnection2 = "datasource=localhost;port=3306;username=root";
                //This is my insert query in which i am taking input from the user through windows forms


                string Query = "insert into drawgift.entries(raffleno,shop,amount,points,token,recordedby,dateadded) values('" + this.raffle.Text + "','" + this.shop.Text + "','" + this.amnt.Text + "','" + this.points.Text + "','" + this.token.Text + "','" + this.rec.Text + "','" + this.datea.Text + "');";
                //This is  MySqlConnection here i have created the object and pass my connection string.
                MySqlConnection MyConn4 = new MySqlConnection(MyConnection2);
                //This is command class which will handle the query and connection object.
                MySqlCommand    MyCommand2 = new MySqlCommand(Query, MyConn4);
                MySqlDataReader MyReader2;
                MyConn4.Open();
                MyReader2 = MyCommand2.ExecuteReader();     // Here our query will be executed and data saved into the database.
                //MessageBox.Show("Data Saved");
                while (MyReader2.Read())
                {
                }
                MyReader2.Close();

                MyConn4.Close();
                addentry eadd = new addentry();
                this.Hide();

                eadd.ShowDialog();
                //this.Show();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Ejemplo n.º 11
0
 public void InsertEvaluateData(ArrayList array)
 {
     try
     {
         MySqlConnection MyConn2 = GetConnection();
         MyConn2.Open();
         foreach (Orders data in array)
         {
             string Query = "insert into evaluate(date, rule, check_total, check_matched, win_count, lose_count, match_rate, winning_rate, total_profit_rate)" +
                            " values (@val1, @val2, @val3, @val4, @val5, @val6, @val7, @val8, @val9)";
             MySqlCommand cmd = new MySqlCommand(Query, MyConn2);
             cmd.Parameters.AddWithValue("@val1", data.date);
             cmd.Parameters.AddWithValue("@val2", data.rule);
             cmd.Parameters.AddWithValue("@val3", data.checkTotal);
             cmd.Parameters.AddWithValue("@val4", data.winCount + data.loseCount);
             cmd.Parameters.AddWithValue("@val5", data.winCount);
             cmd.Parameters.AddWithValue("@val6", data.loseCount);
             cmd.Parameters.AddWithValue("@val7", data.GetMatchRate());
             cmd.Parameters.AddWithValue("@val8", data.GetWinningRate());
             cmd.Parameters.AddWithValue("@val9", data.GetTotalProfitRate());
             MySqlDataReader MyReader2;
             MyReader2 = cmd.ExecuteReader();
             MyReader2.Close();
         }
         MyConn2.Close();
     }
     catch (Exception e)
     {
         Console.Write(e);
     }
 }
Ejemplo n.º 12
0
        private void TextBox_TextChanged_1(object sender, TextChangedEventArgs e)
        {
            if (txtPhn.Text.Equals(""))
            {
                txtBed.Text  = "";
                txtWard.Text = "";
            }
            try
            {
                string sql = "select ward_name,bed_no from user.allocate_patient_bed where bed_status='" + "Occupied" + "' and patient_contact_no='" + txtPhn.Text + "' ;";

                MySqlCommand    MyCommand2 = new MySqlCommand(sql, conn);
                MySqlDataReader MyReader2;

                MyReader2 = MyCommand2.ExecuteReader();

                while (MyReader2.Read())
                {
                    txtWard.Text = MyReader2.GetValue(0).ToString();
                    txtBed.Text  = MyReader2.GetValue(1).ToString();
                }
                MyReader2.Close();
            }
            catch (Exception exc) { MessageBox.Show(exc.Message.ToString()); }
        }
        public void check_doctor_dept()
        {
            try
            {
                Query78 = "select department from user.doctor where id='" + hmmtext.Text + "';";
                MySqlCommand    MyCommand2 = new MySqlCommand(Query78, conn);
                MySqlDataReader MyReader2;
                MyReader2 = MyCommand2.ExecuteReader();
                while (MyReader2.Read())
                {
                    doc_dept = MyReader2.GetString(0);
                }
                MyReader2.Close();

                if (doc_dept.Equals("Cardiology"))
                {
                    string          Query100     = "select distinct disease_type from user.medicine_name where disease_type='" + "Cardiac" + "';";
                    MySqlCommand    MyCommand100 = new MySqlCommand(Query100, conn);
                    MySqlDataReader MyReader100;
                    MyReader100 = MyCommand100.ExecuteReader();
                    while (MyReader100.Read())
                    {
                        testingprocess.Text = MyReader100.GetString(0).ToString();
                    }
                    MyReader100.Close();
                }

                else if (doc_dept.Equals("Nurology"))
                {
                    string          Query101     = "select distinct disease_type from user.medicine_name where disease_type='" + "Neurological" + "';";
                    MySqlCommand    MyCommand101 = new MySqlCommand(Query101, conn);
                    MySqlDataReader MyReader101;
                    MyReader101 = MyCommand101.ExecuteReader();
                    while (MyReader101.Read())
                    {
                        testingprocess.Text = MyReader101.GetString(0).ToString();
                    }
                    MyReader101.Close();
                }

                else if (doc_dept.Equals("Orthopedics"))
                {
                    string          Query102     = "select distinct disease_type from user.medicine_name where disease_type='" + "Orthopedic" + "';";
                    MySqlCommand    MyCommand102 = new MySqlCommand(Query102, conn);
                    MySqlDataReader MyReader102;
                    MyReader102 = MyCommand102.ExecuteReader();
                    while (MyReader102.Read())
                    {
                        testingprocess.Text = MyReader102.GetString(0).ToString();;
                    }
                    MyReader102.Close();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Ejemplo n.º 14
0
        private void button_update_Click(object sender, RoutedEventArgs e)
        {
            string          sql        = "update hopedatabase.disease set disease_type = '" + disease_type.Text + "', disease_name = '" + disease_name.Text + "' where (disease_id = '" + disease_id.Text + "');";
            MySqlCommand    MyCommand2 = new MySqlCommand(sql, conn);
            MySqlDataReader MyReader2;

            MyReader2 = MyCommand2.ExecuteReader();
            MyReader2.Close();
            MessageBox.Show(" Updated Succesfully");
            disease_id.Text = ""; disease_type.Text = ""; disease_name.Text = "";
            load();
        }
Ejemplo n.º 15
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);
            }
        }
Ejemplo n.º 16
0
 public void fillFields(string guid)
 {
     try
     {
         string          MyConnection2 = "server=localhost; port=3306; database=akturegistracijadb; username=root; password=qwerty123; SslMode=none";
         string          query         = "SELECT * FROM `aktudati` WHERE `GUID` = " + "'" + guid + "'";
         MySqlConnection MyConn2       = new MySqlConnection(MyConnection2);
         MySqlCommand    MyCommand2    = new MySqlCommand(query, MyConn2);
         MySqlDataReader MyReader2;
         MyConn2.Open();
         MyReader2 = MyCommand2.ExecuteReader();
         while (MyReader2.Read())
         {
             this.pas_nos_text.Text              = MyReader2.GetString("Pasakuma Nosaukums");
             this.pas_dat_text.Text              = MyReader2.GetString("Pasakuma Datums");
             this.vards_uzvards_text.Text        = MyReader2.GetString("Vards Uzvards");
             this.personas_kods_text.Text        = MyReader2.GetString("Personas Kods");
             this.mail_text.Text                 = MyReader2.GetString("Epasts");
             this.tel_tex.Text                   = MyReader2.GetString("Telefona NR");
             this.cena_text.Text                 = MyReader2.GetString("Biletes Cena");
             this.id_text.Text                   = MyReader2.GetString("Bilesu ID");
             this.bil_id_nr.Text                 = MyReader2.GetString("Bilesu Veidlapas Nummuri");
             this.pirk_dat_text.Text             = MyReader2.GetString("Pirkuma Datums");
             this.ieg_viet_text.Text             = MyReader2.GetString("Iegades vieta");
             this.tirdz_punkta_text.Text         = MyReader2.GetString("Tirdzniecibas vieta");
             this.other_info_text.Text           = MyReader2.GetString("Cits info");
             this.konta_text.Text                = MyReader2.GetString("Bankas Konts");
             this.swift_text.Text                = MyReader2.GetString("Swift Kods");
             this.bank_nos_text.Text             = MyReader2.GetString("Bankas Nosaukums");
             this.guid_text.Text                 = MyReader2.GetString("GUID");
             this.aizpildisanas_datums_text.Text = MyReader2.GetString("Aizpildisanas datums");
             if (MyReader2.GetString("Statuss") == "Apstrādāts")
             {
                 this.apstradats_checkbox.IsChecked = true;
             }
             else
             {
                 this.apstradats_checkbox.IsChecked = false;
             }
         }
         MyReader2.Close();
     }
     catch (Exception error)
     {
         MessageBox.Show(error.ToString());
     }
 }
Ejemplo n.º 17
0
 void add_test()
 {
     try
     {
         string          Query1     = "insert into user.test values('" + this.medwindowContactNumberT.Text.ToString() + "','" + this.medwindowDateT.Text.ToString() + "', '" + this.doc_idT.Text.ToString() + "','" + this.diseaseT.Text.ToString() + "','" + this.comboboxTestName.SelectedItem.ToString() + "');";
         MySqlCommand    MyCommand2 = new MySqlCommand(Query1, conn);
         MySqlDataReader MyReader2;
         MyReader2 = MyCommand2.ExecuteReader();
         MessageBox.Show("Test Added . . .");
         MyReader2.Close();
         p1.btnExit.IsEnabled = false;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Ejemplo n.º 18
0
 void load_disease()
 {
     try
     {
         string          Query      = "select distinct disease_name from medicine_name;";
         MySqlCommand    MyCommand2 = new MySqlCommand(Query, conn);
         MySqlDataReader MyReader2;
         MyReader2 = MyCommand2.ExecuteReader();
         while (MyReader2.Read())
         {
             string name = MyReader2.GetString(0);
             comboboxDisease.Items.Add(name);
         }
         MyReader2.Close();
     }
     catch { }
 }
 private void button_update_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         string          sql        = "update hopedatabase.doctor_info set doctor_name = '" + doctor_name.Text + "', doctor_degree = '" + doctor_degree.Text + "', register_number = '" + register_number.Text + "' where ( doctor_id = '1' );";
         MySqlCommand    MyCommand2 = new MySqlCommand(sql, conn);
         MySqlDataReader MyReader2;
         MyReader2 = MyCommand2.ExecuteReader();
         MyReader2.Close();
         MessageBox.Show(" Updated Succesfully");
         this.Visibility = Visibility.Hidden;
     }
     catch (Exception eee)
     {
         MessageBox.Show(eee.Message.ToString());
     }
 }
Ejemplo n.º 20
0
 void load_blood_group()
 {
     try
     {
         string          Query      = "select * from blood_group;";
         MySqlCommand    MyCommand2 = new MySqlCommand(Query, conn);
         MySqlDataReader MyReader2;
         MyReader2 = MyCommand2.ExecuteReader();
         while (MyReader2.Read())
         {
             string name = MyReader2.GetString(0);
             comboboxBloodGroup.Items.Add(name);
         }
         MyReader2.Close();
     }
     catch { }
 }
 public void load_combo_disease_namee()
 {
     try
     {
         string          Query      = "select distinct disease_name from test_name where disease_type='" + comboDiseaseType.SelectedItem.ToString() + "';";
         MySqlCommand    MyCommand2 = new MySqlCommand(Query, conn);
         MySqlDataReader MyReader2;
         MyReader2 = MyCommand2.ExecuteReader();
         while (MyReader2.Read())
         {
             string name = MyReader2.GetString(0);
             this.comboDiseaseName.Items.Add(name);
         }
         MyReader2.Close();
     }
     catch {}
 }
 private void btnDeleteStaff_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         string          sql        = "delete from user.staff where staff_id='" + txtStaffId.Text + "';";
         MySqlCommand    MyCommand2 = new MySqlCommand(sql, con);
         MySqlDataReader MyReader2;
         MyReader2 = MyCommand2.ExecuteReader();
         MyReader2.Close();
         MessageBox.Show("Staff Deleted");
         load();
     }
     catch (Exception eee)
     {
         MessageBox.Show(eee.Message.ToString());
     }
 }
Ejemplo n.º 23
0
 void load_doctor_name()
 {
     try
     {
         string          Query      = "select name from doctor;";
         MySqlCommand    MyCommand2 = new MySqlCommand(Query, conn);
         MySqlDataReader MyReader2;
         MyReader2 = MyCommand2.ExecuteReader();
         while (MyReader2.Read())
         {
             string name = MyReader2.GetString(0);
             this.comboboxDoctorName.Items.Add(name);
         }
         MyReader2.Close();
     }
     catch { }
 }
Ejemplo n.º 24
0
 private void button_delete_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         string          sql        = "delete from hopedatabase.treatment where treatment_id='" + treatment_ID.Text + "';";
         MySqlCommand    MyCommand2 = new MySqlCommand(sql, conn);
         MySqlDataReader MyReader2;
         MyReader2 = MyCommand2.ExecuteReader();
         MyReader2.Close();
         MessageBox.Show("Treatment Deleted");
         treatment_ID.Text = ""; time_require.Text = ""; cost.Text = "";
         load();
     }
     catch (Exception eee)
     {
         MessageBox.Show(eee.Message.ToString());
     }
 }
 private void button2_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         string          sql        = "update user.staff set age='" + txtStaffAge.Text + "' where staff_id='" + txtStaffId.Text + "';";
         MySqlCommand    MyCommand2 = new MySqlCommand(sql, con);
         MySqlDataReader MyReader2;
         MyReader2 = MyCommand2.ExecuteReader();
         MyReader2.Close();
         MessageBox.Show("Age Updated Succesfully");
         txtStaffAge.Text = "";
         load();
     }
     catch (Exception eee)
     {
         MessageBox.Show(eee.Message.ToString());
     }
 }
Ejemplo n.º 26
0
 private void btnUpdateAge_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         string          sql        = "update doctor set age='" + txtDocAge.Text + "' where id='" + txtDocId.Text + "';";
         MySqlCommand    MyCommand2 = new MySqlCommand(sql, con);
         MySqlDataReader MyReader2;
         MyReader2 = MyCommand2.ExecuteReader();
         MyReader2.Close();
         MessageBox.Show("Name Updated Succesfully");
         txtDocAge.Text = "";
         load();
     }
     catch (Exception eee)
     {
         MessageBox.Show(eee.Message.ToString());
     }
 }
Ejemplo n.º 27
0
 private void btnDeleteDoctor_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         string          sql        = "delete from doctor where id='" + txtDocId.Text + "';";
         MySqlCommand    MyCommand2 = new MySqlCommand(sql, con);
         MySqlDataReader MyReader2;
         MyReader2 = MyCommand2.ExecuteReader();
         MyReader2.Close();
         MessageBox.Show("Doctor Deleted");
         txtDocId.Text = "";
         load();
     }
     catch (Exception eee)
     {
         MessageBox.Show(eee.Message.ToString());
     }
 }
Ejemplo n.º 28
0
 private void button_delete_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         string          sql        = "delete from hopedatabase.disease where disease_id='" + disease_id.Text + "';";
         MySqlCommand    MyCommand2 = new MySqlCommand(sql, conn);
         MySqlDataReader MyReader2;
         MyReader2 = MyCommand2.ExecuteReader();
         MyReader2.Close();
         MessageBox.Show("Disease Deleted");
         disease_id.Text = ""; disease_type.Text = ""; disease_name.Text = "";
         load();
     }
     catch (Exception eee)
     {
         MessageBox.Show(eee.Message.ToString());
     }
 }
Ejemplo n.º 29
0
 private void button_update_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         string          sql        = "update hopedatabase.treatment set treatment_name = '" + treatment_name.Text + "', time_require = '" + time_require.Text + "', cost = '" + cost.Text + "' where (treatment_ID = '" + treatment_ID.Text + "');";
         MySqlCommand    MyCommand2 = new MySqlCommand(sql, conn);
         MySqlDataReader MyReader2;
         MyReader2 = MyCommand2.ExecuteReader();
         MyReader2.Close();
         MessageBox.Show(" Updated Succesfully");
         treatment_ID.Text = ""; treatment_name.Text = ""; time_require.Text = ""; cost.Text = "";
         load();
     }
     catch (Exception eee)
     {
         MessageBox.Show(eee.Message.ToString());
     }
 }
Ejemplo n.º 30
0
 private void btnUpdateCouncilingHour_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         string          sql        = "update user.doctor set counsiling_hour ='" + txtDocCouncilingHour.Text + "' where id='" + txtDocId.Text + "';";
         MySqlCommand    MyCommand2 = new MySqlCommand(sql, con);
         MySqlDataReader MyReader2;
         MyReader2 = MyCommand2.ExecuteReader();
         MyReader2.Close();
         MessageBox.Show("Councilling Hour Changed Succesfully");
         txtDocCouncilingHour.Text = "";
         load();
     }
     catch (Exception eee)
     {
         MessageBox.Show(eee.Message.ToString());
     }
 }