示例#1
0
        private void Drop()
        {
            string typeString = LocalizedTypeString.ToLower(CultureInfo.CurrentCulture);

            DialogResult result = MessageBox.Show(String.Format(
                                                      Resources.DropConfirmation, typeString, Name),
                                                  String.Format(Resources.DropConfirmationCaption, typeString),
                                                  MessageBoxButtons.YesNo,
                                                  MessageBoxIcon.Question);

            if (result == DialogResult.No)
            {
                throw new OperationCanceledException();
            }

            string sql = GetDropSQL();

            try
            {
                ExecuteSQL(sql);

                // now we drop the node from the hierarchy
                HierarchyAccessor.DropObjectNode(ItemId);
            }
            catch (Exception ex)
            {
                MessageBox.Show(
                    String.Format(Resources.ErrorAttemptingToDrop,
                                  LocalizedTypeString, Name, ex.Message), Resources.ErrorTitle,
                    MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#2
0
        private void Drop()
        {
            string typeString = LocalizedTypeString.ToLower(CultureInfo.CurrentCulture);
            var    infoResult = InfoDialog.ShowDialog(InfoDialogProperties.GetYesNoDialogProperties(InfoDialog.InfoType.Info,
                                                                                                    string.Format(Resources.DropConfirmationCaption, typeString), string.Format(
                                                                                                        Resources.DropConfirmation, typeString, Name)));

            if (infoResult.DialogResult == DialogResult.No)
            {
                throw new OperationCanceledException();
            }

            string sql = GetDropSql();

            try
            {
                ExecuteSql(sql);

                // now we drop the node from the hierarchy
                HierarchyAccessor.DropObjectNode(ItemId);
            }
            catch (Exception ex)
            {
                MySqlSourceTrace.WriteAppErrorToLog(ex, Resources.ErrorTitle, string.Format(Resources.ErrorAttemptingToDrop, LocalizedTypeString, Name), true);
                throw new OperationCanceledException();
            }
        }