private void Next() { if (txt_bag.Text != "" && txt_bag.Text.Length > 3 && txt_cabinet.Text != "00" && txt_cabinet.Text != "" && txt_money.Text != "" && lb_emp_name.Text != "ไม่พบข้อมูลพนักงาน") { if (!groupbox1.Enabled) { if (MessageBox.Show("ยืนยันเบิกถุงเงิน", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { if (script.InsertUpdae_SQL("INSERT INTO tbl_income (tbl_income_money_bag,tbl_income_emp_id,tbl_income_cabinet,tbl_income_money,tbl_income_status_job,tbl_income_status_backmaney) VALUE ('" + txt_bag.Text + "','" + txt_emp_id.Text + "','" + txt_cabinet.Text + "','" + double.Parse(txt_money.Text) + "','0','0')")) { MessageBox.Show("เรีบยร้อย", "ผลลัพธ์", MessageBoxButtons.OK, MessageBoxIcon.Information); FileInfo DirInfo2 = new FileInfo(filename); if (!DirInfo2.Exists) { StreamWriter file = new StreamWriter(@filename, true); file.WriteLine(txt_emp_id.Text + "|" + txt_bag.Text + "|" + txt_cabinet.Text + "|" + double.Parse(txt_money.Text) + "|"); file.Close(); } else { StreamWriter file = File.AppendText(@filename); file.WriteLine(txt_emp_id.Text + "|" + txt_bag.Text + "|" + txt_cabinet.Text + "|" + double.Parse(txt_money.Text) + "|"); file.Close(); } BagNextTimeForm bagNextTime = new BagNextTimeForm(); bagNextTime.ShowDialog(); this.Close(); //mainForm.Enabled = true; } else { MessageBox.Show("Error", "แจ้งเตือน", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } else { groupbox1.Enabled = false; btn_edit.Visible = true; button1.Text = "ยืนยัน"; } } else { MessageBox.Show("กรุณาใส่ข้อมูลให้ครบถ้วน", "แจ้งเตือน", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
private void button3_Click(object sender, EventArgs e) { BagNextTimeForm bagNextTime = new BagNextTimeForm(); bagNextTime.ShowDialog(); }