Exemplo n.º 1
0
 public void createNewAlarm(DateTime dateOut, int tableNum, string TextMessage)
 {
     tempAlarm = new newAlarm();
     tempAlarm.Alarm(alarm_index, dateOut, tableNum, TextMessage, con);
     alarm_index++;
     tempAlarm.insertToDB();
     updateListBox();
 }
Exemplo n.º 2
0
 public Alarm(SqlConnection c)
 {
     tempAlarm = new newAlarm();
     InitializeComponent();
     con = c;
     updateListBox();
     if (dataGridView1.Rows.Count == 0)
     {
         alarm_index = 1;
         MessageBox.Show("1");
     }
 }
Exemplo n.º 3
0
        private void StopAndDeleteAlarm(newAlarm alarmNum)
        {
            SqlCommand deleteAlarmFromDB;
            deleteAlarmFromDB = new SqlCommand("DELETE FROM alarm WHERE table_num=@table_num and alarm_num = @alarm_num; ", con);

            deleteAlarmFromDB.Parameters.Add(new SqlParameter("@table_num", SqlDbType.Int));
            deleteAlarmFromDB.Parameters["@table_num"].Value = alarmNum.tableNum;

            deleteAlarmFromDB.Parameters.Add(new SqlParameter("@alarm_num", SqlDbType.Int));
            deleteAlarmFromDB.Parameters["@alarm_num"].Value = alarmNum.alarm_num;

            deleteAlarmFromDB.ExecuteNonQuery();
            alarmNum = null;
            updateListBox();
        }