예제 #1
0
 private void OnCreateDbLinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
 {
     PromptDialog dialog = new PromptDialog(base.ServiceProvider);
     dialog.EntryText = "Enter a name for the new database:";
     Label_0017:
     if (dialog.ShowDialog() == DialogResult.OK)
     {
         string s = dialog.EntryValue.Trim();
         string message = string.Empty;
         if (s.Length == 0)
         {
             message = "The name must not be empty.";
         }
         else if (s.Length > 0x7c)
         {
             message = "The name cannot be longer than 124 characters.";
         }
         else if (!SqlHelper.IsValidIdentifier(s))
         {
             message = "The name is not valid. Check that it contains valid characters and is not too long.";
         }
         if (message.Length > 0)
         {
             this.ReportError(message, "Unable to create a database with that name.");
             goto Label_0017;
         }
         this.CollectConnectionSettings();
         SqlDatabase database = new SqlDatabase(this.ConnectionSettings);
         try
         {
             database.Connect();
             database.CreateDatabase(SqlHelper.RemoveDelimiters(s));
             this._connectionSettings.Database = s;
             base.DialogResult = DialogResult.OK;
             base.Close();
         }
         catch (Exception exception)
         {
             this.ReportError(exception, "Could not create a new database.");
             goto Label_0017;
         }
         finally
         {
             database.Disconnect();
         }
     }
 }
예제 #2
0
 public override DocumentProjectItem GetSaveAsProjectItem(DocumentProjectItem item)
 {
     DocumentProjectItem item2 = null;
     PromptDialog dialog = new PromptDialog(base.ServiceProvider);
     dialog.Text = "Save Document As";
     dialog.EntryText = "Enter the full path to the new FTP location for the document:\n";
     dialog.EntryValue = item.Path;
     dialog.RequiresNewValue = true;
     ICommandManager service = (ICommandManager) base.GetService(typeof(ICommandManager));
     if (service != null)
     {
         service.SuspendCommandUpdate();
     }
     try
     {
         if (dialog.ShowDialog() != DialogResult.OK)
         {
             return item2;
         }
         string entryValue = dialog.EntryValue;
         if (!this.ValidateProjectItemPath(entryValue, false))
         {
             throw new Exception("'" + entryValue + "' is not a valid file path.");
         }
         string caption = entryValue;
         int num = entryValue.LastIndexOf('/');
         if (num > 0)
         {
             caption = entryValue.Substring(num + 1);
         }
         item2 = new MiscFileProjectItem(caption, entryValue, this);
     }
     finally
     {
         if (service != null)
         {
             service.ResumeCommandUpdate();
         }
     }
     return item2;
 }