Example #1
0
 private void button3_Click(object sender, EventArgs e)
 {
     if (DialogResult.Yes == MessageBox.Show("Delete the order?", "Attention", MessageBoxButtons.YesNo, MessageBoxIcon.Warning))
     {
         try
         {
             if (this.dataGridView1.SelectedRows.Count <= 0)
             {
                 throw new Exception();
             }
             foreach (DataGridViewRow row in this.dataGridView1.SelectedRows)
             {
                 OrderService.DelOrder((Order)row.DataBoundItem);
             }
             Update();
             DialogResult result = MessageBox.Show("Deleted.", "Attention", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
         catch
         {
             DialogResult result = MessageBox.Show("Deleted fail.", "Attention", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
     }
 }