Exemple #1
0
        public void RemoveQueryScript(string name)
        {
            QueryScript queryScript = QueryScripts.Where(x => x.Name == name).FirstOrDefault();

            if (queryScript != null)
            {
                queryScript.QueryScriptWindow.Close();
                QueryScripts.Remove(queryScript);
            }
        }
Exemple #2
0
        public List <QueryScript> GetMasterQueryScripts(QueryScript script)
        {
            List <QueryScript> masterQueryScripts = new List <QueryScript>();

            foreach (var queryScript in QueryScripts)
            {
                if (script != queryScript && script.ScriptText != null && script.ScriptText.Contains(Util.ScriptUtil.ScriptNameToken(queryScript.Name)))
                {
                    masterQueryScripts.Add(queryScript);
                }
            }
            return(masterQueryScripts);
        }
 public QueryScript(Forms.MainAppWindow mainAppWindow, QueryScript queryScriptToClone)
     : this(name : queryScriptToClone.Name, mainAppWindow : mainAppWindow)
 {
     this.Name                 = queryScriptToClone.Name;
     this.Duration             = queryScriptToClone.Duration;
     this.EndTime              = queryScriptToClone.EndTime;
     this.StartTime            = queryScriptToClone.StartTime;
     this.ScriptText           = queryScriptToClone.ScriptText;
     this.TranslatedScript     = queryScriptToClone.TranslatedScript;
     this.RunOnParentRowSelect = queryScriptToClone.RunOnParentRowSelect;
     this.TaskStatus           = queryScriptToClone.TaskStatus;
     this.ResultDataTable      = queryScriptToClone.ResultDataTable;
     this.ResultText           = queryScriptToClone.ResultText;
 }
Exemple #4
0
        public void RenameQueryScript(string oldName, string newName)
        {
            // Rename the script token in any script that might be using it
            string      oldToken       = Util.ScriptUtil.ScriptNameToken(oldName);
            string      newToken       = Util.ScriptUtil.ScriptNameToken(newName);
            QueryScript scriptToRename = GetQueryScriptByName(oldName);

            scriptToRename.Name = newName;
            scriptToRename.QueryScriptWindow.SetWindowName(newName);
            foreach (QueryScript queryScript in QueryScripts)
            {
                if (!string.IsNullOrWhiteSpace(queryScript.ScriptText))
                {
                    queryScript.ScriptText = queryScript.ScriptText.Replace(oldToken, newToken);
                    queryScript.QueryScriptWindow.UpdateTranslatedQuery();
                }
            }
        }
Exemple #5
0
        public List <QueryScript> GetDependentQueryScripts(QueryScript script, bool allDescendants = true)
        {
            List <QueryScript> dependentQueryScripts = new List <QueryScript>();

            foreach (var queryScript in QueryScripts)
            {
                if (script != queryScript && queryScript.ScriptText != null && queryScript.ScriptText.Contains(Util.ScriptUtil.ScriptNameToken(script.Name)))
                {
                    dependentQueryScripts.Add(queryScript);
                    if (allDescendants)
                    {
                        foreach (QueryScript dependentScript in GetDependentQueryScripts(queryScript))
                        {
                            if (!dependentQueryScripts.Contains(dependentScript))
                            {
                                dependentQueryScripts.Add(dependentScript);
                            }
                        }
                    }
                }
            }
            return(dependentQueryScripts);
        }