private bool reservationBox(DataGridViewCellEventArgs e) // 預約包廂功能 { int count = sql.exec("update Box_Data SET 包廂狀態 = '1' , 包廂人數 = '" + textBox1.Text + "', 入場時間 = '" + textBox3.Text + "', 離場時間 = DATE_ADD('" + textBox3.Text + "',INTERVAL " + textBox4.Text + " HOUR) ,時數 = '" + textBox4.Text + "' where 包廂編號 = " + dataGridView2.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString()); if (count > 0) { return(true); } else { return(false); } }
private void addTime(object sender, EventArgs e) { int count = sql.exec(String.Format("update Box_Data set 是否加時 = true where 包廂編號 = '{0}'", boxNum)); if (count > 0) { string message = "已通知服務人員"; string caption = "加時"; MessageBoxButtons buttons = MessageBoxButtons.OK; DialogResult result; // Displays the MessageBox. result = MessageBox.Show(message, caption, buttons); } else { string message = "加時失敗"; string caption = "加時"; MessageBoxButtons buttons = MessageBoxButtons.OK; DialogResult result; // Displays the MessageBox. result = MessageBox.Show(message, caption, buttons); } }
private void button1_Click(object sender, EventArgs e) { dataGridView1.DataSource = sql.exec("update Box_Data SET 包廂狀態 = '1' , 包廂人數 = '1', 入場時間 = '2020/6/10 14:10', 離場時間 = DATE_ADD('2020/6/10 14:10',INTERVAL 1 HOUR) where 包廂編號 = '003'"); }