Example #1
0
 private void item_Remove()
 {
     if (GridItemSelected == null)
     {
         MessageBox.Show("Select item to remove");
         return;
     }
     if (MessageBox.Show("You will remove item selected ?", "Are you sure?",
                         MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation,
                         MessageBoxDefaultButton.Button2) == System.Windows.Forms.DialogResult.Yes)
     {
         var exist = db.ExistItemDynamic(m_modelCurrent, GridItemSelected);
         if (exist)
         {
             bool val = db.RemoveItemDynamic(m_modelCurrent, GridItemSelected);
             if (val)
             {
                 MessageBox.Show("Remove item successfully");
                 (mui_tabModel.SelectedTab as TabPageCustom).OnLoadData();
             }
             else
             {
                 MessageBox.Show("Remove item fail");
             }
         }
         else
         {
             MessageBox.Show("Can not find item to remove");
         }
     }
 }