예제 #1
0
 void label12_Click(object sender, EventArgs e)
 {
     if (!blnPass)
     {
         PassForm pf = new PassForm();
         pf.ShowDialog();
     }
     if (blnPass)
     {
         var msg = MessageBox.Show("Для удаления записи нажмите кнопку \"Да\". Отменение удаления будет невозможно. \nУдалить запись?", "Удаление записи", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);
         if (msg == DialogResult.Yes)
         {
             cn.Open();
             daBook.DeleteCommand             = cn.CreateCommand();
             daBook.DeleteCommand.CommandText = "delete from bookGenre where id_book=" + curentBook;
             daBook.DeleteCommand.ExecuteNonQuery();
             daBook.DeleteCommand.CommandText = "delete from bookCategory where id_book=" + curentBook;
             daBook.DeleteCommand.ExecuteNonQuery();
             daBook.DeleteCommand.CommandText = "DELETE FROM book WHERE id_book=" + curentBook;
             daBook.DeleteCommand.ExecuteNonQuery();
             ConnectAndRead();
             cn.Close();
         }
     }
 }
예제 #2
0
 void listBox2_DoubleClick(object sender, EventArgs e)
 {
     if (!blnPass)
     {
         PassForm pf = new PassForm();
         pf.ShowDialog();
     }
     if (listBox2.Items.Count != 0 && blnPass)
     {
         ind = listBox2.SelectedIndex;
         RedaktForm rf = new RedaktForm();
         rf.Show();
         this.Visible   = false;
         rf.FormClosed += rf_FormClosed;
     }
 }