Пример #1
0
        //the function to remove the test
        private void RemoveTest(object sender, EventArgs e)
        {
            var button = sender as BunifuImageButton;

            MySqlConnection con = new MySqlConnection();

            con.ConnectionString = login.DBconnection;
            string          delete = "delete from lab_temp where Id = '" + button.Name + "' ";
            MySqlCommand    com1   = new MySqlCommand(delete, con);
            MySqlDataReader reader;

            try
            {
                con.Open();
                //deleting the deleted text
                reader = com1.ExecuteReader();
                reader.Close();
                LoadTestTimer.Start();
            }
            catch (MySqlException ex)
            {
                MessageBox.Show(ex.Message);
            }
            con.Close();
        }
Пример #2
0
        private void lab_tem()
        {
            flowLayoutPanel1.Controls.Clear();
            MySqlConnection con = new MySqlConnection();

            con.ConnectionString = login.DBconnection;

            MySqlDataReader rd;

            try {
                con.Open();

                string selectCost = "select proposedprice from laboratory_tests_master where name = '" + labTestList.Text + "'";
                //taking the price of the test
                DataTable    table = new DataTable();
                MySqlCommand cost  = new MySqlCommand(selectCost, con);
                rd = cost.ExecuteReader();
                table.Load(rd);
                rd.Close();

                if (table.Rows.Count > 0)
                {
                    TestCost = int.Parse(table.Rows[0][0].ToString());
                    string       test = " insert into lab_temp(Test,doctorName,pID,date,cost,status) values('" + labTestList.Text + "','" + login.uname + "','" + doctCheckInTab.patientId + "','" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") + "'," + TestCost + ",'New') ";
                    MySqlCommand com  = new MySqlCommand(test, con);

                    //saving data to database
                    rd = com.ExecuteReader();
                    rd.Close();

                    LoadTestTimer.Start();
                    labTestList.Text = "----Select---";
                }
            }
            catch (MySqlException ex)
            {
                MessageBox.Show(ex.Message);
            }
            con.Close();
        }
Пример #3
0
 //view the tests
 private void LoadTestTimer_Tick(object sender, EventArgs e)
 {
     LoadTestTimer.Stop();
     flowLayoutPanel1.Controls.Clear();
     ViewAddedTest();
 }
Пример #4
0
        public void checkBx()
        {
            flowLayoutPanel1.Controls.Clear();
            MySqlConnection con = new MySqlConnection();

            con.ConnectionString = login.DBconnection;

            MySqlDataReader rd;

            try
            {
                con.Open();

                if (checkBox1.Checked == true)
                {
                    string selectCost = "select proposedprice from laboratory_tests_master where name = '" + checkBox1.Text + "'";
                    //taking the price of the test
                    DataTable    table1 = new DataTable();
                    MySqlCommand cost   = new MySqlCommand(selectCost, con);
                    rd = cost.ExecuteReader();
                    table1.Load(rd);
                    rd.Close();

                    if (table1.Rows.Count > 0)
                    {
                        TestCost1 = int.Parse(table1.Rows[0][0].ToString());
                        string       check1 = " insert into lab_temp(Test,doctorName,pID,date,cost,status) values('" + checkBox1.Text + "','" + login.uname + "','" + doctCheckInTab.patientId + "','" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") + "'," + TestCost1 + ",'New') ";
                        MySqlCommand com1   = new MySqlCommand(check1, con);
                        rd = com1.ExecuteReader();
                        rd.Close();
                    }
                }

                if (checkBox2.Checked == true)
                {
                    string selectCost = "select proposedprice from laboratory_tests_master where name = '" + checkBox2.Text + "'";
                    //taking the price of the test
                    DataTable    table2 = new DataTable();
                    MySqlCommand cost   = new MySqlCommand(selectCost, con);
                    rd = cost.ExecuteReader();
                    table2.Load(rd);
                    rd.Close();

                    if (table2.Rows.Count > 0)
                    {
                        TestCost2 = int.Parse(table2.Rows[0][0].ToString());
                        string       check2 = " insert into lab_temp(Test,doctorName,pID,date,cost,status) values('" + checkBox2.Text + "','" + login.uname + "','" + doctCheckInTab.patientId + "','" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") + "'," + TestCost2 + ",'New') ";
                        MySqlCommand com2   = new MySqlCommand(check2, con);
                        rd = com2.ExecuteReader();
                        rd.Close();
                    }
                }

                if (checkBox3.Checked == true)
                {
                    string selectCost = "select proposedprice from laboratory_tests_master where name = '" + checkBox3.Text + "'";
                    //taking the price of the test
                    DataTable    table3 = new DataTable();
                    MySqlCommand cost   = new MySqlCommand(selectCost, con);
                    rd = cost.ExecuteReader();
                    table3.Load(rd);
                    rd.Close();

                    if (table3.Rows.Count > 0)
                    {
                        TestCost3 = int.Parse(table3.Rows[0][0].ToString());
                        string check3 = " insert into lab_temp(Test,doctorName,pID,date,cost,status) values('" + checkBox3.Text + "','" + login.uname + "','" + doctCheckInTab.patientId + "','" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") + "'," + TestCost3 + ",'New') ";

                        MySqlCommand com3 = new MySqlCommand(check3, con);

                        rd = com3.ExecuteReader();
                        rd.Close();
                    }
                }

                if (checkBox4.Checked == true)
                {
                    string selectCost = "select proposedprice from laboratory_tests_master where name = '" + checkBox4.Text + "'";
                    //taking the price of the test
                    DataTable    table4 = new DataTable();
                    MySqlCommand cost   = new MySqlCommand(selectCost, con);
                    rd = cost.ExecuteReader();
                    table4.Load(rd);
                    rd.Close();

                    if (table4.Rows.Count > 0)
                    {
                        TestCost4 = int.Parse(table4.Rows[0][0].ToString());
                        string check4 = " insert into lab_temp(Test,doctorName,pID,date,cost,status) values('" + checkBox4.Text + "','" + login.uname + "','" + doctCheckInTab.patientId + "','" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") + "'," + TestCost4 + ",'New') ";

                        MySqlCommand com4 = new MySqlCommand(check4, con);

                        rd = com4.ExecuteReader();
                        rd.Close();
                    }
                }

                if (checkBox5.Checked == true)
                {
                    string selectCost = "select proposedprice from laboratory_tests_master where name = '" + checkBox5.Text + "'";
                    //taking the price of the test
                    DataTable    table5 = new DataTable();
                    MySqlCommand cost   = new MySqlCommand(selectCost, con);
                    rd = cost.ExecuteReader();
                    table5.Load(rd);
                    rd.Close();
                    if (table5.Rows.Count > 0)
                    {
                        TestCost5 = int.Parse(table5.Rows[0][0].ToString());
                        string       check5 = " insert into lab_temp(Test,doctorName,pID,date,cost,status) values('" + checkBox5.Text + "','" + login.uname + "','" + doctCheckInTab.patientId + "','" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") + "'," + TestCost5 + ",'New') ";
                        MySqlCommand com5   = new MySqlCommand(check5, con);
                        rd = com5.ExecuteReader();
                        rd.Close();
                    }
                }

                LoadTestTimer.Start();
                checkBox1.Checked = false;
                checkBox2.Checked = false;
                checkBox3.Checked = false;
                checkBox4.Checked = false;
                checkBox5.Checked = false;
            }
            catch (MySqlException ex)
            {
                MessageBox.Show(ex.Message);
            }
            con.Close();
        }