public FieldCollection ConvertFieldValuesToFieldCollection(List <DTOs.FieldValue> fieldValues)
        {
            FieldCollection fields = new FieldCollection();

            foreach (var fieldValue in fieldValues)
            {
                kCura.EventHandler.FieldValue ehFieldValue = new kCura.EventHandler.FieldValue(fieldValue.Value);
                kCura.EventHandler.Field      field        = new kCura.EventHandler.Field(fieldValue.ArtifactID, fieldValue.Name, "Column Name?", (int)fieldValue.FieldType, null, (int)fieldValue.FieldCategory, false, true, ehFieldValue, fieldValue.Guids);
                fields.Add(field);
            }

            return(fields);
        }
示例#2
0
        public override kCura.EventHandler.Console GetConsole(PageEvent pageEvent)
        {
            kCura.EventHandler.Console retVal = new kCura.EventHandler.Console();
            retVal.ButtonList = GetButtons();
            retVal.Title      = "Kramerica Video Indexer Console";

            try
            {
                if (pageEvent == PageEvent.Load)
                {
                    kCura.EventHandler.Field myStatusField = this.ActiveArtifact.Fields[ApplicationConstants.INDEX_JOB_STATUS.ToString()];
                    string myStatusValue = (string)myStatusField.Value.Value;
                    switch (myStatusValue)
                    {
                    case "Created":
                        _startButton.Enabled   = true;
                        _refreshButton.Enabled = false;
                        _videoButton.Enabled   = false;
                        break;

                    case "Complete":
                        _startButton.Enabled   = false;
                        _refreshButton.Enabled = false;
                        _videoButton.Enabled   = true;
                        string customPageUrl    = GetCustomPageUrl();
                        String playerJavaScript = String.Format("window.open('{0}', '', 'location=no,scrollbars=yes,menubar=no,toolbar=no,status=no,resizable=yes,width=1920,height=1080');", customPageUrl);
                        _videoButton.OnClickEvent = playerJavaScript;
                        break;

                    default:
                        _startButton.Enabled   = false;
                        _refreshButton.Enabled = true;
                        _videoButton.Enabled   = false;
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                LogError(ex);
            }

            return(retVal);
        }
        private async Task <bool> UpdateStatus()
        {
            bool success = false;

            try
            {
                kCura.EventHandler.Field myStatusField = this.ActiveArtifact.Fields[ApplicationConstants.INDEX_JOB_STATUS.ToString()];
                if (myStatusField.Value.Value == null)
                {
                    using (IObjectManager manager = this.Helper.GetServicesManager().CreateProxy <IObjectManager>(Relativity.API.ExecutionIdentity.CurrentUser))
                    {
                        var toUpdate = new RelativityObjectRef {
                            ArtifactID = ActiveArtifact.ArtifactID
                        };
                        var fieldValuePair = new FieldRefValuePair()
                        {
                            Field = new FieldRef()
                            {
                                Guid = ApplicationConstants.INDEX_JOB_STATUS
                            }, Value = "Created"
                        };
                        var updateRequest = new UpdateRequest {
                            Object = toUpdate, FieldValues = new FieldRefValuePair[] { fieldValuePair }
                        };
                        await manager.UpdateAsync(this.Helper.GetActiveCaseID(), updateRequest);
                    }
                }
                success = true;
            }
            catch (Exception ex)
            {
                LogError(ex);
                success = false;
            }
            return(success);
        }