示例#1
0
 private void deleteToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (dataGridView1.SelectedRows.Count > 0)
     {
         VpnManagerDal.DeleteExtensionObject((int)dataGridView1.SelectedRows[0].Cells[0].Value);
     }
 }
示例#2
0
 private void deleteToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (dataGridView1.Focused)
     {
         DataGridViewRow row = dataGridView1.SelectedRows[0];
         VpnManagerDal.DeleteMachine(Convert.ToInt32(row.Cells[0].Value));
     }
     else
     {
         if (dataGridView1.SelectedRows.Count > 0)
         {
             DataGridViewRow row = dataGridView2.SelectedRows[0];
             VpnManagerDal.DeleteExtensionObject(Convert.ToInt32(row.Cells[0].Value));
             if (rdPlant.Checked)
             {
                 extensionObjectDTOBindingSource.DataSource = VpnManagerDal.GetExtensionObjects(_plant, (int)TargetTable.Plant);
             }
             else
             {
                 extensionObjectDTOBindingSource.DataSource = VpnManagerDal.GetExtensionObjects(_machineID, (int)TargetTable.Machine);
             }
         }
         else
         {
             MessageBox.Show("Select a Object before");
         }
     }
 }