protected internal abstract FolderProjectItem CreateFolderInternal(FolderProjectItem parentItem);
protected override FolderProjectItem CreateFolderInternal(FolderProjectItem parentItem) { throw new NotSupportedException(); }
protected internal abstract DocumentProjectItem CreateDocumentInternal(FolderProjectItem parentItem);
protected override DocumentProjectItem CreateDocumentInternal(FolderProjectItem parentItem) { if (!(parentItem is StoredProcedureGroupProjectItem)) { if (!(parentItem is TableGroupProjectItem)) { throw new NotSupportedException(); } TableGroupProjectItem item2 = (TableGroupProjectItem) parentItem; PromptDialog dialog2 = new PromptDialog(base.ServiceProvider); dialog2.Text = "Create New Table"; dialog2.EntryText = "Enter the name of the new table:"; IMxUIService service2 = (IMxUIService) base.GetService(typeof(IMxUIService)); Label_015E: if (service2.ShowDialog(dialog2) == DialogResult.OK) { string itemName = dialog2.EntryValue.Trim(); string identifierPart = this.GetIdentifierPart(itemName); if (!this.ValidateProjectItemName(identifierPart)) { service2.ReportError("The name '" + itemName + "' contains invalid characters or is too long.", "Create New Table", false); goto Label_015E; } try { this.Database.Connect(); TableCollection tables = this.Database.Tables; if (tables.Contains(identifierPart)) { service2.ReportError("A table with the name '" + itemName + "' already exists.", "Create New Table", false); goto Label_015E; } tables.AddNew(identifierPart); return new TableProjectItem(identifierPart); } catch (Exception exception2) { service2.ReportError(exception2, "Error adding table.", false); goto Label_015E; } finally { this.Database.Disconnect(); } } return null; } StoredProcedureGroupProjectItem item1 = (StoredProcedureGroupProjectItem) parentItem; PromptDialog dialog = new PromptDialog(base.ServiceProvider); dialog.Text = "Create New Stored Procedure"; dialog.EntryText = "Enter the name of the new stored procedure:"; IMxUIService service = (IMxUIService) base.GetService(typeof(IMxUIService)); Label_004A: if (service.ShowDialog(dialog) == DialogResult.OK) { string str = dialog.EntryValue.Trim(); string str2 = this.GetIdentifierPart(str); if (!this.ValidateProjectItemName(str2)) { service.ReportError("The name '" + str + "' contains invalid characters or is too long.", "Create New Stored Procedure", false); goto Label_004A; } try { this.Database.Connect(); StoredProcedureCollection storedProcedures = this.Database.StoredProcedures; if (storedProcedures.Contains(str2)) { service.ReportError("A stored procedure with the name '" + str + "' already exists.", "Create New Stored Procedure", false); goto Label_004A; } storedProcedures.AddNew(str2); return new StoredProcedureProjectItem(str2); } catch (Exception exception) { service.ReportError(exception, "Error adding stored procedure.", false); goto Label_004A; } finally { this.Database.Disconnect(); } } return null; }
protected internal override FolderProjectItem CreateFolderInternal(FolderProjectItem parentItem) { IMxUIService service = (IMxUIService) base.GetService(typeof(IMxUIService)); PromptDialog dialog = new PromptDialog(base.ServiceProvider); dialog.Text = "Create New Folder"; dialog.EntryText = "Enter the name of the new folder:"; if (service.ShowDialog(dialog) != DialogResult.OK) { return null; } string entryValue = dialog.EntryValue; if (!this.ValidateProjectItemName(entryValue)) { service.ReportError("The name, '" + entryValue + "' contains invalid characters.", "Create New Folder", false); return null; } string path = this.CombinePath(parentItem.Path, entryValue); if (Directory.Exists(path)) { throw new ArgumentException("A folder with the path '" + path + "' already exists."); } Directory.CreateDirectory(path); return new DirectoryProjectItem(entryValue); }
protected internal override DocumentProjectItem CreateDocumentInternal(FolderProjectItem parentItem) { IDocumentManager service = (IDocumentManager) base.GetService(typeof(IDocumentManager)); return service.CreateDocument(this, parentItem, true); }
protected override FolderProjectItem CreateFolderInternal(FolderProjectItem parentItem) { string str2; IMxUIService service = (IMxUIService) base.GetService(typeof(IMxUIService)); PromptDialog dialog = new PromptDialog(base.ServiceProvider); dialog.Text = "Create New Folder"; dialog.EntryText = "Enter the name of the new folder:"; if (service.ShowDialog(dialog) != DialogResult.OK) { return null; } string entryValue = dialog.EntryValue; if (!this.ValidateProjectItemName(entryValue)) { service.ReportError("The name, '" + entryValue + "' contains invalid characters.", "Create New Folder", false); return null; } if (parentItem == this._rootItem) { str2 = entryValue; } else { str2 = this.CombinePath(parentItem.Path, entryValue); } this._connection.CreateDirectory(str2); return new DirectoryProjectItem(entryValue); }
DocumentProjectItem IDocumentManager.CreateDocument(Project project, FolderProjectItem parentItem, bool fixedParentItem) { if (project == null) { throw new ArgumentNullException("project"); } if (fixedParentItem && (parentItem == null)) { throw new ArgumentNullException("parentItem"); } IMxUIService service = (IMxUIService) this._serviceProvider.GetService(typeof(IMxUIService)); string location = null; if (parentItem != null) { location = parentItem.Path; } AddFileDialog dialog = new AddFileDialog(project, location, fixedParentItem); if (service.ShowDialog(dialog) == DialogResult.OK) { return dialog.NewProjectItem; } return null; }