public static frmScriptEditor OpenSharedScript(SharedScriptsItemData itemData, ConnectionParams cp) { string dbName = String.Empty; string caption = String.Empty; string script = String.Empty; if (itemData == null) { throw new NullParameterException("ItemData is null!"); } if (cp != null) { dbName = cp.Database; } caption = itemData.Name + "{Shared script}"; script = itemData.Script; frmScriptEditor frm = new frmScriptEditor(); frm.Icon = PragmaSQL.Properties.Resources.sharedScript; frm.ContentPersister = new SharedScriptContentPersister(); frm.ContentPersister.Data = itemData; frm.ContentPersister.Hint = "This is a shared script: " + itemData.Name; frm.ContentInfo = frm.ContentPersister.Hint; frm.ContentPersister.ContentName = itemData.Name; frm.InitializeScriptEditor(caption, script, DBObjectType.None, cp, dbName); return(frm); }
public static frmScriptEditor Create(string caption, string script, ConnectionParams cp) { if (cp == null) { throw new NullParameterException("ConnectionParams paremeter is null!"); } frmScriptEditor frm = new frmScriptEditor(); frm.InitializeScriptEditor(caption, script, DBObjectType.None, cp, cp.Database); return(frm); }
public static frmScriptEditor Create(string caption, NodeData data) { if (data == null) { throw new NullParameterException("NodeData paremeter is null!"); } frmScriptEditor frm = new frmScriptEditor(); frm.InitializeScriptEditor(caption, String.Empty, DBObjectType.None, data.ConnParams, data.DBName); return(frm); }
public static frmScriptEditor Create(string caption, string script, int objectType, ConnectionParams cp, string dBName) { if (cp == null) { throw new NullParameterException("ConnectionParams paremeter is null!"); } frmScriptEditor frm = new frmScriptEditor(); frm.InitializeScriptEditor(caption, script, objectType, cp, dBName); return(frm); }
internal static frmScriptEditor CreateNew(string caption, string script, NodeData data) { if (data == null) { throw new NullParameterException("NodeData paremeter is null!"); } frmScriptEditor frm = new frmScriptEditor(); frm.InitializeScriptEditor(caption, script, data.ID, data.Type, data.ConnParams, data.DBName, false); return(frm); }
internal static frmScriptEditor Create(string caption, string script, NodeData data) { if (data == null) { throw new NullParameterException("NodeData paremeter is null!"); } frmScriptEditor frm = null; string windowId = ScriptEditorManager.ProduceWindowId(caption, data.ID, data.Type, data.ConnParams.Server, data.DBName); frm = CheckEditorAlreadyExits(windowId, caption, script); if (frm != null) { return(frm); } frm = new frmScriptEditor(); frm.InitializeScriptEditor(caption, script, data.ID, data.Type, data.ConnParams, data.DBName); return(frm); }
internal static frmScriptEditor OpenSharedScript(SharedScriptsItemData itemData, ConnectionParams cp) { string dbName = String.Empty; string caption = String.Empty; string script = String.Empty; if (itemData == null) { throw new NullParameterException("ItemData is null!"); } caption = itemData.Name; script = itemData.Script; if (cp != null) { dbName = cp.Database; } frmScriptEditor frm = null; string windowId = ScriptEditorManager.ProduceWindowId(itemData.Name, itemData.ID ?? -1, DBObjectType.SharedScript, cp.Server, dbName); frm = CheckEditorAlreadyExits(windowId, caption, script); if (frm != null) { return(frm); } frm = new frmScriptEditor(); frm.Icon = PragmaSQL.Properties.Resources.sharedScript; frm.ContentPersister = new SharedScriptContentPersister(); frm.ContentPersister.Data = itemData; frm.ContentPersister.Hint = "This is a shared script: " + itemData.Name; frm.ContentInfo = frm.ContentPersister.Hint; frm.ContentPersister.FilePath = itemData.Name; frm.InitializeScriptEditor(caption, script, itemData.ID ?? -1, DBObjectType.SharedScript, cp, dbName); return(frm); }
internal static frmScriptEditor Create(ObjectInfo objInfo, ConnectionParams cp, string dBName) { if (objInfo == null) { throw new InvalidOperationException("ObjectInfo parameter is null!"); } if (cp == null) { throw new NullParameterException("ConnectionParams paremeter is null!"); } ConnectionParams tmp = cp.CreateCopy(); if (!String.IsNullOrEmpty(dBName)) { tmp.Database = dBName; } string script = ScriptingHelper.GetAlterScript(tmp, objInfo.ObjectID, objInfo.ObjectType); string caption = objInfo.ObjectName; frmScriptEditor frm = null; string windowId = ScriptEditorManager.ProduceWindowId(objInfo.ObjectName, objInfo.ObjectID, objInfo.ObjectType, cp.Server, dBName); frm = CheckEditorAlreadyExits(windowId, caption, script); if (frm != null) { return(frm); } frm = new frmScriptEditor(); frm.InitializeScriptEditor(caption, script, objInfo.ObjectID, objInfo.ObjectType, cp, String.IsNullOrEmpty(dBName) ? cp.Database : dBName); return(frm); }
internal static frmScriptEditor Create(string caption, string script, long objectId, int objectType, ConnectionParams cp, string dBName, string filePath) { if (cp == null) { throw new NullParameterException("ConnectionParams paremeter is null!"); } frmScriptEditor frm = null; string windowId = ScriptEditorManager.ProduceWindowId(caption, objectId, objectType, cp.Server, dBName); frm = CheckEditorAlreadyExits(windowId, caption, script); if (frm != null) { return(frm); } frm = new frmScriptEditor(); frm.InitializeScriptEditor(caption, script, objectId, objectType, cp, dBName); if (!String.IsNullOrEmpty(filePath)) { frm.SetFilePath(filePath); } return(frm); }