Ejemplo n.º 1
0
 public EditStrapsForm(Form callingForm, string bag, string emp, string emp_con, TextBox straps)
 {
     moneyForm       = callingForm as SendMoneyForm;
     txt_straps_call = straps as TextBox;
     bag_num         = bag;
     emp_operate     = emp;
     emp_contorl     = emp_con;
     InitializeComponent();
 }
Ejemplo n.º 2
0
        private void next()
        {
            bool            chk_back_money = false;
            string          sql            = "SELECT * FROM tbl_income JOIN tbl_emp ON tbl_income_emp_id = tbl_emp_id WHERE tbl_emp_id = '" + textBox1.Text + "' AND tbl_income_status_backmaney = '0'";
            ConnectDB       contxt         = new ConnectDB();
            MySqlConnection conn           = new MySqlConnection();

            conn = new MySqlConnection(contxt.context());
            MySqlCommand cmd = new MySqlCommand(sql, conn);

            conn.Open();
            MySqlDataReader reader = cmd.ExecuteReader();

            try
            {
                if (reader.Read())
                {
                    BackMoneyForm backMoneyForm = new BackMoneyForm(mainForm, textBox1.Text);
                    this.Close();
                    backMoneyForm.ShowDialog();
                }
                else
                {
                    chk_back_money = true;
                }
                reader.Close();

                if (chk_back_money)
                {
                    sql    = "SELECT * FROM tbl_income JOIN tbl_emp ON tbl_income_emp_id = tbl_emp_id WHERE tbl_emp_id = '" + textBox1.Text + "' AND tbl_income_status_backmaney = '1' AND tbl_income_bank IS NULL";
                    cmd    = new MySqlCommand(sql, conn);
                    reader = cmd.ExecuteReader();
                    if (reader.Read())
                    {
                        //MessageBox.Show("คืนเงินแล้ว");
                        SendMoneyForm sendMoneyForm = new SendMoneyForm(mainForm, textBox1.Text);
                        sendMoneyForm.ShowDialog();
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("ไม่พบข้อมูล หรืออาจจะนำส่งรายได้ไปแล้ว", "แจ้งเตือน", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        textBox1.Clear();
                        textBox1.Focus();
                    }
                }
            }
            catch
            {
                //MessageBox.Show(e.ToString());
            }
            conn.Close();
        }