private void deleteMessage()
        {
            if (MessageBox.Show($"Are you sure you want to delete the data?", "", MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                for (int count = listView_allDatalist.Items.Count - 1; count >= 0; count = count - 1)
                {
                    if (listView_allDatalist.Items[count].Selected == true)
                    {
                        string[] date_temp  = listView_allDatalist.Items[count].Text.ToString().Split('-');
                        string[] alarm_temp = listView_allDatalist.Items[count].SubItems[1].Text.ToString().Split(':');

                        int[] date = new int[3];    date[0] = int.Parse(date_temp[0]);
                        date[1] = int.Parse(date_temp[1]);
                        date[2] = int.Parse(date_temp[2]);

                        int[] alarm = new int[2];   alarm[0] = int.Parse(alarm_temp[0]);
                        alarm[1] = int.Parse(alarm_temp[1]);

                        connect.Open();
                        SQLiteCommand command = new SQLiteCommand(QueryList.deleteDateSQL(date[0], date[1], date[2], alarm), connect);
                        command.ExecuteNonQuery();
                        connect.Close();
                    }
                }

                refreshData();
                cmain.changeCalendar();
                cmain.calendarListRefresh();
                cmain.refreshAlarm();
            }
        }
Beispiel #2
0
        // delete select database.
        private void deleteDBdata(int index)
        {
            string[] splitstr = new string[2];
            int[]    datetemp = new int[2];
            splitstr    = listView_Schedule.Items[index].Text.Split(':');
            datetemp[0] = int.Parse(splitstr[0]);
            datetemp[1] = int.Parse(splitstr[1]);

            // MessageBox.Show(listView_Schedule.SelectedItems[0].SubItems[1].ToString());
            dbConnect.Open();

            dbCommand = new SQLiteCommand(QueryList.deleteDateSQL(selectYear, selectMonth, selectDay, datetemp), dbConnect);
            dbCommand.ExecuteNonQuery();
            dbConnect.Close();
        }