示例#1
0
        private DTOs.RelativityScript GetRelativityScriptByName()
        {
            DTOs.RelativityScript script = null;

            //Aseemble Relativity script query
            TextCondition nameCondition = new TextCondition(DTOs.RelativityScriptFieldNames.Name, TextConditionEnum.EqualTo, MainApp.Helper.Constant.SAVED_SEARCH_NAME);

            DTOs.Query <DTOs.RelativityScript> relScriptQuery =
                new DTOs.Query <DTOs.RelativityScript>
            {
                Condition = nameCondition,
                Fields    = DTOs.FieldValue.NoFields
            };

            try
            {
                // Execute query
                DTOs.QueryResultSet <DTOs.RelativityScript> relScriptQueryResults = null;

                relScriptQueryResults = Connection.Repositories.RelativityScript.Query(relScriptQuery);

                if (relScriptQueryResults.Success)
                {
                    script = relScriptQueryResults.Results[0].Artifact;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(script);
        }
        public RelativityScriptResult ExecuteRelativityScript(DTOs.RelativityScript script, List <RelativityScriptInput> inputs, RelativityWorkspace workspace)
        {
            if (script == null)
            {
                throw new ArgumentNullException("script");
            }

            if (script.ArtifactID == 0)
            {
                throw new ArgumentNullException("script.ArtfactID");
            }

            return(this.InWorkspace(
                       (client, ws) => client.Repositories.RelativityScript.ExecuteRelativityScript(script, inputs), workspace));
        }
 public List <Models.ScriptInput> GetScriptInputs(RelativityScript script, RelativityWorkspace workspace)
 {
     return(this.InWorkspace(
                (client, ws) =>
     {
         var scriptArtifact = new DTOs.RelativityScript(script.RelativityScriptId);
         var fields = client.Repositories.RelativityScript.GetRelativityScriptInputs(scriptArtifact);
         return fields.Select(f => new Models.ScriptInput()
         {
             Name = f.Name,
             InputId = f.Id,
             InputType = f.InputType.ToString(),
             IsRequired = f.IsRequired
         }).ToList();
     }, workspace));
 }
示例#4
0
        private RelativityScriptResult FilterBySavedSearch(int SavedSearch)
        {
            // STEP 1: Find script
            DTOs.RelativityScript script = this.GetRelativityScriptByName();

            // STEP 2: Set parameters and execute script
            List <RelativityScriptInput> scriptInputs = new List <RelativityScriptInput>();

            scriptInputs.Add(new RelativityScriptInput("SavedSearch", SavedSearch.ToString()));

            RelativityScriptResult scriptResult = Connection.Repositories.RelativityScript.ExecuteRelativityScript(script, scriptInputs);

            if (!scriptResult.Success)
            {
                throw new ApplicationException(scriptResult.Message);
            }

            return(scriptResult);
        }