Example #1
0
        void getCombobox(ComboBox box)
        {
            box.Items.Clear();
            string          sql    = "SELECT * FROM tbl_emp_group  ORDER BY tbl_emp_group_id";
            MySqlDataReader reader = script.Select_SQL(sql);

            while (reader.Read())
            {
                box.Items.Add(new ComboboxItem(reader.GetString("tbl_emp_group_name"), reader.GetString("tbl_emp_group_id")));
            }
            reader.Close();
            script.conn.Close();
        }
Example #2
0
        private void addEmpForm_Load(object sender, EventArgs e)
        {
            listBox1.Items.Clear();
            string          sql = "select * from tbl_emp_group order by tbl_emp_group_id";
            MySqlDataReader rs  = script.Select_SQL(sql);

            while (rs.Read())
            {
                listBox1.Items.Add(rs.GetString("tbl_emp_group_id") + " " + rs.GetString("tbl_emp_group_name"));
            }
            rs.Close();
            script.conn.Close();
        }
Example #3
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (textBox1.Text.Split('-').Length == 2)
     {
         string sql = "SELECT * FROM tbl_income i JOIN tbl_status_around a ON i.tbl_income_around_id = a.tbl_status_around_id WHERE tbl_income_id = '" + textBox1.Text.Split('-')[1].Trim() + "' limit 1";
         cpoint = textBox1.Text.Split('-')[0];
         MySqlDataReader rs = script.Select_SQL(sql, script.getConn(cpoint, groupbox1));
         GetData(rs);
     }
     else
     {
         MessageBox.Show("รูปแบบไม่ถูกต้อง", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Example #4
0
        private void button2_Click(object sender, EventArgs e)
        {
            string sql = "SELECT * FROM tbl_income JOIN tbl_emp ON tbl_income_emp_id=tbl_emp_id WHERE tbl_income_around_id IS NULL";

            //MessageBox.Show(txtCpoint.SelectedItem.ToString());
            if (codeEdit == "")
            {
                cpoint = (txtCpoint.SelectedItem as ComboboxItem).Value.ToString();
            }
            MySqlDataReader rs = adminScript.Select_SQL(sql, adminScript.getConn(cpoint, groupBox1));

            ListBoxEmp.Items.Clear();
            int i = 0;

            while (rs.Read())
            {
                ListBoxEmp.Items.Insert(i, new ComboboxItem("ถุงเงิน : " + rs.GetString("tbl_income_money_bag") + " ชื่อ-สกุล : " + rs.GetString("tbl_emp_name"), rs.GetString("tbl_income_id")));
                i++;
            }
            rs.Close();
            adminScript.CloseCon();
            button1.Enabled    = true;
            ListBoxEmp.Enabled = true;
        }