private void DropSelected( ) { if (grd.SelectedRows.Count == 0) { return; } if (!MessageService.AskQuestion("Are you sure you want to delete selected types?")) { return; } UdtWrapper udt = null; string errorText = String.Empty; bool ok = false; foreach (DataGridViewRow row in grd.SelectedRows) { if (!Utils.IsDbValueValid(row.Cells[0].Value)) { continue; } udt = new UdtWrapper(_cp); udt.ID = (long)((short)row.Cells[0].Value); udt.Name = (string)row.Cells[2].Value; try { udt.Drop(); ok = true; } catch (Exception ex) { if (String.IsNullOrEmpty(errorText)) { errorText += "Can not drop data type(s) listed below.\r\n"; } errorText += " - " + (string)row.Cells[2].Value + " : " + ex.Message; } } if (!String.IsNullOrEmpty(errorText)) { MessageService.ShowError(errorText); } if (ok) { LoadUdtList(); } }
private void DropUdt( ) { if (_udt == null) { return; } try { if (!MessageService.AskQuestion("Are you sure you want to drop user data type?")) { return; } _udt.Drop(); CreateNew(); } catch (Exception ex) { MessageService.ShowError(ex.Message); } }