コード例 #1
0
 private void BtnDelete_Click(object sender, EventArgs e)
 {
     if (Block)
     {
         return;
     }
     if (SitesDataGrid.CurrentCell != null && SitesDataGrid.CurrentCell.RowIndex >= 0)
     {
         int selected = (int)SitesDataGrid.Rows[SitesDataGrid.CurrentCell.RowIndex].Tag;
         if (ConfirmDelete() == true)
         {
             SiteClass site = SitesManager.GetByIndex(selected);
             if (site != null)
             {
                 if (site.operation == UpdateOperation.ADD_NEW)
                 {
                     SitesManager.Delete(site);
                 }
                 else
                 {
                     site.operation = UpdateOperation.DELETE;
                     SitesManager.UpdateSite(site);
                 }
             }
             InitializeEditor();
         }
     }
     else
     {
         MessageBox.Show("Please select a site!");
     }
 }