private void Btn_dental_Click(object sender, EventArgs e) { if (CustomMsgBox.Show("ยืนยันการเข้ารับบริการ ' ทันตกรรม '", "แจ้งเตือน", "ตกลง", "ยกเลิก") == DialogResult.OK) { string sql = "INSERT INTO tb_queue SET queue_servicepoint = 'ห้องฟัน' , queue_status = 'waiting'"; MySqlCommand cmd = new MySqlCommand(sql, con); con.Open(); cmd.ExecuteReader(); con.Close(); string get_q = "SELECT *,COUNT(*) AS QN FROM tb_queue WHERE queue_servicepoint = 'ห้องฟัน'"; MySqlCommand cmd_queue = new MySqlCommand(get_q, con); con.Open(); MySqlDataReader get_queue = cmd_queue.ExecuteReader(); get_queue.Read(); string Qnumber = get_queue.GetString("QN"); string Qservice = get_queue.GetString("queue_servicepoint"); con.Close(); string up_qnum = "UPDATE tb_queue SET queue_number ='" + Qnumber + "' WHERE queue_number IS NULL AND queue_servicepoint ='ห้องฟัน'"; MySqlCommand cmd_upq = new MySqlCommand(up_qnum, con); con.Open(); cmd_upq.ExecuteReader(); PrintQueue preViewQ = new PrintQueue(Qnumber, Qservice); preViewQ.Show(); con.Close(); } }
public static DialogResult Show(string Text, string Caption, string btnOK, string btnCancel) { MsgBox = new CustomMsgBox(); MsgBox.label1.Text = Text; MsgBox.button1.Text = btnOK; MsgBox.button2.Text = btnCancel; MsgBox.Text = Caption; result = DialogResult.No; MsgBox.ShowDialog(); return(result); }